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.
This commit is contained in:
committed by
Andrew Bastin
parent
1d93d9dabe
commit
40c8d7e4b7
@@ -26,7 +26,7 @@
|
|||||||
@click="clearContent()"
|
@click="clearContent()"
|
||||||
/>
|
/>
|
||||||
<HoppButtonSecondary
|
<HoppButtonSecondary
|
||||||
v-if="bulkMode"
|
v-if="bulkHeaders"
|
||||||
v-tippy="{ theme: 'tooltip' }"
|
v-tippy="{ theme: 'tooltip' }"
|
||||||
:title="t('state.linewrap')"
|
:title="t('state.linewrap')"
|
||||||
:class="{ '!text-accent': WRAP_LINES }"
|
:class="{ '!text-accent': WRAP_LINES }"
|
||||||
|
|||||||
@@ -24,9 +24,11 @@
|
|||||||
v-if="bulkVariables"
|
v-if="bulkVariables"
|
||||||
v-tippy="{ theme: 'tooltip' }"
|
v-tippy="{ theme: 'tooltip' }"
|
||||||
:title="t('state.linewrap')"
|
:title="t('state.linewrap')"
|
||||||
:class="{ '!text-accent': linewrapEnabled }"
|
:class="{ '!text-accent': WRAP_LINES }"
|
||||||
:icon="IconWrapText"
|
:icon="IconWrapText"
|
||||||
@click.prevent="linewrapEnabled = !linewrapEnabled"
|
@click.prevent="
|
||||||
|
toggleNestedSetting('WRAP_LINES', 'httpRequestVariables')
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
<HoppButtonSecondary
|
<HoppButtonSecondary
|
||||||
v-tippy="{ theme: 'tooltip' }"
|
v-tippy="{ theme: 'tooltip' }"
|
||||||
@@ -191,6 +193,8 @@ import { objRemoveKey } from "~/helpers/functional/object"
|
|||||||
import { parseRawKeyValueEntriesE } from "@hoppscotch/data"
|
import { parseRawKeyValueEntriesE } from "@hoppscotch/data"
|
||||||
import { RawKeyValueEntry } from "@hoppscotch/data"
|
import { RawKeyValueEntry } from "@hoppscotch/data"
|
||||||
import { rawKeyValueEntriesToString } from "@hoppscotch/data"
|
import { rawKeyValueEntriesToString } from "@hoppscotch/data"
|
||||||
|
import { useNestedSetting } from "~/composables/settings"
|
||||||
|
import { toggleNestedSetting } from "~/newstore/settings"
|
||||||
|
|
||||||
const colorMode = useColorMode()
|
const colorMode = useColorMode()
|
||||||
|
|
||||||
@@ -200,7 +204,8 @@ const toast = useToast()
|
|||||||
const bulkMode = ref(false)
|
const bulkMode = ref(false)
|
||||||
const bulkEditor = ref<any | null>(null)
|
const bulkEditor = ref<any | null>(null)
|
||||||
const bulkVariables = ref("")
|
const bulkVariables = ref("")
|
||||||
const linewrapEnabled = ref(true)
|
|
||||||
|
const WRAP_LINES = useNestedSetting("WRAP_LINES", "httpRequestVariables")
|
||||||
|
|
||||||
const deletionToast = ref<{ goAway: (delay: number) => void } | null>(null)
|
const deletionToast = ref<{ goAway: (delay: number) => void } | null>(null)
|
||||||
|
|
||||||
@@ -222,7 +227,7 @@ useCodemirror(
|
|||||||
extendedEditorConfig: {
|
extendedEditorConfig: {
|
||||||
mode: "text/x-yaml",
|
mode: "text/x-yaml",
|
||||||
placeholder: `${t("state.bulk_mode_placeholder")}`,
|
placeholder: `${t("state.bulk_mode_placeholder")}`,
|
||||||
lineWrapping: linewrapEnabled,
|
lineWrapping: WRAP_LINES,
|
||||||
},
|
},
|
||||||
linter,
|
linter,
|
||||||
completer: null,
|
completer: null,
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
@click="clearContent()"
|
@click="clearContent()"
|
||||||
/>
|
/>
|
||||||
<HoppButtonSecondary
|
<HoppButtonSecondary
|
||||||
v-if="bulkMode"
|
v-if="bulkUrlEncodedParams"
|
||||||
v-tippy="{ theme: 'tooltip' }"
|
v-tippy="{ theme: 'tooltip' }"
|
||||||
:title="t('state.linewrap')"
|
:title="t('state.linewrap')"
|
||||||
:class="{ '!text-accent': WRAP_LINES }"
|
:class="{ '!text-accent': WRAP_LINES }"
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ export type SettingsDef = {
|
|||||||
httpUrlEncoded: boolean
|
httpUrlEncoded: boolean
|
||||||
httpPreRequest: boolean
|
httpPreRequest: boolean
|
||||||
httpTest: boolean
|
httpTest: boolean
|
||||||
|
httpRequestVariables: boolean
|
||||||
graphqlQuery: boolean
|
graphqlQuery: boolean
|
||||||
graphqlResponseBody: boolean
|
graphqlResponseBody: boolean
|
||||||
graphqlHeaders: boolean
|
graphqlHeaders: boolean
|
||||||
@@ -79,6 +80,7 @@ export const getDefaultSettings = (): SettingsDef => ({
|
|||||||
httpUrlEncoded: true,
|
httpUrlEncoded: true,
|
||||||
httpPreRequest: true,
|
httpPreRequest: true,
|
||||||
httpTest: true,
|
httpTest: true,
|
||||||
|
httpRequestVariables: true,
|
||||||
graphqlQuery: true,
|
graphqlQuery: true,
|
||||||
graphqlResponseBody: true,
|
graphqlResponseBody: true,
|
||||||
graphqlHeaders: false,
|
graphqlHeaders: false,
|
||||||
|
|||||||
@@ -48,21 +48,22 @@ const SettingsDefSchema = z.object({
|
|||||||
|
|
||||||
WRAP_LINES: z.optional(
|
WRAP_LINES: z.optional(
|
||||||
z.object({
|
z.object({
|
||||||
httpRequestBody: z.boolean(),
|
httpRequestBody: z.boolean().catch(true),
|
||||||
httpResponseBody: z.boolean(),
|
httpResponseBody: z.boolean().catch(true),
|
||||||
httpHeaders: z.boolean(),
|
httpHeaders: z.boolean().catch(true),
|
||||||
httpParams: z.boolean(),
|
httpParams: z.boolean().catch(true),
|
||||||
httpUrlEncoded: z.boolean(),
|
httpUrlEncoded: z.boolean().catch(true),
|
||||||
httpPreRequest: z.boolean(),
|
httpPreRequest: z.boolean().catch(true),
|
||||||
httpTest: z.boolean(),
|
httpTest: z.boolean().catch(true),
|
||||||
graphqlQuery: z.boolean(),
|
httpRequestVariables: z.boolean().catch(true),
|
||||||
graphqlResponseBody: z.boolean(),
|
graphqlQuery: z.boolean().catch(true),
|
||||||
graphqlHeaders: z.boolean(),
|
graphqlResponseBody: z.boolean().catch(true),
|
||||||
graphqlVariables: z.boolean(),
|
graphqlHeaders: z.boolean().catch(false),
|
||||||
graphqlSchema: z.boolean(),
|
graphqlVariables: z.boolean().catch(false),
|
||||||
importCurl: z.boolean(),
|
graphqlSchema: z.boolean().catch(true),
|
||||||
codeGen: z.boolean(),
|
importCurl: z.boolean().catch(true),
|
||||||
cookie: z.boolean(),
|
codeGen: z.boolean().catch(true),
|
||||||
|
cookie: z.boolean().catch(true),
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user