diff --git a/packages/hoppscotch-common/src/components/embeds/index.vue b/packages/hoppscotch-common/src/components/embeds/index.vue index 4e338553a..8a614141f 100644 --- a/packages/hoppscotch-common/src/components/embeds/index.vue +++ b/packages/hoppscotch-common/src/components/embeds/index.vue @@ -32,9 +32,13 @@ {{ tab.document.request.method }}
- {{ tab.document.request.endpoint }} +
@@ -69,6 +73,7 @@ v-model="tab.document.request" v-model:option-tab="selectedOptionTab" :properties="properties" + :envs="tabRequestVariables" /> { return `${shortcodeBaseURL}/r/${props.sharedRequestID}` }) +const tabRequestVariables = computed(() => { + return tab.value.document.request.requestVariables.map((v) => ({ + key: v.key, + value: v.value, + secret: false, + sourceEnv: "RequestVariable", + })) +}) + const { subscribeToStream } = useStreamSubscriber() const newSendRequest = async () => { diff --git a/packages/hoppscotch-common/src/components/http/Authorization.vue b/packages/hoppscotch-common/src/components/http/Authorization.vue index e59fb39b3..4108d3a14 100644 --- a/packages/hoppscotch-common/src/components/http/Authorization.vue +++ b/packages/hoppscotch-common/src/components/http/Authorization.vue @@ -150,7 +150,7 @@
- +
@@ -173,17 +173,22 @@ v-model="auth.token" placeholder="Token" :auto-complete-env="true" + :envs="envs" />
- +
- +
- +
() const emit = defineEmits<{ diff --git a/packages/hoppscotch-common/src/components/http/Body.vue b/packages/hoppscotch-common/src/components/http/Body.vue index 75c15ca95..0909de822 100644 --- a/packages/hoppscotch-common/src/components/http/Body.vue +++ b/packages/hoppscotch-common/src/components/http/Body.vue @@ -100,10 +100,12 @@ () const emit = defineEmits<{ diff --git a/packages/hoppscotch-common/src/components/http/BodyParameters.vue b/packages/hoppscotch-common/src/components/http/BodyParameters.vue index c8f13c4b1..8d782935e 100644 --- a/packages/hoppscotch-common/src/components/http/BodyParameters.vue +++ b/packages/hoppscotch-common/src/components/http/BodyParameters.vue @@ -73,6 +73,8 @@ isFile: entry.isFile, }) " + :auto-complete-env="true" + :envs="envs" />
@@ -95,6 +97,8 @@ isFile: entry.isFile, }) " + :auto-complete-env="true" + :envs="envs" /> @@ -190,11 +194,13 @@ import { useI18n } from "@composables/i18n" import { useToast } from "@composables/toast" import { useColorMode } from "@composables/theming" import { useVModel } from "@vueuse/core" +import { AggregateEnvironment } from "~/newstore/environments" type Body = HoppRESTReqBody & { contentType: "multipart/form-data" } const props = defineProps<{ modelValue: Body + envs: AggregateEnvironment[] }>() const emit = defineEmits<{ diff --git a/packages/hoppscotch-common/src/components/http/Headers.vue b/packages/hoppscotch-common/src/components/http/Headers.vue index 33fd0ecb8..f25028c69 100644 --- a/packages/hoppscotch-common/src/components/http/Headers.vue +++ b/packages/hoppscotch-common/src/components/http/Headers.vue @@ -93,6 +93,7 @@ :env-index="index" :inspection-results="getInspectorResult(headerKeyResults, index)" :auto-complete-env="true" + :envs="envs" @change=" updateHeader(index, { id: header.id, @@ -110,6 +111,7 @@ " :env-index="index" :auto-complete-env="true" + :envs="envs" @change=" updateHeader(index, { id: header.id, @@ -331,7 +333,11 @@ import { getComputedHeaders, getComputedAuthHeaders, } from "~/helpers/utils/EffectiveURL" -import { aggregateEnvs$, getAggregateEnvs } from "~/newstore/environments" +import { + AggregateEnvironment, + aggregateEnvs$, + getAggregateEnvs, +} from "~/newstore/environments" import { useVModel } from "@vueuse/core" import { useService } from "dioc/vue" import { InspectionService, InspectorResult } from "~/services/inspection" @@ -361,6 +367,7 @@ const props = defineProps<{ modelValue: HoppRESTRequest isCollectionProperty?: boolean inheritedProperties?: HoppInheritedProperty + envs?: AggregateEnvironment[] }>() const emit = defineEmits<{ diff --git a/packages/hoppscotch-common/src/components/http/OAuth2Authorization.vue b/packages/hoppscotch-common/src/components/http/OAuth2Authorization.vue index bb85607c5..fc1634257 100644 --- a/packages/hoppscotch-common/src/components/http/OAuth2Authorization.vue +++ b/packages/hoppscotch-common/src/components/http/OAuth2Authorization.vue @@ -8,6 +8,7 @@ " :auto-complete-env="true" placeholder="OpenID Connect Discovery URL" + :envs="envs" />
@@ -16,6 +17,7 @@ placeholder="Authorization URL" :auto-complete-env="true" :styles="hasOIDCURL ? 'pointer-events-none opacity-70' : ''" + :envs="envs" >
@@ -24,6 +26,7 @@ placeholder="Access Token URL" :auto-complete-env="true" :styles="hasOIDCURL ? 'pointer-events-none opacity-70' : ''" + :envs="envs" />
@@ -31,6 +34,7 @@ v-model="clientID" :auto-complete-env="true" placeholder="Client ID" + :envs="envs" />
@@ -38,6 +42,7 @@ v-model="clientSecret" :auto-complete-env="true" placeholder="Client Secret" + :envs="envs" />
@@ -45,6 +50,7 @@ v-model="scope" :auto-complete-env="true" placeholder="Scope" + :envs="envs" />
@@ -77,6 +83,7 @@ const toast = useToast() const props = defineProps<{ modelValue: HoppRESTAuthOAuth2 | HoppGQLAuthOAuth2 + envs?: AggregateEnvironment[] }>() const emit = defineEmits<{ diff --git a/packages/hoppscotch-common/src/components/http/Parameters.vue b/packages/hoppscotch-common/src/components/http/Parameters.vue index 19f54ae70..9e8463f11 100644 --- a/packages/hoppscotch-common/src/components/http/Parameters.vue +++ b/packages/hoppscotch-common/src/components/http/Parameters.vue @@ -88,6 +88,7 @@ getInspectorResult(parameterKeyResults, index) " :auto-complete-env="true" + :envs="envs" @change=" updateParam(index, { id: param.id, @@ -104,6 +105,7 @@ getInspectorResult(parameterValueResults, index) " :auto-complete-env="true" + :envs="envs" @change=" updateParam(index, { id: param.id, @@ -211,6 +213,7 @@ import { InspectionService, InspectorResult } from "~/services/inspection" import { RESTTabService } from "~/services/tab/rest" import { useNestedSetting } from "~/composables/settings" import { toggleNestedSetting } from "~/newstore/settings" +import { AggregateEnvironment } from "~/newstore/environments" const colorMode = useColorMode() @@ -244,6 +247,7 @@ useCodemirror( const props = defineProps<{ modelValue: HoppRESTParam[] + envs?: AggregateEnvironment[] }>() const emit = defineEmits<{ diff --git a/packages/hoppscotch-common/src/components/http/RequestOptions.vue b/packages/hoppscotch-common/src/components/http/RequestOptions.vue index a2fdf1a71..52fab4d29 100644 --- a/packages/hoppscotch-common/src/components/http/RequestOptions.vue +++ b/packages/hoppscotch-common/src/components/http/RequestOptions.vue @@ -10,7 +10,7 @@ :label="`${t('tab.parameters')}`" :info="`${newActiveParamsCount$}`" > - + @@ -32,6 +33,7 @@ @@ -43,6 +45,7 @@ (), { optionTab: "params", diff --git a/packages/hoppscotch-common/src/components/http/URLEncodedParams.vue b/packages/hoppscotch-common/src/components/http/URLEncodedParams.vue index 9f1418249..3d5505101 100644 --- a/packages/hoppscotch-common/src/components/http/URLEncodedParams.vue +++ b/packages/hoppscotch-common/src/components/http/URLEncodedParams.vue @@ -92,6 +92,8 @@ active: param.active, }) " + :auto-complete-env="true" + :envs="envs" /> () const emit = defineEmits<{ diff --git a/packages/hoppscotch-common/src/components/http/authorization/ApiKey.vue b/packages/hoppscotch-common/src/components/http/authorization/ApiKey.vue index fb84ead37..619eed912 100644 --- a/packages/hoppscotch-common/src/components/http/authorization/ApiKey.vue +++ b/packages/hoppscotch-common/src/components/http/authorization/ApiKey.vue @@ -4,6 +4,7 @@ v-model="auth.key" :auto-complete-env="true" placeholder="Key" + :envs="envs" />
@@ -11,6 +12,7 @@ v-model="auth.value" :auto-complete-env="true" placeholder="Value" + :envs="envs" />
@@ -73,11 +75,13 @@ import { useI18n } from "@composables/i18n" import { HoppRESTAuthAPIKey } from "@hoppscotch/data" import { useVModel } from "@vueuse/core" import { ref } from "vue" +import { AggregateEnvironment } from "~/newstore/environments" const t = useI18n() const props = defineProps<{ modelValue: HoppRESTAuthAPIKey + envs?: AggregateEnvironment[] }>() const emit = defineEmits<{ diff --git a/packages/hoppscotch-common/src/components/http/authorization/Basic.vue b/packages/hoppscotch-common/src/components/http/authorization/Basic.vue index 02e473999..15675efb2 100644 --- a/packages/hoppscotch-common/src/components/http/authorization/Basic.vue +++ b/packages/hoppscotch-common/src/components/http/authorization/Basic.vue @@ -4,6 +4,7 @@ v-model="auth.username" :placeholder="t('authorization.username')" :auto-complete-env="true" + :envs="envs" />
@@ -11,6 +12,7 @@ v-model="auth.password" :placeholder="t('authorization.password')" :auto-complete-env="true" + :envs="envs" />
@@ -19,11 +21,13 @@ import { useI18n } from "@composables/i18n" import { HoppRESTAuthBasic } from "@hoppscotch/data" import { useVModel } from "@vueuse/core" +import { AggregateEnvironment } from "~/newstore/environments" const t = useI18n() const props = defineProps<{ modelValue: HoppRESTAuthBasic + envs?: AggregateEnvironment[] }>() const emit = defineEmits<{ diff --git a/packages/hoppscotch-common/src/components/share/CustomizeModal.vue b/packages/hoppscotch-common/src/components/share/CustomizeModal.vue index 87a6ee85e..87d6e6c98 100644 --- a/packages/hoppscotch-common/src/components/share/CustomizeModal.vue +++ b/packages/hoppscotch-common/src/components/share/CustomizeModal.vue @@ -290,7 +290,12 @@ const widgets: Widget[] = [ }, ] -type EmbedTabs = "params" | "bodyParams" | "headers" | "authorization" +type EmbedTabs = + | "params" + | "bodyParams" + | "headers" + | "authorization" + | "requestVariables" type EmbedOption = { selectedTab: EmbedTabs diff --git a/packages/hoppscotch-common/src/components/share/Modal.vue b/packages/hoppscotch-common/src/components/share/Modal.vue index 942e5bc8d..38c0c1b40 100644 --- a/packages/hoppscotch-common/src/components/share/Modal.vue +++ b/packages/hoppscotch-common/src/components/share/Modal.vue @@ -56,7 +56,12 @@ import { useI18n } from "~/composables/i18n" const t = useI18n() -type EmbedTabs = "params" | "bodyParams" | "headers" | "authorization" +type EmbedTabs = + | "params" + | "bodyParams" + | "headers" + | "authorization" + | "requestVariables" type EmbedOption = { selectedTab: EmbedTabs diff --git a/packages/hoppscotch-common/src/components/share/index.vue b/packages/hoppscotch-common/src/components/share/index.vue index 34fc95967..164318473 100644 --- a/packages/hoppscotch-common/src/components/share/index.vue +++ b/packages/hoppscotch-common/src/components/share/index.vue @@ -173,6 +173,11 @@ const embedOptions = ref({ label: t("tab.authorization"), enabled: false, }, + { + value: "requestVariables", + label: t("tab.variables"), + enabled: false, + }, ], theme: "system", }) @@ -223,7 +228,12 @@ const currentUser = useReadonlyStream( const step = ref(1) -type EmbedTabs = "params" | "bodyParams" | "headers" | "authorization" +type EmbedTabs = + | "params" + | "bodyParams" + | "headers" + | "authorization" + | "requestVariables" type EmbedOption = { selectedTab: EmbedTabs @@ -369,6 +379,11 @@ const displayCustomizeRequestModal = ( label: t("tab.authorization"), enabled: false, }, + { + value: "requestVariables", + label: t("tab.variables"), + enabled: false, + }, ], theme: "system", } diff --git a/packages/hoppscotch-common/src/components/share/templates/Embeds.vue b/packages/hoppscotch-common/src/components/share/templates/Embeds.vue index dfdb6b31c..b2ce645fa 100644 --- a/packages/hoppscotch-common/src/components/share/templates/Embeds.vue +++ b/packages/hoppscotch-common/src/components/share/templates/Embeds.vue @@ -28,7 +28,7 @@
{ if (x.secret) { return { key: x.key, - sourceEnv: "source" in x ? x.source : null, + sourceEnv: "sourceEnv" in x ? x.sourceEnv : null, value: "********", secret: true, } @@ -379,7 +376,7 @@ const envVars = computed(() => { return { key: x.key, value: x.value, - sourceEnv: "source" in x ? x.source : null, + sourceEnv: "sourceEnv" in x ? x.sourceEnv : null, secret: false, } })