Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: use environment name component (#17171)

ecmadao90c08d35285f
diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/StageName.vue b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/StageName.vue
index 8f964f9da9..5af10d096c 100644
--- a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/StageName.vue
+++ b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/StageName.vue
@@ -1,21 +1,20 @@
<template>
<span class="font-medium text-main">
- {{ environment.title }}
+ <EnvironmentV1Name
+ :link="false"
+ :environment="environmentStore.getEnvironmentByName(stage.environment)"
+ />
</span>
</template>
<script lang="ts" setup>
-import { computed } from "vue";
+import { EnvironmentV1Name } from "@/components/v2";
import { useEnvironmentV1Store } from "@/store";
import type { Stage } from "@/types/proto-es/v1/rollout_service_pb";
-const props = defineProps<{
+defineProps<{
stage: Stage;
}>();
const environmentStore = useEnvironmentV1Store();
-
-const environment = computed(() =>
- environmentStore.getEnvironmentByName(props.stage.environment)
-);
</script>
diff --git a/frontend/src/components/Plan/components/RolloutView/StageView.vue b/frontend/src/components/Plan/components/RolloutView/StageView.vue
index 3504ebc96b..4c7b414af5 100644
--- a/frontend/src/components/Plan/components/RolloutView/StageView.vue
+++ b/frontend/src/components/Plan/components/RolloutView/StageView.vue
@@ -3,7 +3,13 @@
<div class="px-4">
<div class="w-full flex flex-row pt-2 gap-2">
<NTag round>{{ $t("common.stage") }}</NTag>
- <span class="font-medium text-lg">{{ environmentTitle }}</span>
+ <span class="font-medium text-lg">
+ <EnvironmentV1Name
+ :environment="
+ environmentStore.getEnvironmentByName(stage.environment)
+ "
+ />
+ </span>
<TaskFilter
:rollout="rollout"
@@ -29,6 +35,7 @@
import { NTag } from "naive-ui";
import { computed, ref, watch } from "vue";
import { useRoute } from "vue-router";
+import { EnvironmentV1Name } from "@/components/v2";
import { useEnvironmentV1Store } from "@/store";
import type { Stage } from "@/types/proto-es/v1/rollout_service_pb";
import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
@@ -72,10 +79,4 @@ watch(
},
{ immediate: true }
);
-
-// Stage environment info
-const environmentTitle = computed(() => {
- if (!stage.value) return "";
- return environmentStore.getEnvironmentByName(stage.value.environment).title;
-});
</script>
diff --git a/frontend/src/components/Plan/components/common/DatabaseDisplay.vue b/frontend/src/components/Plan/components/common/DatabaseDisplay.vue
index 98d186bd7a..388451a658 100644
--- a/frontend/src/components/Plan/components/common/DatabaseDisplay.vue
+++ b/frontend/src/components/Plan/components/common/DatabaseDisplay.vue
@@ -6,8 +6,8 @@
:instance="instanceResource"
:size="props.size || 'small'"
/>
- <span v-if="showEnvironment && environment" class="text-gray-500 mr-1">
- ({{ environment.title }})
+ <span v-if="showEnvironment" class="text-gray-400 mr-1">
+ <EnvironmentV1Name :link="false" :environment="environment" />
</span>
<span class="truncate text-gray-600">
{{ instanceDisplayName }}
@@ -31,6 +31,7 @@
import { ChevronRightIcon, ExternalLinkIcon } from "lucide-vue-next";
import { computed } from "vue";
import { InstanceV1EngineIcon } from "@/components/v2";
+import { EnvironmentV1Name } from "@/components/v2";
import {
useDatabaseV1Store,
useEnvironmentV1Store,
@@ -87,11 +88,9 @@ const databaseDisplayName = computed(() => {
const environment = computed(() => {
const environmentName =
- databaseEntity.value.effectiveEnvironment ||
- instanceResource.value?.environment;
- if (!environmentName) {
- return undefined;
- }
+ databaseEntity.value.effectiveEnvironment ??
+ instanceResource.value?.environment ??
+ "";
return environmentStore.getEnvironmentByName(environmentName);
});
diff --git a/frontend/src/views/project/RolloutDetailLayout.vue b/frontend/src/views/project/RolloutDetailLayout.vue
index 03cca3e09c..4054081ac3 100644
--- a/frontend/src/views/project/RolloutDetailLayout.vue
+++ b/frontend/src/views/project/RolloutDetailLayout.vue
@@ -11,7 +11,14 @@
>
</NBreadcrumbItem>
<NBreadcrumbItem v-if="stageId" @click="navigateToStage">
- {{ stageTitle }}
+ <EnvironmentV1Name
+ v-if="stage"
+ :environment="
+ environmentStore.getEnvironmentByName(stage.environment)
+ "
+ :link="false"
+ />
+ <span v-else>{{ stageId }}</span>
</NBreadcrumbItem>
<NBreadcrumbItem v-if="taskId" :clickable="false">
{{ $t("common.task") }} #{{ taskId }}
@@ -31,6 +38,7 @@ import { computed } from "vue";
import { useRoute, useRouter } from "vue-router";
import { usePlanContextWithRollout } from "@/components/Plan";
import { provideRolloutViewContext } from "@/components/Plan/components/RolloutView/context";
+import { EnvironmentV1Name } from "@/components/v2";
import {
PROJECT_V1_ROUTE_ROLLOUT_DETAIL,
PROJECT_V1_ROUTE_ROLLOUT_DETAIL_STAGE_DETAIL,
@@ -49,25 +57,9 @@ const { mergedStages } = provideRolloutViewContext();
const rolloutId = computed(() => route.params.rolloutId as string);
const stageId = computed(() => route.params.stageId as string);
const taskId = computed(() => route.params.taskId as string);
-
-// Get stage title from environment
-const stageTitle = computed(() => {
- if (!stageId.value) return "";
-
- // Find the stage in merged stages
- const stage = mergedStages.value.find((s) =>
- s.name.endsWith(`/${stageId.value}`)
- );
-
- if (stage) {
- const environment = environmentStore.getEnvironmentByName(
- stage.environment
- );
- return environment.title;
- }
-
- return stageId.value;
-});
+const stage = computed(() =>
+ mergedStages.value.find((s) => s.name.endsWith(`/${stageId.value}`))
+);
// Navigation handlers
const navigateToRollout = () => {