feat: alert when no environment selected
This commit is contained in:
@@ -34,36 +34,41 @@
|
|||||||
</span>
|
</span>
|
||||||
</summary>
|
</summary>
|
||||||
<div class="divide-y divide-dividerLight">
|
<div class="divide-y divide-dividerLight">
|
||||||
|
<div
|
||||||
|
v-if="noEnvSelected"
|
||||||
|
class="flex bg-error p-4 text-secondaryDark"
|
||||||
|
>
|
||||||
|
<i class="mr-4 material-icons"> warning </i>
|
||||||
|
<div class="flex flex-col">
|
||||||
|
<p>
|
||||||
|
{{ t("environment.no_environment_description") }}
|
||||||
|
</p>
|
||||||
|
<p class="space-x-2 flex mt-3">
|
||||||
|
<ButtonSecondary
|
||||||
|
:label="t('environment.add_to_global')"
|
||||||
|
class="text-tiny !bg-primary"
|
||||||
|
filled
|
||||||
|
/>
|
||||||
|
<ButtonSecondary
|
||||||
|
:label="t('environment.create_new')"
|
||||||
|
class="text-tiny !bg-primary"
|
||||||
|
filled
|
||||||
|
/>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<HttpTestResultEnv
|
<HttpTestResultEnv
|
||||||
v-for="(env, index) in testResults.envDiff.global.updations"
|
v-for="(env, index) in testResults.envDiff.selected.additions"
|
||||||
:key="`env-${env.key}-${index}`"
|
|
||||||
:env="env"
|
|
||||||
status="updations"
|
|
||||||
/>
|
|
||||||
<HttpTestResultEnv
|
|
||||||
v-for="(env, index) in testResults.envDiff.global.additions"
|
|
||||||
:key="`env-${env.key}-${index}`"
|
:key="`env-${env.key}-${index}`"
|
||||||
:env="env"
|
:env="env"
|
||||||
status="additions"
|
status="additions"
|
||||||
/>
|
/>
|
||||||
<HttpTestResultEnv
|
|
||||||
v-for="(env, index) in testResults.envDiff.global.deletions"
|
|
||||||
:key="`env-${env.key}-${index}`"
|
|
||||||
:env="env"
|
|
||||||
status="deletions"
|
|
||||||
/>
|
|
||||||
<HttpTestResultEnv
|
<HttpTestResultEnv
|
||||||
v-for="(env, index) in testResults.envDiff.selected.updations"
|
v-for="(env, index) in testResults.envDiff.selected.updations"
|
||||||
:key="`env-${env.key}-${index}`"
|
:key="`env-${env.key}-${index}`"
|
||||||
:env="env"
|
:env="env"
|
||||||
status="updations"
|
status="updations"
|
||||||
/>
|
/>
|
||||||
<HttpTestResultEnv
|
|
||||||
v-for="(env, index) in testResults.envDiff.selected.additions"
|
|
||||||
:key="`env-${env.key}-${index}`"
|
|
||||||
:env="env"
|
|
||||||
status="additions"
|
|
||||||
/>
|
|
||||||
<HttpTestResultEnv
|
<HttpTestResultEnv
|
||||||
v-for="(env, index) in testResults.envDiff.selected.deletions"
|
v-for="(env, index) in testResults.envDiff.selected.deletions"
|
||||||
:key="`env-${env.key}-${index}`"
|
:key="`env-${env.key}-${index}`"
|
||||||
@@ -165,7 +170,15 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed } from "@nuxtjs/composition-api"
|
import { computed } from "@nuxtjs/composition-api"
|
||||||
import { useReadonlyStream, useI18n } from "~/helpers/utils/composables"
|
import {
|
||||||
|
useReadonlyStream,
|
||||||
|
useI18n,
|
||||||
|
useStream,
|
||||||
|
} from "~/helpers/utils/composables"
|
||||||
|
import {
|
||||||
|
selectedEnvIndex$,
|
||||||
|
setCurrentEnvironment,
|
||||||
|
} from "~/newstore/environments"
|
||||||
import { restTestResults$, setRESTTestResults } from "~/newstore/RESTSession"
|
import { restTestResults$, setRESTTestResults } from "~/newstore/RESTSession"
|
||||||
|
|
||||||
const t = useI18n()
|
const t = useI18n()
|
||||||
@@ -185,4 +198,12 @@ const haveEnvVariables = computed(() => {
|
|||||||
testResults.value.envDiff.selected.deletions.length
|
testResults.value.envDiff.selected.deletions.length
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const selectedEnvironmentIndex = useStream(
|
||||||
|
selectedEnvIndex$,
|
||||||
|
-1,
|
||||||
|
setCurrentEnvironment
|
||||||
|
)
|
||||||
|
|
||||||
|
const noEnvSelected = computed(() => selectedEnvironmentIndex.value === -1)
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex items-center px-4 py-2">
|
<div class="flex items-center px-4 py-2">
|
||||||
<i class="mr-4 material-icons" :class="getStyle(status)">
|
<i
|
||||||
|
v-tippy="{ theme: 'tooltip' }"
|
||||||
|
class="mr-4 material-icons cursor-help"
|
||||||
|
:class="getStyle(status)"
|
||||||
|
:title="`${t(getTooltip(status))}`"
|
||||||
|
>
|
||||||
{{ getIcon(status) }}
|
{{ getIcon(status) }}
|
||||||
</i>
|
</i>
|
||||||
<span class="text-secondaryDark">
|
<span class="text-secondaryDark">
|
||||||
@@ -16,6 +21,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { useI18n } from "~/helpers/utils/composables"
|
||||||
|
|
||||||
type Status = "updations" | "additions" | "deletions"
|
type Status = "updations" | "additions" | "deletions"
|
||||||
type Props = {
|
type Props = {
|
||||||
env: {
|
env: {
|
||||||
@@ -28,14 +35,16 @@ type Props = {
|
|||||||
|
|
||||||
defineProps<Props>()
|
defineProps<Props>()
|
||||||
|
|
||||||
|
const t = useI18n()
|
||||||
|
|
||||||
const getIcon = (status: Status) => {
|
const getIcon = (status: Status) => {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case "additions":
|
case "additions":
|
||||||
return "add_circle_outline"
|
return "add_circle"
|
||||||
case "updations":
|
case "updations":
|
||||||
return "check_circle_outline"
|
return "check_circle"
|
||||||
case "deletions":
|
case "deletions":
|
||||||
return "remove_circle_outline"
|
return "remove_circle"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,4 +58,15 @@ const getStyle = (status: Status) => {
|
|||||||
return "text-red-500"
|
return "text-red-500"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getTooltip = (status: Status) => {
|
||||||
|
switch (status) {
|
||||||
|
case "additions":
|
||||||
|
return "environment.added"
|
||||||
|
case "updations":
|
||||||
|
return "environment.updated"
|
||||||
|
case "deletions":
|
||||||
|
return "environment.deleted"
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -159,14 +159,19 @@
|
|||||||
"tests": "There are no tests for this request"
|
"tests": "There are no tests for this request"
|
||||||
},
|
},
|
||||||
"environment": {
|
"environment": {
|
||||||
|
"added": "Environment addition",
|
||||||
|
"add_to_global": "Add to Global",
|
||||||
"create_new": "Create new environment",
|
"create_new": "Create new environment",
|
||||||
|
"deleted": "Environment deletion",
|
||||||
"edit": "Edit Environment",
|
"edit": "Edit Environment",
|
||||||
"invalid_name": "Please provide a name for the environment",
|
"invalid_name": "Please provide a name for the environment",
|
||||||
"nested_overflow": "nested environment variables are limited to 10 levels",
|
"nested_overflow": "nested environment variables are limited to 10 levels",
|
||||||
"new": "New Environment",
|
"new": "New Environment",
|
||||||
"no_environment": "No environment",
|
"no_environment": "No environment",
|
||||||
|
"no_environment_description": "No environments were selected. Choose what to do with the following variables.",
|
||||||
"select": "Select environment",
|
"select": "Select environment",
|
||||||
"title": "Environments",
|
"title": "Environments",
|
||||||
|
"updated": "Environment updation",
|
||||||
"variable_list": "Variable List"
|
"variable_list": "Variable List"
|
||||||
},
|
},
|
||||||
"error": {
|
"error": {
|
||||||
@@ -468,7 +473,7 @@
|
|||||||
},
|
},
|
||||||
"state": {
|
"state": {
|
||||||
"bulk_mode": "Bulk edit",
|
"bulk_mode": "Bulk edit",
|
||||||
"bulk_mode_placeholder": "Entries are separated by newline\nKeys and values are separated by :\nPrepend # to any row you want to add but keep disabled",
|
"bulk_mode_placeholder": "Entries are separated by newline Keys and values are separated by : Prepend # to any row you want to add but keep disabled",
|
||||||
"cleared": "Cleared",
|
"cleared": "Cleared",
|
||||||
"connected": "Connected",
|
"connected": "Connected",
|
||||||
"connected_to": "Connected to {name}",
|
"connected_to": "Connected to {name}",
|
||||||
|
|||||||
Reference in New Issue
Block a user