Skip to content

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

chore: tweak overview section (#16941)

boojack79405e33c680
diff --git a/frontend/src/components/Plan/components/IssueReviewView/ActivitySection/ActivitySection.vue b/frontend/src/components/Plan/components/IssueReviewView/ActivitySection/ActivitySection.vue
index d136ed874f..de0495e37f 100644
--- a/frontend/src/components/Plan/components/IssueReviewView/ActivitySection/ActivitySection.vue
+++ b/frontend/src/components/Plan/components/IssueReviewView/ActivitySection/ActivitySection.vue
@@ -1,5 +1,5 @@
<template>
- <div class="space-y-4">
+ <div class="space-y-4 py-4">
<div class="flex items-center justify-between">
<h3 class="text-base font-medium">
{{ $t("common.activity") }}
diff --git a/frontend/src/components/Plan/components/IssueReviewView/IssueReviewView.vue b/frontend/src/components/Plan/components/IssueReviewView/IssueReviewView.vue
index 73f8a97e11..649b431e80 100644
--- a/frontend/src/components/Plan/components/IssueReviewView/IssueReviewView.vue
+++ b/frontend/src/components/Plan/components/IssueReviewView/IssueReviewView.vue
@@ -1,8 +1,8 @@
<template>
<div class="flex-1 flex w-full">
<!-- Left Panel - Activity -->
- <div class="flex-1 shrink px-4">
- <OverviewSection />
+ <div class="flex-1 shrink px-4 divide-y">
+ <OverviewSection v-if="shouldShowOverview" />
<ActivitySection />
</div>
@@ -17,7 +17,7 @@ import { computed, unref } from "vue";
import { provideIssueContext, useBaseIssueContext } from "@/components/IssueV1";
import { extractUserId, useCurrentProjectV1, useCurrentUserV1 } from "@/store";
import type { ComposedIssue } from "@/types";
-import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
+import { Issue_Type, IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
import { hasProjectPermissionV2 } from "@/utils";
import { usePlanContextWithIssue } from "../..";
import { ActivitySection } from "./ActivitySection";
@@ -48,6 +48,10 @@ const allowChange = computed(() => {
);
});
+const shouldShowOverview = computed(() => {
+ return issue.value.type === Issue_Type.DATABASE_CHANGE || rollout?.value;
+});
+
// TODO(steven): remove ComposedIssue.
const composedIssue = computed(() => {
const composedIssue = issue.value as ComposedIssue;
diff --git a/frontend/src/components/Plan/components/IssueReviewView/OverviewSection.vue b/frontend/src/components/Plan/components/IssueReviewView/OverviewSection.vue
index 3e17851f1e..a804003784 100644
--- a/frontend/src/components/Plan/components/IssueReviewView/OverviewSection.vue
+++ b/frontend/src/components/Plan/components/IssueReviewView/OverviewSection.vue
@@ -1,96 +1,101 @@
<template>
<div class="w-full py-4 overflow-y-auto">
- <!-- Statistics Cards -->
- <div :class="'grid grid-cols-1 sm:grid-cols-3 gap-4'">
- <!-- Plan Statistics Column -->
- <!-- Specs Card -->
- <div class="bg-white rounded-md border px-3 py-2">
- <div class="flex items-center justify-between">
- <div>
- <p class="textlabel">
- {{ $t("plan.overview.total-changes") }}
- </p>
- <p class="text-xl font-medium mt-1">
- {{ statistics.totalSpecs }}
- </p>
- </div>
- <LayersIcon class="w-8 h-8 text-control-light" stroke-width="1" />
+ <div class="grid grid-cols-[auto_1fr] gap-y-4 gap-x-8">
+ <!-- SQL Checks -->
+ <h3 class="text-base text-control">
+ {{ $t("plan.navigator.checks") }}
+ </h3>
+ <div class="flex items-center gap-4">
+ <div
+ v-if="getChecksCount(PlanCheckRun_Result_Status.ERROR) > 0"
+ class="flex items-center gap-1 cursor-pointer text-error"
+ @click="selectedResultStatus = PlanCheckRun_Result_Status.ERROR"
+ >
+ <XCircleIcon class="w-5 h-5" />
+ <span>
+ {{ $t("common.error") }}
+ </span>
+ <span class="font-semibold">
+ {{ getChecksCount(PlanCheckRun_Result_Status.ERROR) }}
+ </span>
</div>
- </div>
-
- <!-- Targets Card -->
- <div class="bg-white rounded-md border px-3 py-2">
- <div class="flex items-center justify-between">
- <div>
- <p class="textlabel">
- {{ $t("plan.overview.total-targets") }}
- </p>
- <p class="text-xl font-medium mt-1">
- {{ statistics.totalTargets }}
- </p>
- </div>
- <DatabaseIcon class="w-8 h-8 text-control-light" stroke-width="1" />
+ <div
+ v-if="getChecksCount(PlanCheckRun_Result_Status.WARNING) > 0"
+ class="flex items-center gap-1 cursor-pointer text-warning"
+ @click="selectedResultStatus = PlanCheckRun_Result_Status.WARNING"
+ >
+ <AlertCircleIcon class="w-5 h-5" />
+ <span>
+ {{ $t("common.warning") }}
+ </span>
+ <span class="font-semibold">
+ {{ getChecksCount(PlanCheckRun_Result_Status.WARNING) }}
+ </span>
+ </div>
+ <div
+ v-if="getChecksCount(PlanCheckRun_Result_Status.SUCCESS) > 0"
+ class="flex items-center gap-1 cursor-pointer text-success"
+ @click="selectedResultStatus = PlanCheckRun_Result_Status.SUCCESS"
+ >
+ <CheckCircleIcon class="w-5 h-5" />
+ <span>
+ {{ $t("common.success") }}
+ </span>
+ <span class="font-semibold">
+ {{ getChecksCount(PlanCheckRun_Result_Status.SUCCESS) }}
+ </span>
</div>
+ <span
+ v-if="
+ getChecksCount(PlanCheckRun_Result_Status.ERROR) +
+ getChecksCount(PlanCheckRun_Result_Status.WARNING) +
+ getChecksCount(PlanCheckRun_Result_Status.SUCCESS) ===
+ 0
+ "
+ class="text-sm text-control"
+ >
+ {{ $t("plan.overview.no-checks") }}
+ </span>
</div>
- <!-- Checks Card -->
- <div class="bg-white rounded-md border px-3 py-2">
- <div class="flex items-center justify-between">
- <div>
- <p class="textlabel">
- {{ $t("plan.navigator.checks") }}
- </p>
- <div class="flex items-center gap-3 mt-1">
- <button
- v-if="getChecksCount(PlanCheckRun_Result_Status.ERROR) > 0"
- class="flex items-center gap-1 hover:opacity-80"
- @click="selectedResultStatus = PlanCheckRun_Result_Status.ERROR"
- >
- <XCircleIcon class="w-5 h-5 text-error" />
- <span class="text-xl font-medium text-error">{{
- getChecksCount(PlanCheckRun_Result_Status.ERROR)
- }}</span>
- </button>
- <button
- v-if="getChecksCount(PlanCheckRun_Result_Status.WARNING) > 0"
- class="flex items-center gap-1 hover:opacity-80"
- @click="
- selectedResultStatus = PlanCheckRun_Result_Status.WARNING
- "
- >
- <AlertCircleIcon class="w-5 h-5 text-warning" />
- <span class="text-xl font-medium text-warning">{{
- getChecksCount(PlanCheckRun_Result_Status.WARNING)
- }}</span>
- </button>
- <button
- v-if="getChecksCount(PlanCheckRun_Result_Status.SUCCESS) > 0"
- class="flex items-center gap-1 hover:opacity-80"
- @click="
- selectedResultStatus = PlanCheckRun_Result_Status.SUCCESS
- "
+ <!-- Stages -->
+ <template v-if="rollout">
+ <h3 class="text-base text-control">
+ {{ $t("rollout.stage.self", 2) }}
+ </h3>
+ <div class="flex items-center gap-1 flex-wrap">
+ <template v-if="rollout.stages.length > 0">
+ <div
+ v-for="(stage, index) in rollout.stages"
+ :key="stage.name"
+ class="flex items-center gap-1"
+ >
+ <div
+ class="flex items-center gap-1 cursor-pointer hover:opacity-80 transition-opacity"
+ @click="navigateToStage(stage.name)"
>
- <CheckCircleIcon class="w-5 h-5 text-success" />
- <span class="text-xl font-medium text-success">{{
- getChecksCount(PlanCheckRun_Result_Status.SUCCESS)
- }}</span>
- </button>
+ <TaskStatus
+ :status="getStageStatus(stage)"
+ size="small"
+ disabled
+ />
+ <span class="font-medium text-gray-700 whitespace-nowrap">
+ {{ getEnvironmentTitle(stage.environment) }}
+ </span>
+ </div>
<span
- v-if="
- getChecksCount(PlanCheckRun_Result_Status.ERROR) +
- getChecksCount(PlanCheckRun_Result_Status.WARNING) +
- getChecksCount(PlanCheckRun_Result_Status.SUCCESS) ===
- 0
- "
- class="text-xl text-control"
+ v-if="index < rollout.stages.length - 1"
+ class="text-gray-400 text-sm mx-2"
>
- {{ $t("plan.overview.no-checks") }}
+ →
</span>
</div>
- </div>
- <ActivityIcon class="w-8 h-8 text-control-light" stroke-width="1" />
+ </template>
+ <span v-else class="text-sm text-control">
+ {{ $t("common.no-data") }}
+ </span>
</div>
- </div>
+ </template>
</div>
</div>
@@ -102,124 +107,52 @@
</template>
<script setup lang="ts">
-import {
- LayersIcon,
- DatabaseIcon,
- ActivityIcon,
- CheckCircleIcon,
- AlertCircleIcon,
- XCircleIcon,
-} from "lucide-vue-next";
-import { computed, ref, watch } from "vue";
-import { useInstanceV1Store, useDBGroupStore } from "@/store";
-import type { ComposedDatabaseGroup, ComposedInstance } from "@/types";
+import { CheckCircleIcon, AlertCircleIcon, XCircleIcon } from "lucide-vue-next";
+import { ref } from "vue";
+import { useRouter } from "vue-router";
+import TaskStatus from "@/components/Rollout/kits/TaskStatus.vue";
+import { PROJECT_V1_ROUTE_ROLLOUT_DETAIL_STAGE_DETAIL } from "@/router/dashboard/projectV1";
+import { useCurrentProjectV1, useEnvironmentV1Store } from "@/store";
import { PlanCheckRun_Result_Status } from "@/types/proto-es/v1/plan_service_pb";
-import { extractDatabaseResourceName } from "@/utils";
-import { targetsForSpec, usePlanContext } from "../../logic";
+import { extractProjectResourceName, getStageStatus } from "@/utils";
+import { usePlanContext } from "../../logic";
import ChecksDrawer from "../ChecksView/ChecksDrawer.vue";
-const { plan } = usePlanContext();
-const instanceStore = useInstanceV1Store();
-const dbGroupStore = useDBGroupStore();
+const { plan, rollout } = usePlanContext();
+const environmentStore = useEnvironmentV1Store();
+const router = useRouter();
+const { project } = useCurrentProjectV1();
const selectedResultStatus = ref<PlanCheckRun_Result_Status | undefined>(
undefined
);
-// Calculate statistics
-const statistics = computed(() => {
- let totalTargets = 0;
- for (const spec of plan.value.specs) {
- totalTargets += targetsForSpec(spec).length;
- }
- return {
- totalSpecs: plan.value.specs.length,
- totalTargets,
- };
-});
-
-// Get affected resources
-const affectedResources = computed(() => {
- const specs = plan.value?.specs || [];
- const resourceList: Array<
- | {
- type: "instance";
- name: string;
- instance: ComposedInstance;
- databases: string[];
- }
- | {
- type: "databaseGroup";
- name: string;
- databaseGroup?: ComposedDatabaseGroup;
- databases: string[];
- }
- > = [];
-
- const instanceMap = new Map<string, Set<string>>();
- const dbGroupSet = new Set<string>();
-
- for (const spec of specs) {
- const targets = targetsForSpec(spec);
- for (const target of targets) {
- // Check if it's a database group
- if (target.includes("/databaseGroups/")) {
- dbGroupSet.add(target);
- } else {
- // Parse instance/database format
- const { instance, databaseName } = extractDatabaseResourceName(target);
- if (instance && databaseName) {
- if (!instanceMap.has(instance)) {
- instanceMap.set(instance, new Set());
- }
- instanceMap.get(instance)!.add(databaseName);
- }
- }
- }
- }
-
- // Add instances to resource list
- for (const [instanceName, databases] of instanceMap.entries()) {
- const instance = instanceStore.getInstanceByName(instanceName);
- resourceList.push({
- type: "instance",
- name: instanceName,
- instance: instance,
- databases: Array.from(databases),
- });
- }
-
- // Add database groups to resource list
- for (const dbGroupName of dbGroupSet) {
- const dbGroup = dbGroupStore.getDBGroupByName(dbGroupName);
- resourceList.push({
- type: "databaseGroup",
- name: dbGroupName,
- databaseGroup: dbGroup,
- databases: dbGroup?.matchedDatabases.map((db) => db.name) || [],
- });
- }
-
- return resourceList;
-});
-
const getChecksCount = (status: PlanCheckRun_Result_Status) => {
return (
plan.value.planCheckRunStatusCount[PlanCheckRun_Result_Status[status]] || 0
);
};
-watch(
- () => affectedResources.value,
- () => {
- for (const resource of affectedResources.value) {
- if (resource.type === "instance") {
- instanceStore.getOrFetchInstanceByName(resource.name);
- } else if (resource.type === "databaseGroup") {
- dbGroupStore.getOrFetchDBGroupByName(resource.name);
- }
- }
- },
- { immediate: true }
-);
+const getEnvironmentTitle = (environmentName: string) => {
+ const environment = environmentStore.getEnvironmentByName(environmentName);
+ return environment.title || environmentName;
+};
+
+const navigateToStage = (stageName: string) => {
+ if (!rollout?.value) return;
+
+ const rolloutId = rollout.value.name.split("/").pop();
+ const stageId = stageName.split("/").pop();
+
+ if (!rolloutId || !stageId) return;
+
+ router.push({
+ name: PROJECT_V1_ROUTE_ROLLOUT_DETAIL_STAGE_DETAIL,
+ params: {
+ projectId: extractProjectResourceName(project.value.name),
+ rolloutId,
+ stageId,
+ },
+ });
+};
</script>
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 043ecec461..b84c9090b6 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -1081,8 +1081,6 @@
"select-targets": "Select Targets",
"ready-for-review": "Ready for Review",
"overview": {
- "total-changes": "Total Changes",
- "total-targets": "Total Targets",
"no-checks": "No checks"
},
"navigator": {
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index e0dfcfbe37..ca3e60f9bd 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -1081,8 +1081,6 @@
"select-targets": "Seleccionar objetivos",
"ready-for-review": "Listo para revisión",
"overview": {
- "total-changes": "Cambios totales",
- "total-targets": "Objetivos totales",
"no-checks": "Sin controles"
},
"navigator": {
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index b8a85c742a..2999ef9a25 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -1081,8 +1081,6 @@
"select-targets": "ターゲットを選択",
"ready-for-review": "レビュー準備完了",
"overview": {
- "total-changes": "合計変更数",
- "total-targets": "合計ターゲット",
"no-checks": "チェックなし"
},
"navigator": {
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index 14576dbc83..46a90d6dcd 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -1081,8 +1081,6 @@
"select-targets": "Chọn mục tiêu",
"ready-for-review": "Sẵn sàng để xem xét",
"overview": {
- "total-changes": "Tổng số thay đổi",
- "total-targets": "Tổng số mục tiêu",
"no-checks": "Không kiểm tra"
},
"navigator": {
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index afd25f9857..6e09f2eec8 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -1081,8 +1081,6 @@
"select-targets": "选择变更对象",
"ready-for-review": "提交审批",
"overview": {
- "total-changes": "变更项",
- "total-targets": "变更对象",
"no-checks": "没有检查"
},
"navigator": {