From 40c8d7e4b7b2bcc6a8916a6459d26cf15ef19680 Mon Sep 17 00:00:00 2001 From: jamesgeorge007 Date: Thu, 7 Mar 2024 10:03:11 +0530 Subject: [PATCH] feat: persist bulk mode line wrap setting for request variables - Show line wrap toggle only if entries are present under http request headers & URL encoded params body. - Organize imports. --- .../src/components/http/Headers.vue | 2 +- .../src/components/http/RequestVariables.vue | 13 +++++--- .../src/components/http/URLEncodedParams.vue | 2 +- .../src/newstore/settings.ts | 2 ++ .../persistence/validation-schemas/index.ts | 31 ++++++++++--------- 5 files changed, 29 insertions(+), 21 deletions(-) diff --git a/packages/hoppscotch-common/src/components/http/Headers.vue b/packages/hoppscotch-common/src/components/http/Headers.vue index f25028c69..13d949e51 100644 --- a/packages/hoppscotch-common/src/components/http/Headers.vue +++ b/packages/hoppscotch-common/src/components/http/Headers.vue @@ -26,7 +26,7 @@ @click="clearContent()" /> (null) const bulkVariables = ref("") -const linewrapEnabled = ref(true) + +const WRAP_LINES = useNestedSetting("WRAP_LINES", "httpRequestVariables") const deletionToast = ref<{ goAway: (delay: number) => void } | null>(null) @@ -222,7 +227,7 @@ useCodemirror( extendedEditorConfig: { mode: "text/x-yaml", placeholder: `${t("state.bulk_mode_placeholder")}`, - lineWrapping: linewrapEnabled, + lineWrapping: WRAP_LINES, }, linter, completer: null, diff --git a/packages/hoppscotch-common/src/components/http/URLEncodedParams.vue b/packages/hoppscotch-common/src/components/http/URLEncodedParams.vue index 3d5505101..33ce113f5 100644 --- a/packages/hoppscotch-common/src/components/http/URLEncodedParams.vue +++ b/packages/hoppscotch-common/src/components/http/URLEncodedParams.vue @@ -21,7 +21,7 @@ @click="clearContent()" /> ({ httpUrlEncoded: true, httpPreRequest: true, httpTest: true, + httpRequestVariables: true, graphqlQuery: true, graphqlResponseBody: true, graphqlHeaders: false, diff --git a/packages/hoppscotch-common/src/services/persistence/validation-schemas/index.ts b/packages/hoppscotch-common/src/services/persistence/validation-schemas/index.ts index 5b864a437..640604286 100644 --- a/packages/hoppscotch-common/src/services/persistence/validation-schemas/index.ts +++ b/packages/hoppscotch-common/src/services/persistence/validation-schemas/index.ts @@ -48,21 +48,22 @@ const SettingsDefSchema = z.object({ WRAP_LINES: z.optional( z.object({ - httpRequestBody: z.boolean(), - httpResponseBody: z.boolean(), - httpHeaders: z.boolean(), - httpParams: z.boolean(), - httpUrlEncoded: z.boolean(), - httpPreRequest: z.boolean(), - httpTest: z.boolean(), - graphqlQuery: z.boolean(), - graphqlResponseBody: z.boolean(), - graphqlHeaders: z.boolean(), - graphqlVariables: z.boolean(), - graphqlSchema: z.boolean(), - importCurl: z.boolean(), - codeGen: z.boolean(), - cookie: z.boolean(), + httpRequestBody: z.boolean().catch(true), + httpResponseBody: z.boolean().catch(true), + httpHeaders: z.boolean().catch(true), + httpParams: z.boolean().catch(true), + httpUrlEncoded: z.boolean().catch(true), + httpPreRequest: z.boolean().catch(true), + httpTest: z.boolean().catch(true), + httpRequestVariables: z.boolean().catch(true), + graphqlQuery: z.boolean().catch(true), + graphqlResponseBody: z.boolean().catch(true), + graphqlHeaders: z.boolean().catch(false), + graphqlVariables: z.boolean().catch(false), + graphqlSchema: z.boolean().catch(true), + importCurl: z.boolean().catch(true), + codeGen: z.boolean().catch(true), + cookie: z.boolean().catch(true), }) ), })