chore: minoir ui and code refactor
This commit is contained in:
@@ -20,7 +20,7 @@
|
|||||||
:label="unref(interceptor.name(t))"
|
:label="unref(interceptor.name(t))"
|
||||||
:selected="interceptorSelection === interceptor.interceptorID"
|
:selected="interceptorSelection === interceptor.interceptorID"
|
||||||
:class="{
|
:class="{
|
||||||
'px-0 hover:bg-transparent': !isTooltipComponent,
|
'!px-0 hover:bg-transparent': !isTooltipComponent,
|
||||||
}"
|
}"
|
||||||
@change="interceptorSelection = interceptor.interceptorID"
|
@change="interceptorSelection = interceptor.interceptorID"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import { cloneDeep, defaultsDeep, has } from "lodash-es"
|
import { cloneDeep, defaultsDeep, has } from "lodash-es"
|
||||||
import { Observable } from "rxjs"
|
import { Observable } from "rxjs"
|
||||||
import { distinctUntilChanged, pluck } from "rxjs/operators"
|
import { distinctUntilChanged, pluck } from "rxjs/operators"
|
||||||
import { nextTick } from "vue"
|
|
||||||
import { platform } from "~/platform"
|
|
||||||
import type { KeysMatching } from "~/types/ts-utils"
|
import type { KeysMatching } from "~/types/ts-utils"
|
||||||
import DispatchingStore, { defineDispatchers } from "./DispatchingStore"
|
import DispatchingStore, { defineDispatchers } from "./DispatchingStore"
|
||||||
|
|
||||||
@@ -70,61 +68,52 @@ export type SettingsDef = {
|
|||||||
HAS_OPENED_SPOTLIGHT: boolean
|
HAS_OPENED_SPOTLIGHT: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getDefaultSettings = (): SettingsDef => {
|
export const getDefaultSettings = (): SettingsDef => ({
|
||||||
const defaultSettings: SettingsDef = {
|
syncCollections: true,
|
||||||
syncCollections: true,
|
syncHistory: true,
|
||||||
syncHistory: true,
|
syncEnvironments: true,
|
||||||
syncEnvironments: true,
|
|
||||||
|
|
||||||
WRAP_LINES: {
|
WRAP_LINES: {
|
||||||
httpRequestBody: true,
|
httpRequestBody: true,
|
||||||
httpResponseBody: true,
|
httpResponseBody: true,
|
||||||
httpHeaders: true,
|
httpHeaders: true,
|
||||||
httpParams: true,
|
httpParams: true,
|
||||||
httpUrlEncoded: true,
|
httpUrlEncoded: true,
|
||||||
httpPreRequest: true,
|
httpPreRequest: true,
|
||||||
httpTest: true,
|
httpTest: true,
|
||||||
httpRequestVariables: true,
|
httpRequestVariables: true,
|
||||||
graphqlQuery: true,
|
graphqlQuery: true,
|
||||||
graphqlResponseBody: true,
|
graphqlResponseBody: true,
|
||||||
graphqlHeaders: false,
|
graphqlHeaders: false,
|
||||||
graphqlVariables: false,
|
graphqlVariables: false,
|
||||||
graphqlSchema: true,
|
graphqlSchema: true,
|
||||||
importCurl: true,
|
importCurl: true,
|
||||||
codeGen: true,
|
codeGen: true,
|
||||||
cookie: true,
|
cookie: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
CURRENT_INTERCEPTOR_ID: "",
|
// Set empty because interceptor module will set the default value
|
||||||
|
CURRENT_INTERCEPTOR_ID: "",
|
||||||
|
|
||||||
// TODO: Interceptor related settings should move under the interceptor systems
|
// TODO: Interceptor related settings should move under the interceptor systems
|
||||||
PROXY_URL: "https://proxy.hoppscotch.io/",
|
PROXY_URL: "https://proxy.hoppscotch.io/",
|
||||||
URL_EXCLUDES: {
|
URL_EXCLUDES: {
|
||||||
auth: true,
|
auth: true,
|
||||||
httpUser: true,
|
httpUser: true,
|
||||||
httpPassword: true,
|
httpPassword: true,
|
||||||
bearerToken: true,
|
bearerToken: true,
|
||||||
oauth2Token: true,
|
oauth2Token: true,
|
||||||
},
|
},
|
||||||
THEME_COLOR: "indigo",
|
THEME_COLOR: "indigo",
|
||||||
BG_COLOR: "system",
|
BG_COLOR: "system",
|
||||||
TELEMETRY_ENABLED: true,
|
TELEMETRY_ENABLED: true,
|
||||||
EXPAND_NAVIGATION: false,
|
EXPAND_NAVIGATION: false,
|
||||||
SIDEBAR: true,
|
SIDEBAR: true,
|
||||||
SIDEBAR_ON_LEFT: false,
|
SIDEBAR_ON_LEFT: false,
|
||||||
COLUMN_LAYOUT: true,
|
COLUMN_LAYOUT: true,
|
||||||
|
|
||||||
HAS_OPENED_SPOTLIGHT: false,
|
HAS_OPENED_SPOTLIGHT: false,
|
||||||
}
|
})
|
||||||
|
|
||||||
// Wait for platform to initialize before setting CURRENT_INTERCEPTOR_ID
|
|
||||||
nextTick(() => {
|
|
||||||
defaultSettings.CURRENT_INTERCEPTOR_ID =
|
|
||||||
platform?.interceptors.default || "browser"
|
|
||||||
})
|
|
||||||
|
|
||||||
return defaultSettings
|
|
||||||
}
|
|
||||||
|
|
||||||
type ApplySettingPayload = {
|
type ApplySettingPayload = {
|
||||||
[K in keyof SettingsDef]: {
|
[K in keyof SettingsDef]: {
|
||||||
|
|||||||
@@ -98,13 +98,10 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="space-y-8 p-8 md:col-span-2">
|
<div class="space-y-8 p-8 md:col-span-2">
|
||||||
<section class="flex flex-col">
|
<section class="flex flex-col space-y-2">
|
||||||
<h4 class="font-semibold text-secondaryDark">
|
<h4 class="font-semibold text-secondaryDark">
|
||||||
{{ t("settings.interceptor") }}
|
{{ t("settings.interceptor") }}
|
||||||
</h4>
|
</h4>
|
||||||
<p class="my-1 text-secondaryLight capitalize">
|
|
||||||
{{ interceptorService.currentInterceptor.value?.interceptorID }}
|
|
||||||
</p>
|
|
||||||
<AppInterceptor :is-tooltip-component="false" />
|
<AppInterceptor :is-tooltip-component="false" />
|
||||||
</section>
|
</section>
|
||||||
<section v-for="[id, settings] in interceptorsWithSettings" :key="id">
|
<section v-for="[id, settings] in interceptorsWithSettings" :key="id">
|
||||||
|
|||||||
Reference in New Issue
Block a user