Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

feat: indicate global variable

liyasthomasafc109965a66
diff --git a/packages/hoppscotch-app/components/http/TestResult.vue b/packages/hoppscotch-app/components/http/TestResult.vue
index 52c6c567c..e03535d28 100644
--- a/packages/hoppscotch-app/components/http/TestResult.vue
+++ b/packages/hoppscotch-app/components/http/TestResult.vue
@@ -59,6 +59,20 @@
</p>
</div>
</div>
+ <HttpTestResultEnv
+ v-for="(env, index) in testResults.envDiff.global.additions"
+ :key="`env-${env.key}-${index}`"
+ :env="env"
+ status="additions"
+ global
+ />
+ <HttpTestResultEnv
+ v-for="(env, index) in testResults.envDiff.global.updations"
+ :key="`env-${env.key}-${index}`"
+ :env="env"
+ status="updations"
+ global
+ />
<HttpTestResultEnv
v-for="(env, index) in testResults.envDiff.selected.additions"
:key="`env-${env.key}-${index}`"
diff --git a/packages/hoppscotch-app/components/http/TestResultEnv.vue b/packages/hoppscotch-app/components/http/TestResultEnv.vue
index 2b3069c0a..85920e9d8 100644
--- a/packages/hoppscotch-app/components/http/TestResultEnv.vue
+++ b/packages/hoppscotch-app/components/http/TestResultEnv.vue
@@ -1,21 +1,29 @@
<template>
- <div class="flex items-center px-4 py-2">
- <i
- v-tippy="{ theme: 'tooltip' }"
- class="mr-4 material-icons cursor-help"
- :class="getStyle(status)"
- :title="`${t(getTooltip(status))}`"
+ <div class="flex items-center justify-between px-4 py-2">
+ <div class="flex items-center">
+ <i
+ v-tippy="{ theme: 'tooltip' }"
+ class="mr-4 material-icons cursor-help"
+ :class="getStyle(status)"
+ :title="`${t(getTooltip(status))}`"
+ >
+ {{ getIcon(status) }}
+ </i>
+ <span class="text-secondaryDark">
+ {{ env.key }}
+ </span>
+ <span class="text-secondaryDark">
+ {{ ` \xA0 — \xA0 ${env.value}` }}
+ </span>
+ <span v-if="status === 'updations'" class="text-secondaryLight">
+ {{ ` \xA0 ← \xA0 ${env.previousValue}` }}
+ </span>
+ </div>
+ <span
+ v-if="global"
+ class="bg-accentLight px-1 rounded text-accentContrast text-tiny"
>
- {{ getIcon(status) }}
- </i>
- <span class="text-secondaryDark">
- {{ env.key }}
- </span>
- <span class="text-secondaryDark">
- {{ ` \xA0 — \xA0 ${env.value}` }}
- </span>
- <span v-if="status === 'updations'" class="text-secondaryLight">
- {{ ` \xA0 ← \xA0 ${env.previousValue}` }}
+ Global
</span>
</div>
</template>
@@ -31,9 +39,12 @@ type Props = {
previousValue?: string
}
status: Status
+ global: boolean
}
-defineProps<Props>()
+withDefaults(defineProps<Props>(), {
+ global: false,
+})
const t = useI18n()
diff --git a/packages/hoppscotch-app/components/lenses/ResponseBodyRenderer.vue b/packages/hoppscotch-app/components/lenses/ResponseBodyRenderer.vue
index 2c0406032..693e18c57 100644
--- a/packages/hoppscotch-app/components/lenses/ResponseBodyRenderer.vue
+++ b/packages/hoppscotch-app/components/lenses/ResponseBodyRenderer.vue
@@ -24,7 +24,11 @@
:label="$t('test.results')"
:indicator="
testResults &&
- (testResults.expectResults.length || testResults.tests.length)
+ (testResults.expectResults.length ||
+ testResults.tests.length ||
+ testResults.envDiff.selected.additions.length ||
+ testResults.envDiff.selected.updations.length ||
+ testResults.envDiff.global.updations.length)
? true
: false
"