fix: no selected option tab during the initial load
This commit is contained in:
@@ -88,18 +88,19 @@ import { runRESTRequest$ } from "~/helpers/RequestRunner"
|
|||||||
import { HoppTab } from "~/services/tab"
|
import { HoppTab } from "~/services/tab"
|
||||||
import { HoppRESTDocument } from "~/helpers/rest/document"
|
import { HoppRESTDocument } from "~/helpers/rest/document"
|
||||||
import IconSave from "~icons/lucide/save"
|
import IconSave from "~icons/lucide/save"
|
||||||
|
import { RESTOptionTabs } from "../http/RequestOptions.vue"
|
||||||
const t = useI18n()
|
const t = useI18n()
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
modelTab: HoppTab<HoppRESTDocument>
|
modelTab: HoppTab<HoppRESTDocument>
|
||||||
properties: string[]
|
properties: RESTOptionTabs[]
|
||||||
sharedRequestID: string
|
sharedRequestID: string
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const tab = useModel(props, "modelTab")
|
const tab = useModel(props, "modelTab")
|
||||||
|
|
||||||
const selectedOptionTab = ref(props.properties[0])
|
const selectedOptionTab = ref<RESTOptionTabs>(props.properties[0])
|
||||||
|
|
||||||
const requestCancelFunc: Ref<(() => void) | null> = ref(null)
|
const requestCancelFunc: Ref<(() => void) | null> = ref(null)
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
render-inactive-tabs
|
render-inactive-tabs
|
||||||
>
|
>
|
||||||
<HoppSmartTab
|
<HoppSmartTab
|
||||||
v-if="properties ? properties.includes('parameters') : true"
|
v-if="properties ? properties.includes('params') : true"
|
||||||
:id="'params'"
|
:id="'params'"
|
||||||
:label="`${t('tab.parameters')}`"
|
:label="`${t('tab.parameters')}`"
|
||||||
:info="`${newActiveParamsCount$}`"
|
:info="`${newActiveParamsCount$}`"
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
<HttpParameters v-model="request.params" />
|
<HttpParameters v-model="request.params" />
|
||||||
</HoppSmartTab>
|
</HoppSmartTab>
|
||||||
<HoppSmartTab
|
<HoppSmartTab
|
||||||
v-if="properties ? properties.includes('body') : true"
|
v-if="properties ? properties.includes('bodyParams') : true"
|
||||||
:id="'bodyParams'"
|
:id="'bodyParams'"
|
||||||
:label="`${t('tab.body')}`"
|
:label="`${t('tab.body')}`"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ const widgets: Widget[] = [
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
type Tabs = "parameters" | "body" | "headers" | "authorization"
|
type Tabs = "params" | "bodyParams" | "headers" | "authorization"
|
||||||
|
|
||||||
type EmbedOption = {
|
type EmbedOption = {
|
||||||
selectedTab: Tabs
|
selectedTab: Tabs
|
||||||
@@ -116,15 +116,15 @@ type EmbedOption = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const embedOption = ref<EmbedOption>({
|
const embedOption = ref<EmbedOption>({
|
||||||
selectedTab: "parameters",
|
selectedTab: "params",
|
||||||
tabs: [
|
tabs: [
|
||||||
{
|
{
|
||||||
value: "parameters",
|
value: "params",
|
||||||
label: t("tab.parameters"),
|
label: t("tab.parameters"),
|
||||||
enabled: true,
|
enabled: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "body",
|
value: "bodyParams",
|
||||||
label: t("tab.body"),
|
label: t("tab.body"),
|
||||||
enabled: true,
|
enabled: true,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -225,10 +225,10 @@ const props = defineProps({
|
|||||||
embedOptions: {
|
embedOptions: {
|
||||||
type: Object as PropType<EmbedOption>,
|
type: Object as PropType<EmbedOption>,
|
||||||
default: () => ({
|
default: () => ({
|
||||||
selectedTab: "parameters",
|
selectedTab: "params",
|
||||||
tabs: [
|
tabs: [
|
||||||
{
|
{
|
||||||
value: "parameters",
|
value: "params",
|
||||||
label: "shared_requests.parameters",
|
label: "shared_requests.parameters",
|
||||||
enabled: true,
|
enabled: true,
|
||||||
},
|
},
|
||||||
@@ -290,7 +290,7 @@ const widgets: Widget[] = [
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
type EmbedTabs = "parameters" | "body" | "headers" | "authorization"
|
type EmbedTabs = "params" | "bodyParams" | "headers" | "authorization"
|
||||||
|
|
||||||
type EmbedOption = {
|
type EmbedOption = {
|
||||||
selectedTab: EmbedTabs
|
selectedTab: EmbedTabs
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ import { useI18n } from "~/composables/i18n"
|
|||||||
|
|
||||||
const t = useI18n()
|
const t = useI18n()
|
||||||
|
|
||||||
type EmbedTabs = "parameters" | "body" | "headers" | "authorization"
|
type EmbedTabs = "params" | "bodyParams" | "headers" | "authorization"
|
||||||
|
|
||||||
type EmbedOption = {
|
type EmbedOption = {
|
||||||
selectedTab: EmbedTabs
|
selectedTab: EmbedTabs
|
||||||
@@ -93,15 +93,15 @@ const props = defineProps({
|
|||||||
embedOptions: {
|
embedOptions: {
|
||||||
type: Object as PropType<EmbedOption>,
|
type: Object as PropType<EmbedOption>,
|
||||||
default: () => ({
|
default: () => ({
|
||||||
selectedTab: "parameters",
|
selectedTab: "params",
|
||||||
tabs: [
|
tabs: [
|
||||||
{
|
{
|
||||||
value: "parameters",
|
value: "params",
|
||||||
label: "shared_requests.parameters",
|
label: "shared_requests.parameters",
|
||||||
enabled: true,
|
enabled: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "body",
|
value: "bodyParams",
|
||||||
label: "shared_requests.body",
|
label: "shared_requests.body",
|
||||||
enabled: true,
|
enabled: true,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -136,15 +136,15 @@ const shareRequestCreatingLoading = ref(false)
|
|||||||
const requestToShare = ref<HoppRESTRequest | null>(null)
|
const requestToShare = ref<HoppRESTRequest | null>(null)
|
||||||
|
|
||||||
const embedOptions = ref<EmbedOption>({
|
const embedOptions = ref<EmbedOption>({
|
||||||
selectedTab: "parameters",
|
selectedTab: "params",
|
||||||
tabs: [
|
tabs: [
|
||||||
{
|
{
|
||||||
value: "parameters",
|
value: "params",
|
||||||
label: t("tab.parameters"),
|
label: t("tab.parameters"),
|
||||||
enabled: false,
|
enabled: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "body",
|
value: "bodyParams",
|
||||||
label: t("tab.body"),
|
label: t("tab.body"),
|
||||||
enabled: false,
|
enabled: false,
|
||||||
},
|
},
|
||||||
@@ -208,7 +208,7 @@ const currentUser = useReadonlyStream(
|
|||||||
|
|
||||||
const step = ref(1)
|
const step = ref(1)
|
||||||
|
|
||||||
type EmbedTabs = "parameters" | "body" | "headers" | "authorization"
|
type EmbedTabs = "params" | "bodyParams" | "headers" | "authorization"
|
||||||
|
|
||||||
type EmbedOption = {
|
type EmbedOption = {
|
||||||
selectedTab: EmbedTabs
|
selectedTab: EmbedTabs
|
||||||
@@ -251,9 +251,13 @@ onLoggedIn(() => {
|
|||||||
try {
|
try {
|
||||||
// wait for a bit to let the auth token to be set
|
// wait for a bit to let the auth token to be set
|
||||||
// because in some race conditions, the token is not set this fixes that
|
// because in some race conditions, the token is not set this fixes that
|
||||||
setTimeout(() => {
|
const initLoadTimeout = setTimeout(() => {
|
||||||
adapter.initialize()
|
adapter.initialize()
|
||||||
}, 10)
|
}, 10)
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
clearTimeout(initLoadTimeout)
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
}
|
}
|
||||||
@@ -317,15 +321,15 @@ const displayCustomizeRequestModal = (
|
|||||||
info: t("shared_requests.button_info"),
|
info: t("shared_requests.button_info"),
|
||||||
}
|
}
|
||||||
embedOptions.value = {
|
embedOptions.value = {
|
||||||
selectedTab: "parameters",
|
selectedTab: "params",
|
||||||
tabs: [
|
tabs: [
|
||||||
{
|
{
|
||||||
value: "parameters",
|
value: "params",
|
||||||
label: t("tab.parameters"),
|
label: t("tab.parameters"),
|
||||||
enabled: false,
|
enabled: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "body",
|
value: "bodyParams",
|
||||||
label: t("tab.body"),
|
label: t("tab.body"),
|
||||||
enabled: false,
|
enabled: false,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ import { computed } from "vue"
|
|||||||
|
|
||||||
import { useI18n } from "~/composables/i18n"
|
import { useI18n } from "~/composables/i18n"
|
||||||
|
|
||||||
type Tabs = "parameters" | "body" | "headers" | "authorization"
|
type Tabs = "params" | "bodyParams" | "headers" | "authorization"
|
||||||
|
|
||||||
type EmbedOption = {
|
type EmbedOption = {
|
||||||
selectedTab: Tabs
|
selectedTab: Tabs
|
||||||
|
|||||||
Reference in New Issue
Block a user