Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
refactor: plan routes (#16484)
boojackba90c4530af1
diff --git a/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue b/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vueindex 25474d2b19..cd38151036 100644--- a/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue+++ b/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue@@ -104,7 +104,7 @@ import { FeatureModal } from "@/components/FeatureGuard";import { PagedDatabaseTable } from "@/components/v2/Model/DatabaseV1Table";import {PROJECT_V1_ROUTE_ISSUE_DETAIL,- PROJECT_V1_ROUTE_REVIEW_CENTER_DETAIL,+ PROJECT_V1_ROUTE_PLAN_DETAIL,} from "@/router/dashboard/projectV1";import { useDatabaseV1Store, useAppFeature } from "@/store";import {@@ -281,12 +281,12 @@ const generateMultiDb = async () => {router.push({name: state.planOnly- ? PROJECT_V1_ROUTE_REVIEW_CENTER_DETAIL+ ? PROJECT_V1_ROUTE_PLAN_DETAIL: PROJECT_V1_ROUTE_ISSUE_DETAIL,params: {projectId: extractProjectResourceName(project.name),issueSlug: "create",- planSlug: "create",+ planId: "create",},query,});diff --git a/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue b/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vueindex 93e68fd799..28764432e1 100644--- a/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue+++ b/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue@@ -135,7 +135,7 @@ import { ActionConfirmModal } from "@/components/SchemaEditorLite";import SQLUploadButton from "@/components/misc/SQLUploadButton.vue";import {PROJECT_V1_ROUTE_ISSUE_DETAIL,- PROJECT_V1_ROUTE_REVIEW_CENTER_DETAIL,+ PROJECT_V1_ROUTE_PLAN_DETAIL,} from "@/router/dashboard/projectV1";import {pushNotification,@@ -501,12 +501,12 @@ const handlePreviewIssue = async () => {const routeInfo = {name: state.planOnly- ? PROJECT_V1_ROUTE_REVIEW_CENTER_DETAIL+ ? PROJECT_V1_ROUTE_PLAN_DETAIL: PROJECT_V1_ROUTE_ISSUE_DETAIL,params: {projectId: extractProjectResourceName(project.value.name),issueSlug: "create",- planSlug: "create",+ planId: "create",},query,};diff --git a/frontend/src/components/Plan/PlanDetailPage.vue b/frontend/src/components/Plan/PlanDetailPage.vueindex fcb10f1791..d27e0ad017 100644--- a/frontend/src/components/Plan/PlanDetailPage.vue+++ b/frontend/src/components/Plan/PlanDetailPage.vue@@ -1,32 +1,146 @@<template>- <div ref="containerRef" class="h-full flex flex-col">- <div class="border-b">- <HeaderSection />- </div>- <div class="w-full flex-1 flex flex-row">- <Navigator />- <div- class="flex-1 flex flex-col hide-scrollbar divide-y overflow-x-hidden"+ <div class="h-full flex flex-col">+ <HeaderSection />+ <NTabs+ type="line"+ :value="tabKey"+ tab-class="first:ml-4"+ @update-value="handleTabChange"+ >+ <NTabPane+ v-for="tab in availableTabs"+ :key="tab"+ :name="tab"+ :tab="tabRender(tab)">- <Overview v-if="!selectedSpec" />- <SpecDetailView v-else :key="selectedSpec.id" />- </div>- </div>+ <Overview v-if="tab === TabKey.Overview" />+ <SpecsView v-else-if="tab === TabKey.Specifications" />+ <ChecksView v-else-if="tab === TabKey.Checks" />+ </NTabPane>++ <!-- Suffix slot for Specifications tab -->+ <template v-if="tabKey === TabKey.Specifications" #suffix>+ <div class="pr-4 flex flex-row justify-end items-center">+ <CurrentSpecSelector />+ </div>+ </template>+ </NTabs></div></template>-<script setup lang="ts">-import { ref } from "vue";+<script setup lang="tsx">+import { head } from "lodash-es";+import { NTabPane, NTabs } from "naive-ui";+import { computed } from "vue";+import { useI18n } from "vue-i18n";+import { useRoute, useRouter } from "vue-router";import {- HeaderSection,- Navigator,- Overview,- SpecDetailView,-} from "./components";+ PROJECT_V1_ROUTE_PLAN_DETAIL,+ PROJECT_V1_ROUTE_PLAN_DETAIL_CHECK_RUNS,+ PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,+ PROJECT_V1_ROUTE_PLAN_DETAIL_SPECS,+} from "@/router/dashboard/projectV1";+import { ChecksView, HeaderSection, Overview } from "./components";+import CurrentSpecSelector from "./components/CurrentSpecSelector.vue";+import SpecsView from "./components/SpecsView.vue";+import { useSpecsValidation } from "./components/common";+import { gotoSpec } from "./components/common/utils";import { usePlanContext, usePollPlan } from "./logic";-const { selectedSpec } = usePlanContext();-const containerRef = ref<HTMLElement>();+enum TabKey {+ Overview = "overview",+ Specifications = "specifications",+ Checks = "checks",+}++const { t } = useI18n();+const route = useRoute();+const router = useRouter();+const { isCreating, plan, planCheckRunList } = usePlanContext();+const { isSpecEmpty } = useSpecsValidation(plan.value.specs);++const tabKey = computed(() => {+ const routeName = route.name?.toString() as string;+ if (+ [+ PROJECT_V1_ROUTE_PLAN_DETAIL_SPECS,+ PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,+ ].includes(routeName)+ ) {+ return TabKey.Specifications;+ } else if ([PROJECT_V1_ROUTE_PLAN_DETAIL_CHECK_RUNS].includes(routeName)) {+ return TabKey.Checks;+ }+ return TabKey.Overview;+});++const availableTabs = computed<TabKey[]>(() => {+ const tabs: TabKey[] = [TabKey.Overview, TabKey.Specifications];+ if (!isCreating.value) {+ tabs.push(TabKey.Checks);+ }+ return tabs;+});++const tabRender = (tab: TabKey) => {+ switch (tab) {+ case TabKey.Overview:+ return t("common.overview");+ case TabKey.Specifications:+ return (+ <div>+ {t("plan.navigator.specifications")}+ {plan.value.specs.some(isSpecEmpty) && (+ <span+ class="text-error ml-0.5"+ title={t("plan.navigator.statement-empty")}+ >+ *+ </span>+ )}+ </div>+ );+ case TabKey.Checks:+ return (+ <div>+ {t("plan.navigator.checks")}+ {planCheckRunList.value.length > 0 && (+ <span>({planCheckRunList.value.length})</span>+ )}+ </div>+ );+ default:+ return "";+ }+};++const handleTabChange = (tab: TabKey) => {+ if (tab === TabKey.Overview) {+ router.push({+ name: PROJECT_V1_ROUTE_PLAN_DETAIL,+ params: route.params,+ query: route.query,+ });+ } else if (tab === TabKey.Specifications) {+ // Auto select the first spec when switching to Specifications tab.+ const spec = head(plan.value.specs);+ if (spec) {+ gotoSpec(router, spec.id);+ } else {+ router.push({+ name: PROJECT_V1_ROUTE_PLAN_DETAIL_SPECS,+ params: route.params,+ query: route.query,+ });+ }+ } else if (tab === TabKey.Checks) {+ router.push({+ name: PROJECT_V1_ROUTE_PLAN_DETAIL_CHECK_RUNS,+ params: route.params,+ query: route.query,+ });+ }+};usePollPlan();</script>diff --git a/frontend/src/components/Plan/components/ChecksView/ChecksView.vue b/frontend/src/components/Plan/components/ChecksView/ChecksView.vuenew file mode 100644index 0000000000..64ae1cdb44--- /dev/null+++ b/frontend/src/components/Plan/components/ChecksView/ChecksView.vue@@ -0,0 +1,371 @@+<template>+ <div class="h-full flex flex-col">+ <!-- Header with filters -->+ <div class="flex items-center justify-between px-4 py-3">+ <div class="flex items-center gap-4">+ <!-- Check result summary with icons -->+ <div class="flex items-center gap-3">+ <div+ v-if="statusCounts.success > 0"+ class="flex items-center gap-1 px-2 py-1 cursor-pointer"+ :class="+ selectedStatus &&+ selectedStatus === PlanCheckRun_Result_Status.SUCCESS &&+ 'bg-gray-100 rounded-lg'+ "+ @click="toggleSelectedStatus(PlanCheckRun_Result_Status.SUCCESS)"+ >+ <CheckCircleIcon class="w-6 h-6 text-success" />+ <span class="text-lg font-semibold text-success">{{+ statusCounts.success+ }}</span>+ </div>+ <div+ v-if="statusCounts.warning > 0"+ class="flex items-center gap-1 px-2 py-1 cursor-pointer"+ @click="toggleSelectedStatus(PlanCheckRun_Result_Status.WARNING)"+ >+ <AlertCircleIcon class="w-6 h-6 text-warning" />+ <span class="text-lg font-semibold text-success">{{+ statusCounts.warning+ }}</span>+ </div>+ <div+ v-if="statusCounts.error > 0"+ class="flex items-center gap-1 px-2 py-1 cursor-pointer"+ @click="toggleSelectedStatus(PlanCheckRun_Result_Status.ERROR)"+ >+ <XCircleIcon class="w-6 h-6 text-error" />+ <span class="text-lg font-semibold text-success">{{+ statusCounts.error+ }}</span>+ </div>+ </div>+ </div>+ </div>++ <!-- Results List -->+ <div class="flex-1 overflow-y-auto">+ <div v-if="isLoading" class="flex items-center justify-center py-12">+ <BBSpin />+ </div>++ <div+ v-else-if="filteredResults.length === 0"+ class="flex flex-col items-center justify-center py-12"+ >+ <CheckCircleIcon class="w-12 h-12 text-control-light opacity-50 mb-4" />+ <div class="text-lg font-medium text-control-light mb-2">+ {{+ hasFilters ? "No results match your filters" : "No check results"+ }}+ </div>+ <div class="text-sm text-control-lighter">+ {{+ hasFilters+ ? "Try adjusting your filters"+ : "Run checks to see results here"+ }}+ </div>+ </div>++ <div v-else class="divide-y">+ <!-- Group by check run -->+ <div+ v-for="checkRun in filteredCheckRuns"+ :key="checkRun.name"+ class="px-6 py-4"+ >+ <!-- Check Run Header -->+ <div class="flex items-start justify-between mb-3">+ <div class="flex items-center gap-3">+ <component+ :is="getCheckTypeIcon(checkRun.type)"+ class="w-5 h-5 text-control-light"+ />+ <div>+ <div class="text-sm font-medium">+ {{ getCheckTypeLabel(checkRun.type) }}+ </div>+ <div class="text-xs text-control-light">+ Target: {{ formatTarget(checkRun.target) }}+ </div>+ </div>+ </div>++ <div class="flex items-center gap-2">+ <NBadge+ :type="getStatusBadgeType(getCheckRunStatus(checkRun))"+ :value="getStatusLabel(getCheckRunStatus(checkRun))"+ />+ <span class="text-xs text-control-lighter">+ {{ formatTime(checkRun.createTime) }}+ </span>+ </div>+ </div>++ <!-- Results for this check run -->+ <div class="space-y-2 pl-8">+ <div+ v-for="(result, idx) in getFilteredResults(checkRun)"+ :key="idx"+ class="flex items-start gap-3 p-3 border rounded-lg bg-gray-50"+ >+ <component+ :is="getStatusIcon(result.status)"+ class="w-4 h-4 mt-0.5 flex-shrink-0"+ :class="getStatusColor(result.status)"+ />++ <div class="flex-1 min-w-0">+ <div class="text-sm font-medium text-main mb-1">+ {{ result.title }}+ </div>++ <div+ v-if="result.content"+ class="text-xs text-control-light mb-2"+ >+ {{ result.content }}+ </div>++ <div+ v-if="+ result.sqlReviewReport && result.sqlReviewReport.line > 0+ "+ class="text-xs text-control-lighter"+ >+ Line {{ result.sqlReviewReport.line }}, Column+ {{ result.sqlReviewReport.column }}+ </div>+ </div>+ </div>+ </div>+ </div>+ </div>+ </div>+ </div>+</template>++<script setup lang="ts">+import {+ CheckCircleIcon,+ AlertCircleIcon,+ XCircleIcon,+ FileCodeIcon,+ DatabaseIcon,+ ShieldIcon,+ SearchCodeIcon,+} from "lucide-vue-next";+import { NBadge } from "naive-ui";+import { computed, ref } from "vue";+import { useI18n } from "vue-i18n";+import { BBSpin } from "@/bbkit";+import {+ PlanCheckRun_Result_Status,+ PlanCheckRun_Type,+ type PlanCheckRun,+} from "@/types/proto/v1/plan_service";+import { extractDatabaseResourceName, humanizeTs } from "@/utils";+import { usePlanContext } from "../../logic/context";++const { t } = useI18n();+const { planCheckRunList } = usePlanContext();++const isLoading = ref(false);+const selectedStatus = ref<PlanCheckRun_Result_Status | undefined>(undefined);++const hasFilters = computed(() => {+ return selectedStatus.value !== undefined;+});++const filteredCheckRuns = computed(() => {+ return planCheckRunList.value.filter((checkRun) => {+ // Filter by status - check if any result matches the selected status+ if (selectedStatus.value !== undefined) {+ const hasMatchingResult = checkRun.results.some(+ (result) => result.status === selectedStatus.value+ );+ if (!hasMatchingResult) {+ return false;+ }+ }++ return true;+ });+});++const filteredResults = computed(() => {+ const results: Array<{ checkRun: PlanCheckRun; result: any }> = [];++ for (const checkRun of filteredCheckRuns.value) {+ for (const result of checkRun.results) {+ if (+ selectedStatus.value === undefined ||+ result.status === selectedStatus.value+ ) {+ results.push({ checkRun, result });+ }+ }+ }++ return results;+});++const statusCounts = computed(() => {+ const counts = {+ success: 0,+ warning: 0,+ error: 0,+ };++ for (const checkRun of planCheckRunList.value) {+ for (const result of checkRun.results) {+ switch (result.status) {+ case PlanCheckRun_Result_Status.SUCCESS:+ counts.success++;+ break;+ case PlanCheckRun_Result_Status.WARNING:+ counts.warning++;+ break;+ case PlanCheckRun_Result_Status.ERROR:+ counts.error++;+ break;+ }+ }+ }++ return counts;+});++const toggleSelectedStatus = (status: PlanCheckRun_Result_Status) => {+ if (selectedStatus.value === status) {+ selectedStatus.value = undefined; // Deselect if already selected+ } else {+ selectedStatus.value = status; // Select the new status+ }+};++const getFilteredResults = (checkRun: PlanCheckRun) => {+ return checkRun.results.filter((result) => {+ return (+ selectedStatus.value === undefined ||+ result.status === selectedStatus.value+ );+ });+};++const getCheckRunStatus = (+ checkRun: PlanCheckRun+): PlanCheckRun_Result_Status => {+ let hasError = false;+ let hasWarning = false;++ for (const result of checkRun.results) {+ if (result.status === PlanCheckRun_Result_Status.ERROR) {+ hasError = true;+ } else if (result.status === PlanCheckRun_Result_Status.WARNING) {+ hasWarning = true;+ }+ }++ if (hasError) return PlanCheckRun_Result_Status.ERROR;+ if (hasWarning) return PlanCheckRun_Result_Status.WARNING;+ return PlanCheckRun_Result_Status.SUCCESS;+};++const getCheckTypeIcon = (type: PlanCheckRun_Type) => {+ switch (type) {+ case PlanCheckRun_Type.DATABASE_STATEMENT_ADVISE:+ return SearchCodeIcon;+ case PlanCheckRun_Type.DATABASE_STATEMENT_SUMMARY_REPORT:+ return FileCodeIcon;+ case PlanCheckRun_Type.DATABASE_CONNECT:+ return DatabaseIcon;+ case PlanCheckRun_Type.DATABASE_GHOST_SYNC:+ return ShieldIcon;+ default:+ return FileCodeIcon;+ }+};++const getCheckTypeLabel = (type: PlanCheckRun_Type) => {+ switch (type) {+ case PlanCheckRun_Type.DATABASE_STATEMENT_ADVISE:+ return t("task.check-type.sql-review");+ case PlanCheckRun_Type.DATABASE_STATEMENT_SUMMARY_REPORT:+ return t("task.check-type.summary-report");+ case PlanCheckRun_Type.DATABASE_CONNECT:+ return t("task.check-type.connection");+ case PlanCheckRun_Type.DATABASE_GHOST_SYNC:+ return t("task.check-type.ghost-sync");+ default:+ return type.toString();+ }+};++const getStatusIcon = (status: PlanCheckRun_Result_Status) => {+ switch (status) {+ case PlanCheckRun_Result_Status.ERROR:+ return XCircleIcon;+ case PlanCheckRun_Result_Status.WARNING:+ return AlertCircleIcon;+ case PlanCheckRun_Result_Status.SUCCESS:+ return CheckCircleIcon;+ default:+ return CheckCircleIcon;+ }+};++const getStatusColor = (status: PlanCheckRun_Result_Status) => {+ switch (status) {+ case PlanCheckRun_Result_Status.ERROR:+ return "text-error";+ case PlanCheckRun_Result_Status.WARNING:+ return "text-warning";+ case PlanCheckRun_Result_Status.SUCCESS:+ return "text-success";+ default:+ return "text-control";+ }+};++const getStatusBadgeType = (status: PlanCheckRun_Result_Status) => {+ switch (status) {+ case PlanCheckRun_Result_Status.ERROR:+ return "error";+ case PlanCheckRun_Result_Status.WARNING:+ return "warning";+ case PlanCheckRun_Result_Status.SUCCESS:+ return "success";+ default:+ return "default";+ }+};++const getStatusLabel = (status: PlanCheckRun_Result_Status) => {+ switch (status) {+ case PlanCheckRun_Result_Status.ERROR:+ return "Error";+ case PlanCheckRun_Result_Status.WARNING:+ return "Warning";+ case PlanCheckRun_Result_Status.SUCCESS:+ return "Success";+ default:+ return "Unknown";+ }+};++const formatTarget = (target: string): string => {+ const { instanceName, databaseName } = extractDatabaseResourceName(target);+ if (instanceName && databaseName) {+ return `${databaseName} (${instanceName})`;+ }+ return target;+};++const formatTime = (timestamp: any): string => {+ if (!timestamp) return "";+ return humanizeTs(new Date(timestamp.seconds * 1000).getTime() / 1000);+};+</script>diff --git a/frontend/src/components/Plan/components/ChecksView/index.ts b/frontend/src/components/Plan/components/ChecksView/index.tsnew file mode 100644index 0000000000..9d5cc03838--- /dev/null+++ b/frontend/src/components/Plan/components/ChecksView/index.ts@@ -0,0 +1 @@+export { default as ChecksView } from "./ChecksView.vue";\ No newline at end of filediff --git a/frontend/src/components/Plan/components/Configuration/Configuration.vue b/frontend/src/components/Plan/components/Configuration/Configuration.vueindex dc22a8a9ed..030cdd4c34 100644--- a/frontend/src/components/Plan/components/Configuration/Configuration.vue+++ b/frontend/src/components/Plan/components/Configuration/Configuration.vue@@ -1,5 +1,5 @@<template>- <div v-if="shouldShow" class="flex flex-col gap-y-3 py-3 px-4">+ <div v-if="shouldShow" class="flex flex-col gap-y-3 px-4"><p class="text-base font-medium">{{ $t("plan.options.self") }}</p>@@ -14,7 +14,7 @@import { computed } from "vue";import { useCurrentProjectV1 } from "@/store";import { usePlanContext } from "../../logic";-import useSelectedSpec from "../common/useSelectedSpec";+import { usePlanSpecContext } from "../SpecDetailView/context";import GhostSection from "./GhostSection";import { provideGhostSettingContext } from "./GhostSection/context";import PreBackupSection from "./PreBackupSection";@@ -22,7 +22,7 @@ import { providePreBackupSettingContext } from "./PreBackupSection/context";const { project } = useCurrentProjectV1();const { isCreating, plan, events } = usePlanContext();-const selectedSpec = useSelectedSpec();+const { selectedSpec } = usePlanSpecContext();const { shouldShow: shouldShowGhostSection, events: ghostEvents } =provideGhostSettingContext({diff --git a/frontend/src/components/Plan/components/CurrentSpecSelector.vue b/frontend/src/components/Plan/components/CurrentSpecSelector.vuenew file mode 100644index 0000000000..27694743ce--- /dev/null+++ b/frontend/src/components/Plan/components/CurrentSpecSelector.vue@@ -0,0 +1,117 @@+<template>+ <div v-if="shouldShow" class="flex flex-row justify-start items-center">+ <NSelect+ size="small"+ :options="options"+ :value="selectedSpec.id"+ :render-label="labelRender"+ :consistent-menu-width="false"+ :bordered="false"+ @update-value="handleSpecChange"+ />+ <NButton+ v-if="isCreating"+ type="default"+ size="small"+ @click="showAddSpecDrawer = true"+ >+ <template #icon>+ <PlusIcon class="w-4 h-4" />+ </template>+ </NButton>+ </div>++ <!-- Add Spec Drawer -->+ <AddSpecDrawer+ v-model:show="showAddSpecDrawer"+ @created="handleSpecCreated"+ />+</template>++<script setup lang="tsx">+import { head } from "lodash-es";+import { PlusIcon } from "lucide-vue-next";+import { NButton, NSelect } from "naive-ui";+import { computed, ref } from "vue";+import { useI18n } from "vue-i18n";+import { useRoute, useRouter } from "vue-router";+import {+ Plan_ChangeDatabaseConfig_Type,+ type Plan_Spec,+} from "@/types/proto/v1/plan_service";+import { usePlanContext } from "../logic";+import AddSpecDrawer from "./AddSpecDrawer.vue";+import { gotoSpec } from "./common/utils";++const { t } = useI18n();+const route = useRoute();+const router = useRouter();+const { isCreating, plan } = usePlanContext();+const showAddSpecDrawer = ref(false);++const shouldShow = computed(() => {+ return isCreating.value || plan.value.specs.length > 1;+});++const specs = computed(() => plan.value.specs);++const options = computed(() => {+ return specs.value.map((spec) => {+ return {+ label: getSpecTypeName(spec),+ value: spec.id,+ };+ });+});++const labelRender = (option: { label: string; value: string }) => {+ const spec = specs.value.find((s) => s.id === option.value);+ if (!spec) {+ return option.label;+ }+ const index = specs.value.indexOf(spec) + 1;+ const suffix = specs.value.length > 1 ? ` #${index}` : "";+ return (+ <span>+ {option.label}+ {suffix && <span class="text-gray-500">{suffix}</span>}+ </span>+ );+};++const selectedSpec = computed(() => {+ return (specs.value.find((spec) => spec.id === route.params.specId) ||+ head(specs.value)) as Plan_Spec;+});++const getSpecTypeName = (spec: Plan_Spec): string => {+ if (spec.createDatabaseConfig) {+ return t("plan.spec.type.create-database");+ } else if (spec.changeDatabaseConfig) {+ const changeType = spec.changeDatabaseConfig.type;+ switch (changeType) {+ case Plan_ChangeDatabaseConfig_Type.MIGRATE:+ return t("plan.spec.type.schema-change");+ case Plan_ChangeDatabaseConfig_Type.DATA:+ return t("plan.spec.type.data-change");+ case Plan_ChangeDatabaseConfig_Type.MIGRATE_GHOST:+ return t("plan.spec.type.ghost-migration");+ default:+ return t("plan.spec.type.database-change");+ }+ } else if (spec.exportDataConfig) {+ return t("plan.spec.type.export-data");+ }+ return t("plan.spec.type.unknown");+};++const handleSpecChange = (specId: string) => {+ gotoSpec(router, specId);+};++const handleSpecCreated = async (spec: Plan_Spec) => {+ // Add the new spec to the plan+ plan.value.specs.push(spec);+ gotoSpec(router, spec.id);+};+</script>diff --git a/frontend/src/components/Plan/components/DescriptionSection.vue b/frontend/src/components/Plan/components/DescriptionSection.vueindex e8098165db..b8aa7534c2 100644--- a/frontend/src/components/Plan/components/DescriptionSection.vue+++ b/frontend/src/components/Plan/components/DescriptionSection.vue@@ -48,7 +48,7 @@/><divv-else- class="min-h-[4rem] max-h-[12rem] whitespace-pre-wrap px-[10px] py-[4.5px] border rounded"+ class="min-h-[4rem] max-h-[12rem] whitespace-pre-wrap px-[10px] py-[4.5px] border rounded-md"><template v-if="plan.description"><iframediff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateButton.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateButton.vueindex 2dfe404ff1..f207b7ffdd 100644--- a/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateButton.vue+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateButton.vue@@ -43,15 +43,15 @@ import {} from "@/components/Plan/logic";import { usePlanContext } from "@/components/Plan/logic";import { planServiceClient } from "@/grpcweb";-import { PROJECT_V1_ROUTE_REVIEW_CENTER_DETAIL } from "@/router/dashboard/projectV1";+import { PROJECT_V1_ROUTE_PLAN_DETAIL } from "@/router/dashboard/projectV1";import { useCurrentProjectV1, useSheetV1Store } from "@/store";import { type Plan_ChangeDatabaseConfig } from "@/types/proto/v1/plan_service";import type { Sheet } from "@/types/proto/v1/sheet_service";import {+ extractPlanUID,extractProjectResourceName,extractSheetUID,hasProjectPermissionV2,- planV1Slug,} from "@/utils";const { t } = useI18n();@@ -91,10 +91,10 @@ const doCreatePlan = async () => {nextTick(() => {router.push({- name: PROJECT_V1_ROUTE_REVIEW_CENTER_DETAIL,+ name: PROJECT_V1_ROUTE_PLAN_DETAIL,params: {projectId: extractProjectResourceName(createdPlan.name),- planSlug: planV1Slug(createdPlan),+ planId: extractPlanUID(createdPlan.name),},});});diff --git a/frontend/src/components/Plan/components/Navigator.vue b/frontend/src/components/Plan/components/Navigator.vuedeleted file mode 100644index 95cbcb0e4d..0000000000--- a/frontend/src/components/Plan/components/Navigator.vue+++ /dev/null@@ -1,284 +0,0 @@-<template>- <div class="w-60 flex flex-col border-r">- <!-- Navigator Content -->- <NScrollbar class="flex-1">- <div class="py-2">- <!-- Overview Tab -->- <div- class="mx-2 px-3 py-2 rounded-md cursor-pointer group transition-all"- :class="[- !selectedSpec- ? 'bg-accent bg-opacity-10 shadow-sm'- : 'hover:bg-gray-50',- ]"- @click="handleSelectOverview"- >- <div class="flex items-center gap-2">- <LayoutDashboardIcon- class="w-4 h-4 transition-colors"- :class="[- !selectedSpec- ? 'text-accent'- : 'text-control-light group-hover:text-main',- ]"- />- <span- class="text-sm font-medium transition-colors"- :class="[- !selectedSpec- ? 'text-accent'- : 'text-control group-hover:text-main',- ]"- >- {{ $t("plan.navigator.overview") }}- </span>- </div>- </div>-- <!-- Specs Section -->- <div class="px-4 pb-2 mt-3">- <div class="flex items-center justify-between">- <div class="flex items-center gap-2">- <span- class="text-xs font-medium uppercase tracking-wider text-control-light"- >- {{ $t("plan.navigator.specifications") }}- </span>- <NBadge- v-if="specs.length > 10"- type="info"- :value="specs.length"- :max="99"- />- </div>- <NButton- v-if="isCreating"- type="default"- size="tiny"- @click="handleAddSpec"- >- <template #icon>- <PlusIcon class="w-4 h-4" />- </template>- </NButton>- </div>- </div>-- <!-- Spec List -->- <div class="px-2 space-y-1">- <div- v-for="(spec, index) in specs"- :key="spec.id"- class="px-3 py-2 rounded-md cursor-pointer group transition-all"- :class="[- selectedSpec?.id === spec.id- ? 'bg-accent bg-opacity-10 shadow-sm'- : 'hover:bg-gray-50',- ]"- @click="handleSelectSpec(spec)"- >- <div class="flex items-start justify-between gap-2">- <div class="flex-1 min-w-0">- <div class="flex items-center gap-2">- <span- class="text-sm font-medium"- :class="[- selectedSpec?.id === spec.id- ? 'text-accent'- : 'text-control',- ]"- >- {{- $t("plan.navigator.spec-number", { number: index + 1 })- }}- <span- v-if="isSpecEmpty(spec)"- class="text-error ml-0.5"- :title="$t('plan.navigator.statement-empty')"- >- *- </span>- </span>- <SpecStatusBadge- v-if="getSpecCheckStatus(spec) !== 'STATUS_UNSPECIFIED'"- :status="getSpecCheckStatus(spec)"- />- </div>-- <div- class="flex flex-row items-center gap-1 mt-1 text-xs text-control-light"- >- <div class="truncate">- {{ getSpecTypeName(spec) }}- </div>- <span class="mx-0.5">·</span>- <div class="opacity-80">- {{ getTargetCountText(spec) }}- </div>- </div>- </div>-- <ChevronRightIcon- v-if="selectedSpec?.id === spec.id"- class="w-4 h-4 text-accent mt-0.5 flex-shrink-0"- />- </div>- </div>- </div>-- <div- v-if="specs.length === 0"- class="text-sm text-control-light text-center py-8 px-4"- >- {{ $t("plan.navigator.no-specifications") }}- </div>- </div>- </NScrollbar>-- <!-- Add Spec Drawer -->- <AddSpecDrawer- v-model:show="showAddSpecDrawer"- @created="handleSpecCreated"- />- </div>-</template>--<script setup lang="ts">-import {- LayoutDashboardIcon,- ChevronRightIcon,- PlusIcon,-} from "lucide-vue-next";-import { NButton, NScrollbar, NBadge } from "naive-ui";-import { computed, ref } from "vue";-import { useI18n } from "vue-i18n";-import { useRouter, useRoute } from "vue-router";-import {- Plan_ChangeDatabaseConfig_Type,- type Plan_Spec,- type PlanCheckRun,-} from "@/types/proto/v1/plan_service";-import { usePlanContext } from "../logic/context";-import { targetsForSpec } from "../logic/plan";-import AddSpecDrawer from "./AddSpecDrawer.vue";-import SpecStatusBadge from "./SpecStatusBadge.vue";-import { useSpecsValidation } from "./common/validateSpec";--const router = useRouter();-const route = useRoute();-const { t } = useI18n();-const { plan, selectedSpec, isCreating, events, planCheckRunList } =- usePlanContext();--const specs = computed(() => plan.value.specs);-const showAddSpecDrawer = ref(false);--// Use the validation hook for all specs-const { isSpecEmpty } = useSpecsValidation(specs.value);--const handleSelectOverview = () => {- // Clear spec selection to show overview- router.replace({- query: {- ...route.query,- spec: undefined,- target: undefined,- },- hash: route.hash,- });-};--const handleSelectSpec = (spec: Plan_Spec) => {- events.emit("select-spec", { spec });-};--const handleAddSpec = () => {- showAddSpecDrawer.value = true;-};--const handleSpecCreated = (spec: Plan_Spec) => {- // Add the new spec to the plan- if (!plan.value?.specs) {- plan.value.specs = [];- }- plan.value.specs.push(spec);-- // Select the newly created spec- events.emit("select-spec", { spec });-};--const getSpecCheckStatus = (spec: Plan_Spec) => {- // Get aggregated check status for the spec- const checkRuns = planCheckRunList.value || [];- const targets = targetsForSpec(spec);- const sheet = getSheetFromSpec(spec);-- if (!sheet || targets.length === 0) {- return "STATUS_UNSPECIFIED";- }-- const relevantCheckRuns = checkRuns.filter((check: PlanCheckRun) => {- return targets.includes(check.target) && check.sheet === sheet;- });-- if (relevantCheckRuns.length === 0) {- return "STATUS_UNSPECIFIED";- }-- // Find worst status- let hasError = false;- let hasWarning = false;-- for (const checkRun of relevantCheckRuns) {- for (const result of checkRun.results) {- if (result.status === "ERROR") {- hasError = true;- } else if (result.status === "WARNING") {- hasWarning = true;- }- }- }-- if (hasError) return "ERROR";- if (hasWarning) return "WARNING";- return "SUCCESS";-};--const getSheetFromSpec = (spec: Plan_Spec): string | undefined => {- if (spec.changeDatabaseConfig) {- return spec.changeDatabaseConfig.sheet;- } else if (spec.exportDataConfig) {- return spec.exportDataConfig.sheet;- }- return undefined;-};--const getSpecTypeName = (spec: Plan_Spec): string => {- if (spec.createDatabaseConfig) {- return t("plan.spec.type.create-database");- } else if (spec.changeDatabaseConfig) {- const changeType = spec.changeDatabaseConfig.type;- switch (changeType) {- case Plan_ChangeDatabaseConfig_Type.MIGRATE:- return t("plan.spec.type.schema-change");- case Plan_ChangeDatabaseConfig_Type.DATA:- return t("plan.spec.type.data-change");- case Plan_ChangeDatabaseConfig_Type.MIGRATE_GHOST:- return t("plan.spec.type.ghost-migration");- default:- return t("plan.spec.type.database-change");- }- } else if (spec.exportDataConfig) {- return t("plan.spec.type.export-data");- }- return t("plan.spec.type.unknown");-};--const getTargetCountText = (spec: Plan_Spec): string => {- const targets = targetsForSpec(spec);- if (targets.length === 0) return t("plan.targets.no-targets");- return targets.length === 1- ? t("plan.targets.one-target")- : t("plan.targets.multiple-targets", { count: targets.length });-};-</script>diff --git a/frontend/src/components/Plan/components/Overview.vue b/frontend/src/components/Plan/components/Overview.vueindex a2038de327..4c281d1f2c 100644--- a/frontend/src/components/Plan/components/Overview.vue+++ b/frontend/src/components/Plan/components/Overview.vue@@ -1,11 +1,11 @@<template>- <div class="w-full p-4 overflow-y-auto mt-4">- <div class="max-w-4xl mx-auto space-y-4">+ <div class="w-full px-4 overflow-y-auto">+ <div class="max-w-4xl mx-auto space-y-4 mt-4"><!-- Plan Header --><div>- <h1 class="text-2xl font-semibold mb-2">+ <h2 class="text-2xl font-semibold mb-2">{{ $t("plan.navigator.overview") }}- </h1>+ </h2><p class="text-control-light">{{ $t("plan.overview.description") }}</p>@@ -13,7 +13,7 @@<!-- Statistics Cards --><div class="grid grid-cols-1 md:grid-cols-3 gap-4">- <div class="bg-white rounded border px-3 py-2">+ <div class="bg-white rounded-md border px-3 py-2"><div class="flex items-center justify-between"><div><p class="text-sm text-control-light">@@ -27,7 +27,7 @@</div></div>- <div class="bg-white rounded border px-3 py-2">+ <div class="bg-white rounded-md border px-3 py-2"><div class="flex items-center justify-between"><div><p class="text-sm text-control-light">@@ -41,7 +41,7 @@</div></div>- <div class="bg-white rounded border px-3 py-2">+ <div class="bg-white rounded-md border px-3 py-2"><div class="flex items-center justify-between"><div><p class="text-sm text-control-light">@@ -97,7 +97,7 @@<divv-for="resource in affectedResources":key="resource.name"- class="flex items-start gap-3 p-3 rounded border"+ class="flex items-start gap-3 p-3 rounded-md border"><!-- Icon --><InstanceV1EngineIcon@@ -147,7 +147,7 @@{{ resource.databaseGroup?.title || resource.name }}</span><span- class="text-xs px-1.5 py-0.5 rounded bg-blue-100 text-blue-600"+ class="text-xs px-1.5 py-0.5 rounded-md bg-blue-100 text-blue-600">{{ t("plan.targets.database-group") }}</span>diff --git a/frontend/src/components/Plan/components/PlanCheckSection/PlanCheckSection.vue b/frontend/src/components/Plan/components/PlanCheckSection/PlanCheckSection.vueindex a9c957840c..7e6ad30525 100644--- a/frontend/src/components/Plan/components/PlanCheckSection/PlanCheckSection.vue+++ b/frontend/src/components/Plan/components/PlanCheckSection/PlanCheckSection.vue@@ -1,34 +1,261 @@<template>- <PlanCheckRunBar- v-if="show"- class="px-4 py-2"- :allow-run-checks="allowRunChecks"- :database="database"- :plan-name="plan.name"- :plan-check-run-list="planCheckRunList"- />+ <div v-if="show" class="px-4 pt-3 flex flex-col gap-y-1 overflow-hidden">+ <div class="flex items-center justify-between gap-2">+ <div class="flex items-center gap-1">+ <h3 class="text-base font-medium">Checks</h3>+ </div>++ <div class="flex items-center gap-2">+ <!-- Status Summary -->+ <div class="flex items-center gap-2 text-sm">+ <button+ v-if="summary.error > 0"+ class="flex items-center gap-1 hover:opacity-80"+ @click="openDrawer('ERROR')"+ >+ <XCircleIcon class="w-4 h-4 text-error" />+ <span class="text-error">{{ summary.error }}</span>+ </button>+ <button+ v-if="summary.warning > 0"+ class="flex items-center gap-1 hover:opacity-80"+ @click="openDrawer('WARNING')"+ >+ <AlertCircleIcon class="w-4 h-4 text-warning" />+ <span class="text-warning">{{ summary.warning }}</span>+ </button>+ <button+ v-if="summary.success > 0"+ class="flex items-center gap-1 hover:opacity-80"+ @click="openDrawer('SUCCESS')"+ >+ <CheckCircleIcon class="w-4 h-4 text-success" />+ <span class="text-success">{{ summary.success }}</span>+ </button>+ </div>++ <!-- Run Checks Button -->+ <NButton+ v-if="allowRunChecks"+ size="small"+ :loading="isRunningChecks"+ @click="runChecks"+ >+ <template #icon>+ <PlayIcon class="w-4 h-4" />+ </template>+ Run Checks+ </NButton>+ </div>+ </div>++ <div class="flex-1 overflow-y-auto">+ <!-- Loading State -->+ <div v-if="isLoading" class="flex items-center justify-center py-8">+ <BBSpin />+ </div>++ <!-- Check Results -->+ <div v-else-if="checkRunsForSpec.length > 0" class="flex flex-wrap gap-6">+ <!-- Group by Check Type -->+ <div+ v-for="(typeGroup, checkType) in groupedByType"+ :key="checkType"+ class="inline-flex items-center gap-2"+ @click="selectedCheckType = checkType"+ >+ <component+ :is="getCheckTypeIcon(checkType)"+ class="w-4 h-4 opacity-80"+ />+ <span class="text-sm">{{ getCheckTypeLabel(checkType) }}</span>++ <!-- Status indicators -->+ <div class="flex items-center gap-2">+ <div+ v-if="typeGroup.summary.error > 0"+ class="flex items-center gap-1"+ >+ <XCircleIcon class="w-3.5 h-3.5 text-error" />+ <span class="text-sm text-error">{{+ typeGroup.summary.error+ }}</span>+ </div>+ <div+ v-if="typeGroup.summary.warning > 0"+ class="flex items-center gap-1"+ >+ <AlertCircleIcon class="w-3.5 h-3.5 text-warning" />+ <span class="text-sm text-warning">{{+ typeGroup.summary.warning+ }}</span>+ </div>+ <div+ v-if="typeGroup.summary.success > 0"+ class="flex items-center gap-1"+ >+ <CheckCircleIcon class="w-3.5 h-3.5 text-success" />+ <span class="text-sm text-success">{{+ typeGroup.summary.success+ }}</span>+ </div>+ </div>+ </div>+ </div>++ <!-- Empty State -->+ <div v-else class="flex flex-col">+ <div class="text-control-light">+ <div class="flex flex-row justify-start items-center gap-2">+ <CheckCircleIcon class="w-5 h-5 opacity-40" />+ <span>No check results available</span>+ </div>+ <p v-if="allowRunChecks" class="text-sm mt-1">+ Click "Run Checks" to validate this specification+ </p>+ </div>+ </div>+ </div>++ <!-- Status Drawer -->+ <Drawer v-model:show="drawerVisible">+ <DrawerContent+ :title="drawerTitle"+ class="w-[40rem] max-w-[100vw] relative"+ >+ <div class="w-full h-full flex flex-col">+ <!-- Drawer Header -->+ <div class="flex items-center justify-between px-4 py-3 border-b">+ <div class="flex items-center gap-2">+ <component+ :is="getStatusIcon(selectedStatus)"+ class="w-5 h-5"+ :class="getStatusColor(selectedStatus)"+ />+ <h3 class="text-lg font-medium">{{ drawerTitle }}</h3>+ </div>+ </div>++ <!-- Drawer Content -->+ <div class="flex-1 overflow-y-auto px-4 py-3">+ <div v-if="drawerCheckRuns.length > 0" class="space-y-4">+ <!-- Group by Check Type -->+ <div+ v-for="[checkType, checkRuns] in drawerCheckRunsByType"+ :key="checkType"+ class="space-y-2"+ >+ <div class="flex items-center gap-2 mb-3">+ <component+ :is="getCheckTypeIcon(checkType)"+ class="w-4 h-4"+ />+ <span class="font-medium">{{+ getCheckTypeLabel(checkType)+ }}</span>+ <span class="text-control-light"+ >({{ checkRuns.length }})</span+ >+ </div>++ <div class="space-y-3 pl-6">+ <div+ v-for="checkRun in checkRuns"+ :key="checkRun.name"+ class="space-y-2"+ >+ <div class="text-sm font-medium text-control">+ {{ formatTarget(checkRun.target) }}+ </div>+ <div+ v-for="(result, idx) in getResultsByStatus(+ checkRun,+ selectedStatus+ )"+ :key="idx"+ class="pl-4 py-1"+ >+ <div+ class="text-sm"+ :class="getStatusColor(selectedStatus)"+ >+ {{ result.title }}+ </div>+ <div+ v-if="result.content"+ class="text-xs text-control-light mt-0.5"+ >+ {{ result.content }}+ </div>+ <div+ v-if="+ result.sqlReviewReport &&+ result.sqlReviewReport.line > 0+ "+ class="text-xs text-control-lighter mt-0.5"+ >+ Line {{ result.sqlReviewReport.line }}, Column+ {{ result.sqlReviewReport.column }}+ </div>+ </div>+ </div>+ </div>+ </div>+ </div>+ <div v-else class="text-center py-8 text-control-light">+ No {{ selectedStatus.toLowerCase() }} results+ </div>+ </div>+ </div>+ </DrawerContent>+ </Drawer>+ </div></template>-<script lang="ts" setup>-import { computed } from "vue";+<script setup lang="ts">+import {+ CheckCircleIcon,+ AlertCircleIcon,+ XCircleIcon,+ PlayIcon,+ FileCodeIcon,+ DatabaseIcon,+ ShieldIcon,+ SearchCodeIcon,+} from "lucide-vue-next";+import { NButton } from "naive-ui";+import { computed, ref } from "vue";+import { useI18n } from "vue-i18n";+import { BBSpin } from "@/bbkit";+import Drawer from "@/components/v2/Container/Drawer.vue";+import DrawerContent from "@/components/v2/Container/DrawerContent.vue";+import { planServiceClient } from "@/grpcweb";+import {+ useCurrentUserV1,+ useCurrentProjectV1,+ pushNotification,+ extractUserId,+} from "@/store";import {- isDatabaseChangeSpec,- planCheckRunListForSpec,- planSpecHasPlanChecks,- usePlanContext,-} from "@/components/Plan/logic";-import PlanCheckRunBar from "@/components/PlanCheckRun/PlanCheckRunBar.vue";-import { useCurrentUserV1, extractUserId, useCurrentProjectV1 } from "@/store";-import { unknownDatabase } from "@/types";-import { hasProjectPermissionV2 } from "@/utils";+ PlanCheckRun_Result_Status,+ type PlanCheckRun,+} from "@/types/proto/v1/plan_service";+import { hasProjectPermissionV2, extractDatabaseResourceName } from "@/utils";+import { planCheckRunListForSpec, planSpecHasPlanChecks } from "../../logic";+import { usePlanContext } from "../../logic/context";+import { usePlanSpecContext } from "../SpecDetailView/context";+const { t } = useI18n();const currentUser = useCurrentUserV1();const { project } = useCurrentProjectV1();-const {- plan,- selectedSpec,- planCheckRunList: contextPlanCheckRunList,-} = usePlanContext();+const { plan, planCheckRunList } = usePlanContext();+const { selectedSpec } = usePlanSpecContext();++const isLoading = ref(false);+const isRunningChecks = ref(false);+const drawerVisible = ref(false);+const selectedStatus = ref<"ERROR" | "WARNING" | "SUCCESS">("ERROR");+const selectedCheckType = ref<string>("");const show = computed(() => {if (!selectedSpec.value) {@@ -37,31 +264,214 @@ const show = computed(() => {return planSpecHasPlanChecks(selectedSpec.value);});-const database = computed(() => unknownDatabase());+const checkRunsForSpec = computed(() => {+ if (!selectedSpec.value) return [];+ return planCheckRunListForSpec(planCheckRunList.value, selectedSpec.value);+});++const summary = computed(() => {+ const result = { success: 0, warning: 0, error: 0 };++ for (const checkRun of checkRunsForSpec.value) {+ const status = getCheckRunStatus(checkRun);+ if (status === "ERROR") {+ result.error++;+ } else if (status === "WARNING") {+ result.warning++;+ } else if (status === "SUCCESS") {+ result.success++;+ }+ }++ return result;+});++const groupedByType = computed(() => {+ const groups: Record<+ string,+ {+ summary: { success: number; warning: number; error: number };+ checkRuns: PlanCheckRun[];+ }+ > = {};++ for (const checkRun of checkRunsForSpec.value) {+ const type = checkRun.type;+ if (!groups[type]) {+ groups[type] = {+ summary: { success: 0, warning: 0, error: 0 },+ checkRuns: [],+ };+ }++ groups[type].checkRuns.push(checkRun);++ const status = getCheckRunStatus(checkRun);+ if (status === PlanCheckRun_Result_Status.ERROR) {+ groups[type].summary.error++;+ } else if (status === PlanCheckRun_Result_Status.WARNING) {+ groups[type].summary.warning++;+ } else {+ groups[type].summary.success++;+ }+ }++ return groups;+});++const drawerTitle = computed(() => {+ if (selectedStatus.value === "ERROR") return "Error Details";+ if (selectedStatus.value === "WARNING") return "Warning Details";+ return "Success Details";+});++const drawerCheckRuns = computed(() => {+ const result: PlanCheckRun[] = [];++ for (const checkRun of checkRunsForSpec.value) {+ const status = getCheckRunStatus(checkRun);+ if (+ (selectedStatus.value === "ERROR" &&+ status === PlanCheckRun_Result_Status.ERROR) ||+ (selectedStatus.value === "WARNING" &&+ status === PlanCheckRun_Result_Status.WARNING) ||+ (selectedStatus.value === "SUCCESS" &&+ status === PlanCheckRun_Result_Status.SUCCESS)+ ) {+ result.push(checkRun);+ }+ }++ return result;+});++const drawerCheckRunsByType = computed(() => {+ const groups = new Map<string, PlanCheckRun[]>();++ for (const checkRun of drawerCheckRuns.value) {+ const type = checkRun.type;+ if (!groups.has(type)) {+ groups.set(type, []);+ }+ groups.get(type)!.push(checkRun);+ }++ return groups;+});const allowRunChecks = computed(() => {- // Allowing below users to run plan checks- // - the creator of the plan- // - ones who have bb.planCheckRuns.run permission in the projectconst me = currentUser.value;if (extractUserId(plan.value.creator) === me.email) {return true;}- if (hasProjectPermissionV2(project.value, "bb.planCheckRuns.run")) {- return true;- }- return false;++ return hasProjectPermissionV2(project.value, "bb.planCheckRuns.run");});-const planCheckRunList = computed(() => {- // If a spec is database change spec, show plan checks for the spec.- if (selectedSpec.value && isDatabaseChangeSpec(selectedSpec.value)) {- return planCheckRunListForSpec(- contextPlanCheckRunList.value,- selectedSpec.value- );+const getCheckRunStatus = (+ checkRun: PlanCheckRun+): PlanCheckRun_Result_Status => {+ let hasError = false;+ let hasWarning = false;++ for (const result of checkRun.results) {+ if (result.status === "ERROR") {+ hasError = true;+ } else if (result.status === "WARNING") {+ hasWarning = true;+ }}- // Otherwise, show all plan checks in the plan.- return contextPlanCheckRunList.value;-});++ if (hasError) return PlanCheckRun_Result_Status.ERROR;+ if (hasWarning) return PlanCheckRun_Result_Status.WARNING;+ return PlanCheckRun_Result_Status.SUCCESS;+};++const getCheckTypeIcon = (type: string) => {+ switch (type) {+ case "DATABASE_STATEMENT_ADVISE":+ return SearchCodeIcon;+ case "DATABASE_STATEMENT_SUMMARY_REPORT":+ return FileCodeIcon;+ case "DATABASE_CONNECT":+ return DatabaseIcon;+ case "DATABASE_GHOST_SYNC":+ return ShieldIcon;+ default:+ return FileCodeIcon;+ }+};++const getCheckTypeLabel = (type: string) => {+ switch (type) {+ case "DATABASE_STATEMENT_ADVISE":+ return t("task.check-type.sql-review");+ case "DATABASE_STATEMENT_SUMMARY_REPORT":+ return t("task.check-type.summary-report");+ case "DATABASE_CONNECT":+ return t("task.check-type.connection");+ case "DATABASE_GHOST_SYNC":+ return t("task.check-type.ghost-sync");+ default:+ return type;+ }+};++const formatTarget = (target: string): string => {+ const { instanceName, databaseName } = extractDatabaseResourceName(target);+ if (instanceName && databaseName) {+ return `${databaseName} (${instanceName})`;+ }+ return target;+};++const runChecks = async () => {+ if (!plan.value.name || !selectedSpec.value) return;++ isRunningChecks.value = true;+ try {+ await planServiceClient.runPlanChecks({ name: plan.value.name });+ pushNotification({+ module: "bytebase",+ style: "SUCCESS",+ title: "Plan checks started",+ });+ } catch (error: any) {+ pushNotification({+ module: "bytebase",+ style: "CRITICAL",+ title: "Failed to run plan checks",+ description: error.message,+ });+ } finally {+ isRunningChecks.value = false;+ }+};++const openDrawer = (status: "ERROR" | "WARNING" | "SUCCESS") => {+ selectedStatus.value = status;+ drawerVisible.value = true;+};++const getStatusIcon = (status: string) => {+ if (status === "ERROR") return XCircleIcon;+ if (status === "WARNING") return AlertCircleIcon;+ return CheckCircleIcon;+};++const getStatusColor = (status: string) => {+ if (status === "ERROR") return "text-error";+ if (status === "WARNING") return "text-warning";+ return "text-success";+};++const getResultsByStatus = (checkRun: PlanCheckRun, status: string) => {+ return checkRun.results.filter(+ (result) =>+ result.status ===+ PlanCheckRun_Result_Status[+ status as keyof typeof PlanCheckRun_Result_Status+ ]+ );+};</script>diff --git a/frontend/src/components/Plan/components/PlanCheckSection/SpecBasedPlanCheckSection.vue b/frontend/src/components/Plan/components/PlanCheckSection/SpecBasedPlanCheckSection.vuedeleted file mode 100644index 22bfc1091b..0000000000--- a/frontend/src/components/Plan/components/PlanCheckSection/SpecBasedPlanCheckSection.vue+++ /dev/null@@ -1,475 +0,0 @@-<template>- <div v-if="show" class="px-4 py-3 flex flex-col gap-y-1 overflow-hidden">- <div class="flex items-center justify-between gap-2">- <div class="flex items-center gap-1">- <h3 class="text-base font-medium">Checks</h3>- <span class="text-control-light">({{ totalCheckRuns }})</span>- </div>-- <div class="flex items-center gap-2">- <!-- Status Summary -->- <div class="flex items-center gap-2 text-sm">- <button- v-if="summary.error > 0"- class="flex items-center gap-1 hover:opacity-80"- @click="openDrawer('ERROR')"- >- <XCircleIcon class="w-4 h-4 text-error" />- <span class="text-error font-medium">{{ summary.error }}</span>- </button>- <button- v-if="summary.warning > 0"- class="flex items-center gap-1 hover:opacity-80"- @click="openDrawer('WARNING')"- >- <AlertCircleIcon class="w-4 h-4 text-warning" />- <span class="text-warning font-medium">{{ summary.warning }}</span>- </button>- <button- v-if="summary.success > 0"- class="flex items-center gap-1 hover:opacity-80"- @click="openDrawer('SUCCESS')"- >- <CheckCircleIcon class="w-4 h-4 text-success" />- <span class="text-success font-medium">{{ summary.success }}</span>- </button>- </div>-- <!-- Run Checks Button -->- <NButton- v-if="allowRunChecks"- size="small"- :loading="isRunningChecks"- @click="runChecks"- >- <template #icon>- <PlayIcon class="w-4 h-4" />- </template>- Run Checks- </NButton>- </div>- </div>-- <div class="flex-1 overflow-y-auto">- <!-- Loading State -->- <div v-if="isLoading" class="flex items-center justify-center py-8">- <BBSpin />- </div>-- <!-- Check Results -->- <div v-else-if="checkRunsForSpec.length > 0" class="flex flex-wrap gap-2">- <!-- Group by Check Type -->- <div- v-for="(typeGroup, checkType) in groupedByType"- :key="checkType"- class="inline-flex items-center gap-2"- @click="selectedCheckType = checkType"- >- <component- :is="getCheckTypeIcon(checkType)"- class="w-4 h-4 opacity-80"- />- <span class="text-sm">{{ getCheckTypeLabel(checkType) }}</span>-- <!-- Status indicators -->- <div class="flex items-center gap-2">- <div- v-if="typeGroup.summary.error > 0"- class="flex items-center gap-1"- >- <XCircleIcon class="w-3.5 h-3.5 text-error" />- <span class="text-sm text-error">{{- typeGroup.summary.error- }}</span>- </div>- <div- v-if="typeGroup.summary.warning > 0"- class="flex items-center gap-1"- >- <AlertCircleIcon class="w-3.5 h-3.5 text-warning" />- <span class="text-sm text-warning">{{- typeGroup.summary.warning- }}</span>- </div>- <div- v-if="typeGroup.summary.success > 0"- class="flex items-center gap-1"- >- <CheckCircleIcon class="w-3.5 h-3.5 text-success" />- <span class="text-sm text-success">{{- typeGroup.summary.success- }}</span>- </div>- </div>- <NDivider vertical />- </div>- </div>-- <!-- Empty State -->- <div v-else class="flex flex-col">- <div class="text-control-light">- <div class="flex flex-row justify-start items-center gap-2">- <CheckCircleIcon class="w-5 h-5 opacity-40" />- <span>No check results available</span>- </div>- <p v-if="allowRunChecks" class="text-sm mt-1">- Click "Run Checks" to validate this specification- </p>- </div>- </div>- </div>-- <!-- Status Drawer -->- <Drawer v-model:show="drawerVisible">- <DrawerContent- :title="drawerTitle"- class="w-[40rem] max-w-[100vw] relative"- >- <div class="w-full h-full flex flex-col">- <!-- Drawer Header -->- <div class="flex items-center justify-between px-4 py-3 border-b">- <div class="flex items-center gap-2">- <component- :is="getStatusIcon(selectedStatus)"- class="w-5 h-5"- :class="getStatusColor(selectedStatus)"- />- <h3 class="text-lg font-medium">{{ drawerTitle }}</h3>- </div>- </div>-- <!-- Drawer Content -->- <div class="flex-1 overflow-y-auto px-4 py-3">- <div v-if="drawerCheckRuns.length > 0" class="space-y-4">- <!-- Group by Check Type -->- <div- v-for="[checkType, checkRuns] in drawerCheckRunsByType"- :key="checkType"- class="space-y-2"- >- <div class="flex items-center gap-2 mb-3">- <component- :is="getCheckTypeIcon(checkType)"- class="w-4 h-4"- />- <span class="font-medium">{{- getCheckTypeLabel(checkType)- }}</span>- <span class="text-control-light"- >({{ checkRuns.length }})</span- >- </div>-- <div class="space-y-3 pl-6">- <div- v-for="checkRun in checkRuns"- :key="checkRun.name"- class="space-y-2"- >- <div class="text-sm font-medium text-control">- {{ formatTarget(checkRun.target) }}- </div>- <div- v-for="(result, idx) in getResultsByStatus(- checkRun,- selectedStatus- )"- :key="idx"- class="pl-4 py-1"- >- <div- class="text-sm"- :class="getStatusColor(selectedStatus)"- >- {{ result.title }}- </div>- <div- v-if="result.content"- class="text-xs text-control-light mt-0.5"- >- {{ result.content }}- </div>- <div- v-if="- result.sqlReviewReport &&- result.sqlReviewReport.line > 0- "- class="text-xs text-control-lighter mt-0.5"- >- Line {{ result.sqlReviewReport.line }}, Column- {{ result.sqlReviewReport.column }}- </div>- </div>- </div>- </div>- </div>- </div>- <div v-else class="text-center py-8 text-control-light">- No {{ selectedStatus.toLowerCase() }} results- </div>- </div>- </div>- </DrawerContent>- </Drawer>- </div>-</template>--<script setup lang="ts">-import {- CheckCircleIcon,- AlertCircleIcon,- XCircleIcon,- PlayIcon,- FileCodeIcon,- DatabaseIcon,- ShieldIcon,-} from "lucide-vue-next";-import { NButton, NDivider } from "naive-ui";-import { computed, ref } from "vue";-import { BBSpin } from "@/bbkit";-import Drawer from "@/components/v2/Container/Drawer.vue";-import DrawerContent from "@/components/v2/Container/DrawerContent.vue";-import { planServiceClient } from "@/grpcweb";-import {- useCurrentUserV1,- useCurrentProjectV1,- pushNotification,- extractUserId,-} from "@/store";-import {- PlanCheckRun_Result_Status,- type PlanCheckRun,-} from "@/types/proto/v1/plan_service";-import { hasProjectPermissionV2, extractDatabaseResourceName } from "@/utils";-import { planCheckRunListForSpec, planSpecHasPlanChecks } from "../../logic";-import { usePlanContext } from "../../logic/context";--const currentUser = useCurrentUserV1();-const { project } = useCurrentProjectV1();-const { plan, selectedSpec, planCheckRunList } = usePlanContext();--const isLoading = ref(false);-const isRunningChecks = ref(false);-const drawerVisible = ref(false);-const selectedStatus = ref<"ERROR" | "WARNING" | "SUCCESS">("ERROR");-const selectedCheckType = ref<string>("");--const show = computed(() => {- if (!selectedSpec.value) {- return false;- }- return planSpecHasPlanChecks(selectedSpec.value);-});--const checkRunsForSpec = computed(() => {- if (!selectedSpec.value) return [];- return planCheckRunListForSpec(planCheckRunList.value, selectedSpec.value);-});--const totalCheckRuns = computed(() => checkRunsForSpec.value.length);--const summary = computed(() => {- const result = { success: 0, warning: 0, error: 0 };-- for (const checkRun of checkRunsForSpec.value) {- const status = getCheckRunStatus(checkRun);- if (status === "ERROR") {- result.error++;- } else if (status === "WARNING") {- result.warning++;- } else if (status === "SUCCESS") {- result.success++;- }- }-- return result;-});--const groupedByType = computed(() => {- const groups: Record<- string,- {- summary: { success: number; warning: number; error: number };- checkRuns: PlanCheckRun[];- }- > = {};-- for (const checkRun of checkRunsForSpec.value) {- const type = checkRun.type;- if (!groups[type]) {- groups[type] = {- summary: { success: 0, warning: 0, error: 0 },- checkRuns: [],- };- }-- groups[type].checkRuns.push(checkRun);-- const status = getCheckRunStatus(checkRun);- if (status === PlanCheckRun_Result_Status.ERROR) {- groups[type].summary.error++;- } else if (status === PlanCheckRun_Result_Status.WARNING) {- groups[type].summary.warning++;- } else {- groups[type].summary.success++;- }- }-- return groups;-});--const drawerTitle = computed(() => {- if (selectedStatus.value === "ERROR") return "Error Details";- if (selectedStatus.value === "WARNING") return "Warning Details";- return "Success Details";-});--const drawerCheckRuns = computed(() => {- const result: PlanCheckRun[] = [];-- for (const checkRun of checkRunsForSpec.value) {- const status = getCheckRunStatus(checkRun);- if (- (selectedStatus.value === "ERROR" &&- status === PlanCheckRun_Result_Status.ERROR) ||- (selectedStatus.value === "WARNING" &&- status === PlanCheckRun_Result_Status.WARNING) ||- (selectedStatus.value === "SUCCESS" &&- status === PlanCheckRun_Result_Status.SUCCESS)- ) {- result.push(checkRun);- }- }-- return result;-});--const drawerCheckRunsByType = computed(() => {- const groups = new Map<string, PlanCheckRun[]>();-- for (const checkRun of drawerCheckRuns.value) {- const type = checkRun.type;- if (!groups.has(type)) {- groups.set(type, []);- }- groups.get(type)!.push(checkRun);- }-- return groups;-});--const allowRunChecks = computed(() => {- const me = currentUser.value;- if (extractUserId(plan.value.creator) === me.email) {- return true;- }-- return hasProjectPermissionV2(project.value, "bb.planCheckRuns.run");-});--const getCheckRunStatus = (- checkRun: PlanCheckRun-): PlanCheckRun_Result_Status => {- let hasError = false;- let hasWarning = false;-- for (const result of checkRun.results) {- if (result.status === "ERROR") {- hasError = true;- } else if (result.status === "WARNING") {- hasWarning = true;- }- }-- if (hasError) return PlanCheckRun_Result_Status.ERROR;- if (hasWarning) return PlanCheckRun_Result_Status.WARNING;- return PlanCheckRun_Result_Status.SUCCESS;-};--const getCheckTypeIcon = (type: string) => {- switch (type) {- case "DATABASE_STATEMENT_ADVISE":- case "DATABASE_STATEMENT_SUMMARY_REPORT":- return FileCodeIcon;- case "DATABASE_CONNECT":- return DatabaseIcon;- case "DATABASE_GHOST_SYNC":- return ShieldIcon;- default:- return FileCodeIcon;- }-};--const getCheckTypeLabel = (type: string) => {- switch (type) {- case "DATABASE_STATEMENT_ADVISE":- return "Statement Validation";- case "DATABASE_STATEMENT_SUMMARY_REPORT":- return "Statement Summary";- case "DATABASE_CONNECT":- return "Database Connection";- case "DATABASE_GHOST_SYNC":- return "Ghost Sync Check";- default:- return type;- }-};--const formatTarget = (target: string): string => {- const { instanceName, databaseName } = extractDatabaseResourceName(target);- if (instanceName && databaseName) {- return `${databaseName} (${instanceName})`;- }- return target;-};--const runChecks = async () => {- if (!plan.value.name || !selectedSpec.value) return;-- isRunningChecks.value = true;- try {- await planServiceClient.runPlanChecks({ name: plan.value.name });- pushNotification({- module: "bytebase",- style: "SUCCESS",- title: "Plan checks started",- });- } catch (error: any) {- pushNotification({- module: "bytebase",- style: "CRITICAL",- title: "Failed to run plan checks",- description: error.message,- });- } finally {- isRunningChecks.value = false;- }-};--const openDrawer = (status: "ERROR" | "WARNING" | "SUCCESS") => {- selectedStatus.value = status;- drawerVisible.value = true;-};--const getStatusIcon = (status: string) => {- if (status === "ERROR") return XCircleIcon;- if (status === "WARNING") return AlertCircleIcon;- return CheckCircleIcon;-};--const getStatusColor = (status: string) => {- if (status === "ERROR") return "text-error";- if (status === "WARNING") return "text-warning";- return "text-success";-};--const getResultsByStatus = (checkRun: PlanCheckRun, status: string) => {- return checkRun.results.filter(- (result) =>- result.status ===- PlanCheckRun_Result_Status[- status as keyof typeof PlanCheckRun_Result_Status- ]- );-};-</script>diff --git a/frontend/src/components/Plan/components/PlanDataTable/PlanDataTable.vue b/frontend/src/components/Plan/components/PlanDataTable/PlanDataTable.vueindex 00c9e9d123..50e583d0ef 100644--- a/frontend/src/components/Plan/components/PlanDataTable/PlanDataTable.vue+++ b/frontend/src/components/Plan/components/PlanDataTable/PlanDataTable.vue@@ -19,7 +19,7 @@ import { useRouter } from "vue-router";import { BBAvatar } from "@/bbkit";import { projectOfPlan } from "@/components/Plan/logic";import { ProjectNameCell } from "@/components/v2/Model/DatabaseV1Table/cells";-import { PROJECT_V1_ROUTE_REVIEW_CENTER_DETAIL } from "@/router/dashboard/projectV1";+import { PROJECT_V1_ROUTE_PLAN_DETAIL } from "@/router/dashboard/projectV1";import { useUserStore } from "@/store";import { getTimeForPbTimestamp, unknownUser } from "@/types";import type { Plan } from "@/types/proto/v1/plan_service";@@ -27,7 +27,6 @@ import {extractPlanUID,extractProjectResourceName,humanizeTs,- planV1Slug,} from "@/utils";import PlanCheckRunStatusIcon from "../PlanCheckRunStatusIcon.vue";@@ -120,10 +119,10 @@ const rowProps = (plan: Plan) => {style: "cursor: pointer;",onClick: (e: MouseEvent) => {const route = router.resolve({- name: PROJECT_V1_ROUTE_REVIEW_CENTER_DETAIL,+ name: PROJECT_V1_ROUTE_PLAN_DETAIL,params: {projectId: extractProjectResourceName(plan.name),- planSlug: planV1Slug(plan),+ planId: extractPlanUID(plan.name),},});const url = route.fullPath;diff --git a/frontend/src/components/Plan/components/SQLCheckV1Section/SQLCheckV1Section.vue b/frontend/src/components/Plan/components/SQLCheckV1Section/SQLCheckV1Section.vuenew file mode 100644index 0000000000..562dc1cf7d--- /dev/null+++ b/frontend/src/components/Plan/components/SQLCheckV1Section/SQLCheckV1Section.vue@@ -0,0 +1,315 @@+<template>+ <div v-if="show" class="px-4 pt-3 flex flex-col gap-y-1 overflow-hidden">+ <div class="flex items-center justify-between gap-2">+ <div class="flex items-center gap-1">+ <h3 class="text-base font-medium">SQL Review</h3>+ </div>++ <div class="flex items-center gap-4">+ <!-- Status Summary -->+ <div class="flex items-center gap-2 text-sm">+ <button+ v-if="summary.error > 0"+ class="flex items-center gap-1 hover:opacity-80"+ @click="openDrawer('ERROR')"+ >+ <XCircleIcon class="w-5 h-5 text-error" />+ <span class="text-error font-medium">{{ summary.error }}</span>+ </button>+ <button+ v-if="summary.warning > 0"+ class="flex items-center gap-1 hover:opacity-80"+ @click="openDrawer('WARNING')"+ >+ <AlertCircleIcon class="w-5 h-5 text-warning" />+ <span class="text-warning font-medium">{{ summary.warning }}</span>+ </button>+ <span+ v-if="+ !isNullOrUndefined(checkResults) &&+ summary.error === 0 &&+ summary.warning === 0+ "+ class="flex items-center"+ >+ <CheckCircleIcon class="w-5 h-5 text-success" />+ </span>+ </div>++ <!-- Run Checks Button -->+ <NButton+ size="small"+ :loading="isRunningChecks"+ :disabled="statement.length === 0"+ @click="runChecks"+ >+ <template #icon>+ <PlayIcon class="w-4 h-4" />+ </template>+ Run Review+ </NButton>+ </div>+ </div>++ <!-- Status Drawer -->+ <Drawer v-model:show="drawerVisible">+ <DrawerContent+ :title="drawerTitle"+ class="w-[40rem] max-w-[100vw] relative"+ >+ <div class="w-full h-full flex flex-col">+ <!-- Drawer Header -->+ <div class="flex items-center justify-between px-2 py-2 border-b">+ <div class="flex items-center gap-2">+ <component+ :is="getStatusIcon(selectedStatus)"+ class="w-5 h-5"+ :class="getStatusColor(selectedStatus)"+ />+ <h3 class="text-lg font-medium">{{ drawerTitle }}</h3>+ </div>+ </div>++ <!-- Drawer Content -->+ <div class="flex-1 overflow-y-auto py-2">+ <div v-if="drawerAdvices.length > 0" class="space-y-2">+ <div+ v-for="(advice, idx) in drawerAdvices"+ :key="idx"+ class="space-y-1 p-3 border rounded-lg bg-gray-50"+ >+ <div class="flex items-start justify-between">+ <div class="text-sm font-medium text-main">+ {{ advice.title }}+ </div>+ <component+ :is="getStatusIcon(advice.status)"+ class="w-4 h-4 flex-shrink-0"+ :class="getStatusColor(advice.status)"+ />+ </div>++ <!-- Target Database -->+ <div class="text-xs text-control font-medium">+ Database: {{ formatTarget(advice.target) }}+ </div>++ <!-- Advice Content -->+ <div v-if="advice.content" class="text-xs text-control-light">+ {{ advice.content }}+ </div>++ <!-- Location Info -->+ <div+ v-if="advice.startPosition && advice.startPosition.line > 0"+ class="text-xs text-control-lighter"+ >+ Line {{ advice.startPosition.line }}, Column+ {{ advice.startPosition.column }}+ </div>+ </div>+ </div>+ <div v-else class="text-center py-8 text-control-light">+ No {{ selectedStatus.toLowerCase() }} results+ </div>+ </div>+ </div>+ </DrawerContent>+ </Drawer>+ </div>+</template>++<script setup lang="ts">+import {+ CheckCircleIcon,+ AlertCircleIcon,+ XCircleIcon,+ PlayIcon,+} from "lucide-vue-next";+import { NButton } from "naive-ui";+import { computed, ref, watch } from "vue";+import { getLocalSheetByName } from "@/components/Plan";+import Drawer from "@/components/v2/Container/Drawer.vue";+import DrawerContent from "@/components/v2/Container/DrawerContent.vue";+import { releaseServiceClient } from "@/grpcweb";+import { Plan_ChangeDatabaseConfig_Type } from "@/types/proto/v1/plan_service";+import {+ ReleaseFileType,+ Release_File_ChangeType,+ type CheckReleaseResponse_CheckResult,+} from "@/types/proto/v1/release_service";+import { Advice_Status, type Advice } from "@/types/proto/v1/sql_service";+import {+ getSheetStatement,+ isNullOrUndefined,+ extractDatabaseResourceName,+} from "@/utils";+import { usePlanContext } from "../../logic/context";+import { targetsForSpec } from "../../logic/plan";+import { usePlanSpecContext } from "../SpecDetailView/context";++const { plan } = usePlanContext();+const { selectedSpec } = usePlanSpecContext();++const isRunningChecks = ref(false);+const drawerVisible = ref(false);+const selectedStatus = ref<"ERROR" | "WARNING" | "SUCCESS">("ERROR");+const checkResults = ref<CheckReleaseResponse_CheckResult[] | undefined>(+ undefined+);++const statement = computed(() => {+ if (!selectedSpec.value) return "";+ const config = selectedSpec.value.changeDatabaseConfig;+ if (!config) return "";+ const sheet = getLocalSheetByName(config.sheet);+ return getSheetStatement(sheet);+});++const show = computed(() => {+ if (!selectedSpec.value) {+ return false;+ }+ // Show for change database configs+ return !!selectedSpec.value.changeDatabaseConfig;+});++// Enhanced advice type with target information+type AdviceWithTarget = Advice & {+ target: string;+};++const allAdvices = computed(() => {+ if (!checkResults.value) {+ return [];+ }+ const advices: AdviceWithTarget[] = [];+ for (const result of checkResults.value) {+ for (const advice of result.advices) {+ advices.push({+ ...advice,+ target: result.target,+ });+ }+ }+ return advices;+});++const summary = computed(() => {+ const result = { success: 0, warning: 0, error: 0 };++ for (const advice of allAdvices.value) {+ if (advice.status === Advice_Status.ERROR) {+ result.error++;+ } else if (advice.status === Advice_Status.WARNING) {+ result.warning++;+ } else if (advice.status === Advice_Status.SUCCESS) {+ result.success++;+ }+ }++ return result;+});++const drawerTitle = computed(() => {+ if (selectedStatus.value === "ERROR") return "Error Details";+ if (selectedStatus.value === "WARNING") return "Warning Details";+ return "Success Details";+});++const drawerAdvices = computed(() => {+ return allAdvices.value.filter((advice) => {+ if (selectedStatus.value === "ERROR") {+ return advice.status === Advice_Status.ERROR;+ } else if (selectedStatus.value === "WARNING") {+ return advice.status === Advice_Status.WARNING;+ } else {+ return advice.status === Advice_Status.SUCCESS;+ }+ });+});++const runChecks = async () => {+ if (!plan.value.name || !selectedSpec.value) return;++ const config = selectedSpec.value.changeDatabaseConfig;+ if (!config) return;++ isRunningChecks.value = true;+ try {+ // Get the statement from the sheet+ const sheetName = config.sheet;+ const sheet = getLocalSheetByName(sheetName);+ const statement = getSheetStatement(sheet);++ // Get targets+ const targets = targetsForSpec(selectedSpec.value);++ // Get project from plan name+ const projectName = `projects/${plan.value.name.split("/")[1]}`;++ // Run check for all targets+ const response = await releaseServiceClient.checkRelease({+ parent: projectName,+ release: {+ files: [+ {+ // Use "0" for dummy version.+ version: "0",+ type: ReleaseFileType.VERSIONED,+ statement: new TextEncoder().encode(statement),+ changeType:+ config.type === Plan_ChangeDatabaseConfig_Type.DATA+ ? Release_File_ChangeType.DML+ : Release_File_ChangeType.DDL,+ },+ ],+ },+ targets,+ });++ checkResults.value = response.results || [];+ } finally {+ isRunningChecks.value = false;+ }+};++const openDrawer = (status: "ERROR" | "WARNING" | "SUCCESS") => {+ selectedStatus.value = status;+ drawerVisible.value = true;+};++const getStatusIcon = (status: Advice_Status | string) => {+ if (status === Advice_Status.ERROR || status === "ERROR") return XCircleIcon;+ if (status === Advice_Status.WARNING || status === "WARNING")+ return AlertCircleIcon;+ return CheckCircleIcon;+};++const getStatusColor = (status: Advice_Status | string) => {+ if (status === Advice_Status.ERROR || status === "ERROR") return "text-error";+ if (status === Advice_Status.WARNING || status === "WARNING")+ return "text-warning";+ return "text-success";+};++const formatTarget = (target: string): string => {+ const { instanceName, databaseName } = extractDatabaseResourceName(target);+ if (instanceName && databaseName) {+ return `${databaseName} (${instanceName})`;+ }+ return target;+};++watch(+ () => selectedSpec.value.id,+ () => {+ // Reset drawer and results when spec changes.+ drawerVisible.value = false;+ checkResults.value = undefined;+ },+ {+ immediate: true,+ }+);+</script>diff --git a/frontend/src/components/Plan/components/SQLCheckV1Section/index.ts b/frontend/src/components/Plan/components/SQLCheckV1Section/index.tsnew file mode 100644index 0000000000..428fdd998a--- /dev/null+++ b/frontend/src/components/Plan/components/SQLCheckV1Section/index.ts@@ -0,0 +1,3 @@+import SQLCheckV1Section from "./SQLCheckV1Section.vue";++export default SQLCheckV1Section;diff --git a/frontend/src/components/Plan/components/SpecDetailView/SpecDetailView.vue b/frontend/src/components/Plan/components/SpecDetailView/SpecDetailView.vueindex f7024aedd9..b4620805b9 100644--- a/frontend/src/components/Plan/components/SpecDetailView/SpecDetailView.vue+++ b/frontend/src/components/Plan/components/SpecDetailView/SpecDetailView.vue@@ -1,9 +1,11 @@<template>- <div class="flex-1 flex flex-col hide-scrollbar divide-y overflow-x-hidden">- <SQLCheckSection v-if="isCreating" />- <SpecBasedPlanCheckSection v-else />+ <div+ class="flex-1 flex flex-col hide-scrollbar gap-3 divide-y overflow-x-hidden"+ ><TargetListSection />- <div class="w-full">+ <SQLCheckV1Section v-if="isCreating" />+ <PlanCheckSection v-else />+ <div class="w-full space-y-3 pt-3"><StatementSection /><Configuration /></div>@@ -11,24 +13,12 @@</template><script setup lang="ts">-import type { Ref } from "vue";-import { useCurrentProjectV1 } from "@/store";-import type { Plan_Spec } from "@/types/proto/v1/plan_service";import { usePlanContext } from "../../logic/context";import Configuration from "../Configuration";-import SpecBasedPlanCheckSection from "../PlanCheckSection/SpecBasedPlanCheckSection.vue";-import SQLCheckSection, {- providePlanSQLCheckContext,-} from "../SQLCheckSection";+import PlanCheckSection from "../PlanCheckSection";+import SQLCheckV1Section from "../SQLCheckV1Section";import StatementSection from "../StatementSection";import TargetListSection from "./TargetListSection.vue";-const { project } = useCurrentProjectV1();-const { isCreating, plan, selectedSpec } = usePlanContext();--providePlanSQLCheckContext({- project,- plan,- selectedSpec: selectedSpec as Ref<Plan_Spec>,-});+const { isCreating } = usePlanContext();</script>diff --git a/frontend/src/components/Plan/components/SpecDetailView/TargetListSection.vue b/frontend/src/components/Plan/components/SpecDetailView/TargetListSection.vueindex 9d8f407413..f505e0039a 100644--- a/frontend/src/components/Plan/components/SpecDetailView/TargetListSection.vue+++ b/frontend/src/components/Plan/components/SpecDetailView/TargetListSection.vue@@ -1,11 +1,10 @@<template>- <div class="px-4 py-3 flex flex-col gap-y-2">+ <div class="px-4 flex flex-col gap-y-2"><div class="flex items-center justify-between gap-2"><div class="flex items-center gap-1"><h3 class="text-base font-medium">{{ $t("plan.targets.title") }}</h3><span class="text-control-light">({{ targets.length }})</span></div>- <!-- TODO(claude): allow to update targets when no rollout is created by plan --><NButtonv-if="allowEdit"size="small"@@ -105,11 +104,13 @@ import { NEllipsis, NTooltip, NButton } from "naive-ui";import { computed, ref, watchEffect } from "vue";import { useI18n } from "vue-i18n";import { BBSpin } from "@/bbkit";+import { planServiceClient } from "@/grpcweb";import {useInstanceV1Store,useDatabaseV1Store,useDBGroupStore,useProjectV1Store,+ pushNotification,} from "@/store";import {extractInstanceResourceName,@@ -121,6 +122,7 @@ import {import { usePlanContext } from "../../logic/context";import { targetsForSpec } from "../../logic/plan";import TargetsSelectorDrawer from "./TargetsSelectorDrawer.vue";+import { usePlanSpecContext } from "./context";interface TargetRow {target: string;@@ -133,7 +135,8 @@ interface TargetRow {}const { t } = useI18n();-const { plan, selectedSpec, isCreating } = usePlanContext();+const { plan, isCreating, events } = usePlanContext();+const { selectedSpec } = usePlanSpecContext();const instanceStore = useInstanceV1Store();const databaseStore = useDatabaseV1Store();const dbGroupStore = useDBGroupStore();@@ -157,9 +160,11 @@ const project = computed(() => {return projectStore.getProjectByName(projectName);});-// Only allow editing in creation mode or if the plan is editable+// Only allow editing in creation mode or if the plan is editable.+// An empty string for `plan.value.rollout` indicates that the plan is in a draft or uninitialized state,+// which allows edits to be made.const allowEdit = computed(() => {- return isCreating.value && selectedSpec.value;+ return (isCreating.value || plan.value.rollout === "") && selectedSpec.value;});// Prepare data - fetch resources when targets change@@ -272,7 +277,7 @@ const getTypeLabel = (type: TargetRow["type"]) => {return typeLabels[type];};-const handleUpdateTargets = (targets: string[]) => {+const handleUpdateTargets = async (targets: string[]) => {if (!selectedSpec.value) return;// Update the targets in the spec.@@ -282,5 +287,20 @@ const handleUpdateTargets = (targets: string[]) => {if (config) {config.targets = targets;}++ if (!isCreating.value) {+ await planServiceClient.updatePlan({+ plan: plan.value,+ updateMask: ["specs"],+ });+ events.emit("status-changed", {+ eager: true,+ });+ pushNotification({+ module: "bytebase",+ style: "SUCCESS",+ title: t("common.updated"),+ });+ }};</script>diff --git a/frontend/src/components/Plan/components/SpecDetailView/context.ts b/frontend/src/components/Plan/components/SpecDetailView/context.tsnew file mode 100644index 0000000000..5b2c494275--- /dev/null+++ b/frontend/src/components/Plan/components/SpecDetailView/context.ts@@ -0,0 +1,68 @@+import { head } from "lodash-es";+import {+ computed,+ inject,+ provide,+ watchEffect,+ type InjectionKey,+ type Ref,+} from "vue";+import { useRoute, useRouter } from "vue-router";+import { type Plan } from "@/types/proto/v1/plan_service";+import { gotoSpec } from "../common/utils";++const KEY = Symbol("bb.plan.spec.detail") as InjectionKey<PlanSpecContext>;++export const usePlanSpecContext = () => {+ return inject(KEY)!;+};++export const providePlanSpecContext = (refs: {+ isCreating: Ref<boolean>;+ plan: Ref<Plan>;+}) => {+ const route = useRoute();+ const router = useRouter();+ const { plan } = refs;++ const selectedSpec = computed(() => {+ if (plan.value.specs.length === 0) {+ throw new Error("No specs found in the plan.");+ }+ const specId = route.params.specId as string | undefined;+ if (!specId) {+ throw new Error("Spec ID is required in the route parameters.");+ }+ const foundSpec =+ plan.value.specs.find((spec) => spec.id === specId) ||+ head(plan.value.specs);+ if (!foundSpec) {+ throw new Error(`Spec with ID ${specId} not found in the plan.`);+ }+ return foundSpec;+ });++ // Auto-redirect if the specId in the route does not match any spec in the plan.+ watchEffect(() => {+ const specNotFound = !plan.value.specs.some(+ (spec) => spec.id === route.params.specId+ );+ if (specNotFound) {+ const foundSpec = head(plan.value.specs);+ if (!foundSpec) {+ throw new Error("No specs available in the plan to redirect to.");+ }+ gotoSpec(router, foundSpec.id);+ }+ });++ const context = {+ selectedSpec,+ };++ provide(KEY, context);++ return context;+};++type PlanSpecContext = ReturnType<typeof providePlanSpecContext>;diff --git a/frontend/src/components/Plan/components/SpecDetailView/index.ts b/frontend/src/components/Plan/components/SpecDetailView/index.tsindex a467e7f4b7..e7869607e3 100644--- a/frontend/src/components/Plan/components/SpecDetailView/index.ts+++ b/frontend/src/components/Plan/components/SpecDetailView/index.ts@@ -1 +1,3 @@-export { default as SpecDetailView } from "./SpecDetailView.vue";+import SpecDetailView from "./SpecDetailView.vue";++export default SpecDetailView;diff --git a/frontend/src/components/Plan/components/SpecStatusBadge.vue b/frontend/src/components/Plan/components/SpecStatusBadge.vuedeleted file mode 100644index 2e468ae2b1..0000000000--- a/frontend/src/components/Plan/components/SpecStatusBadge.vue+++ /dev/null@@ -1,60 +0,0 @@-<template>- <NTag size="small" round :type="tagType">- <template #icon>- <component :is="statusIcon" class="w-3 h-3" />- </template>- {{ statusText }}- </NTag>-</template>--<script setup lang="ts">-import { CheckCircleIcon, AlertCircleIcon, XCircleIcon } from "lucide-vue-next";-import { NTag } from "naive-ui";-import { computed } from "vue";-import { useI18n } from "vue-i18n";--const props = defineProps<{- status: "SUCCESS" | "WARNING" | "ERROR" | "STATUS_UNSPECIFIED";-}>();--const { t } = useI18n();--const statusIcon = computed(() => {- switch (props.status) {- case "SUCCESS":- return CheckCircleIcon;- case "WARNING":- return AlertCircleIcon;- case "ERROR":- return XCircleIcon;- default:- return null;- }-});--const statusText = computed(() => {- switch (props.status) {- case "SUCCESS":- return t("plan.spec.status.pass");- case "WARNING":- return t("plan.spec.status.warn");- case "ERROR":- return t("plan.spec.status.error");- default:- return "";- }-});--const tagType = computed(() => {- switch (props.status) {- case "SUCCESS":- return "success";- case "WARNING":- return "warning";- case "ERROR":- return "error";- default:- return "default";- }-});-</script>diff --git a/frontend/src/components/Plan/components/SpecsView.vue b/frontend/src/components/Plan/components/SpecsView.vuenew file mode 100644index 0000000000..b398a390ed--- /dev/null+++ b/frontend/src/components/Plan/components/SpecsView.vue@@ -0,0 +1,27 @@+<template>+ <SpecDetailView />+</template>++<script setup lang="ts">+import { type Ref } from "vue";+import { useCurrentProjectV1 } from "@/store";+import { type Plan_Spec } from "@/types/proto/v1/plan_service";+import { usePlanContext } from "../logic/context";+import { providePlanSQLCheckContext } from "./SQLCheckSection";+import SpecDetailView from "./SpecDetailView";+import { providePlanSpecContext } from "./SpecDetailView/context";++const { project } = useCurrentProjectV1();+const { isCreating, plan } = usePlanContext();++const { selectedSpec } = providePlanSpecContext({+ isCreating,+ plan,+});++providePlanSQLCheckContext({+ project,+ plan,+ selectedSpec: selectedSpec as Ref<Plan_Spec>,+});+</script>diff --git a/frontend/src/components/Plan/components/StatementSection/EditorView/EditorView.vue b/frontend/src/components/Plan/components/StatementSection/EditorView/EditorView.vueindex 54885a5842..0be0267bdc 100644--- a/frontend/src/components/Plan/components/StatementSection/EditorView/EditorView.vue+++ b/frontend/src/components/Plan/components/StatementSection/EditorView/EditorView.vue@@ -108,7 +108,7 @@:readonly="isEditorReadonly":dialect="dialect":advices="isEditorReadonly || isCreating ? markers : []"- :auto-height="{ min: 120, max: 240 }"+ :auto-height="{ min: 160, max: 240 }":auto-complete-context="{instance: database.instance,database: database.name,@@ -170,6 +170,13 @@</template><script setup lang="ts">+import { useElementSize } from "@vueuse/core";+import { cloneDeep, head, isEmpty } from "lodash-es";+import { ExpandIcon } from "lucide-vue-next";+import { NButton, NTooltip, useDialog } from "naive-ui";+import { v1 as uuidv1 } from "uuid";+import { computed, reactive, ref, watch } from "vue";+import { useI18n } from "vue-i18n";import { BBAttention, BBModal } from "@/bbkit";import { MonacoEditor } from "@/components/MonacoEditor";import { extensionNameOfLanguage } from "@/components/MonacoEditor/utils";@@ -179,6 +186,7 @@ import {databaseEngineForSpec,databaseForSpec,usePlanContext,+ planCheckRunListForSpec,} from "@/components/Plan/logic";import DownloadSheetButton from "@/components/Sheet/DownloadSheetButton.vue";import SQLUploadButton from "@/components/misc/SQLUploadButton.vue";@@ -186,7 +194,7 @@ import { planServiceClient } from "@/grpcweb";import {pushNotification,useCurrentProjectV1,- useSheetV1Store+ useSheetV1Store,} from "@/store";import type { SQLDialect } from "@/types";import { dialectOfEngineV1 } from "@/types";@@ -197,32 +205,21 @@ import {setSheetStatement,useInstanceV1EditorLanguage,} from "@/utils";-import { useElementSize } from "@vueuse/core";-import { cloneDeep, head, isEmpty } from "lodash-es";-import { ExpandIcon } from "lucide-vue-next";-import { NButton, NTooltip, useDialog } from "naive-ui";-import { v1 as uuidv1 } from "uuid";-import { computed, reactive, ref, watch } from "vue";-import { useI18n } from "vue-i18n";-import { usePlanSQLCheckContext } from "../../SQLCheckSection/context";-import useSelectedSpec from "../../common/useSelectedSpec";+import { usePlanSpecContext } from "../../SpecDetailView/context";import { useSQLAdviceMarkers } from "../useSQLAdviceMarkers";import type { EditState } from "./useTempEditState";import { useTempEditState } from "./useTempEditState";type LocalState = EditState & {- showFeatureModal: boolean;showEditorModal: boolean;isUploadingFile: boolean;};const { t } = useI18n();const dialog = useDialog();-const context = usePlanContext();const { project } = useCurrentProjectV1();-const { isCreating, plan, events } = context;-const selectedSpec = useSelectedSpec();-const { resultMap } = usePlanSQLCheckContext();+const { isCreating, plan, events, planCheckRunList } = usePlanContext();+const { selectedSpec } = usePlanSpecContext();const editorContainerElRef = ref<HTMLElement>();const monacoEditorRef = ref<InstanceType<typeof MonacoEditor>>();const { height: editorContainerHeight } = useElementSize(editorContainerElRef);@@ -230,7 +227,6 @@ const { height: editorContainerHeight } = useElementSize(editorContainerElRef);const state = reactive<LocalState>({isEditing: false,statement: "",- showFeatureModal: false,showEditorModal: false,isUploadingFile: false,});@@ -254,11 +250,13 @@ const dialect = computed((): SQLDialect => {const statementTitle = computed(() => {return language.value === "sql" ? t("common.sql") : t("common.statement");});-const advices = computed(() => {- const database = databaseForSpec(project.value, selectedSpec.value);- return resultMap.value[database.name]?.advices || [];-});-const { markers } = useSQLAdviceMarkers(context, advices);+const planCheckRunsForSelectedSpec = computed(() =>+ planCheckRunListForSpec(planCheckRunList.value, selectedSpec.value)+);+const { markers } = useSQLAdviceMarkers(+ isCreating,+ planCheckRunsForSelectedSpec+);/*** to set the MonacoEditor as readonlydiff --git a/frontend/src/components/Plan/components/StatementSection/EditorView/useTempEditState.ts b/frontend/src/components/Plan/components/StatementSection/EditorView/useTempEditState.tsindex fceb5d9c9f..fdbe3f36a9 100644--- a/frontend/src/components/Plan/components/StatementSection/EditorView/useTempEditState.ts+++ b/frontend/src/components/Plan/components/StatementSection/EditorView/useTempEditState.ts@@ -1,7 +1,7 @@import { computed, nextTick, ref, watch } from "vue";import { UNKNOWN_ID } from "@/types";import { usePlanContext } from "../../../logic";-import useSelectedSpec from "../../common/useSelectedSpec";+import { usePlanSpecContext } from "../../SpecDetailView/context";import { useSpecSheet } from "../useSpecSheet";export type EditState = {@@ -11,7 +11,7 @@ export type EditState = {export const useTempEditState = (state: EditState) => {const { isCreating } = usePlanContext();- const selectedSpec = useSelectedSpec();+ const { selectedSpec } = usePlanSpecContext();const { sheet, sheetName, sheetReady, sheetStatement } = useSpecSheet(selectedSpec.value);diff --git a/frontend/src/components/Plan/components/StatementSection/ReleaseView/ReleaseView.vue b/frontend/src/components/Plan/components/StatementSection/ReleaseView/ReleaseView.vueindex a4207f2385..dd0e9f0832 100644--- a/frontend/src/components/Plan/components/StatementSection/ReleaseView/ReleaseView.vue+++ b/frontend/src/components/Plan/components/StatementSection/ReleaseView/ReleaseView.vue@@ -157,10 +157,10 @@ import { isValidReleaseName, getDateForPbTimestamp } from "@/types";import { VCSType } from "@/types/proto/v1/common";import { ReleaseFileType } from "@/types/proto/v1/release_service";import type { Release_File_ChangeType } from "@/types/proto/v1/release_service";-import useSelectedSpec from "../../common/useSelectedSpec";+import { usePlanSpecContext } from "../../SpecDetailView/context";const { t } = useI18n();-const selectedSpec = useSelectedSpec();+const { selectedSpec } = usePlanSpecContext();const releaseName = computed(() => {return selectedSpec.value?.changeDatabaseConfig?.release || "";diff --git a/frontend/src/components/Plan/components/StatementSection/StatementSection.vue b/frontend/src/components/Plan/components/StatementSection/StatementSection.vueindex 4054bc5025..eda5da3742 100644--- a/frontend/src/components/Plan/components/StatementSection/StatementSection.vue+++ b/frontend/src/components/Plan/components/StatementSection/StatementSection.vue@@ -1,5 +1,5 @@<template>- <div v-if="viewMode !== 'NONE'" class="px-4 py-2 flex flex-col gap-y-2">+ <div v-if="viewMode !== 'NONE'" class="px-4 flex flex-col gap-y-2"><EditorView v-if="viewMode === 'EDITOR'" /><ReleaseView v-else-if="viewMode === 'RELEASE'" /></div>@@ -7,11 +7,11 @@<script setup lang="ts">import { computed } from "vue";-import { usePlanContext } from "../..";+import { usePlanSpecContext } from "../SpecDetailView/context";import EditorView from "./EditorView";import ReleaseView from "./ReleaseView";-const { selectedSpec } = usePlanContext();+const { selectedSpec } = usePlanSpecContext();const viewMode = computed((): "NONE" | "EDITOR" | "RELEASE" => {if (selectedSpec.value) {diff --git a/frontend/src/components/Plan/components/StatementSection/useSQLAdviceMarkers.ts b/frontend/src/components/Plan/components/StatementSection/useSQLAdviceMarkers.tsindex ca49988c80..4d09a0bad5 100644--- a/frontend/src/components/Plan/components/StatementSection/useSQLAdviceMarkers.ts+++ b/frontend/src/components/Plan/components/StatementSection/useSQLAdviceMarkers.ts@@ -2,20 +2,18 @@ import { maxBy } from "lodash-es";import { computed, type Ref } from "vue";import type { AdviceOption } from "@/components/MonacoEditor";import {- Plan_Spec,PlanCheckRun,PlanCheckRun_Result_Status,PlanCheckRun_Type,} from "@/types/proto/v1/plan_service";import { Advice_Status, type Advice } from "@/types/proto/v1/sql_service";import { extractPlanCheckRunUID } from "@/utils";-import { planCheckRunListForSpec, type PlanContext } from "../../logic";export const useSQLAdviceMarkers = (- context: PlanContext,- advices: Ref<Advice[] | undefined> | undefined+ isCreating: Ref<boolean>,+ planCheckRunList?: Ref<PlanCheckRun[]>,+ advices?: Ref<Advice[] | undefined>) => {- const { isCreating } = context;const markers = computed(() => {if (isCreating.value) {if (!advices) return [];@@ -35,17 +33,14 @@ export const useSQLAdviceMarkers = (};});} else {- const { selectedSpec, planCheckRunList: contextPlanCheckRunList } = context;- const planCheckRunList = planCheckRunListForSpec(- contextPlanCheckRunList.value,- selectedSpec.value as Plan_Spec- );+ if (!planCheckRunList) return [];+ if (!planCheckRunList.value) return [];const types: PlanCheckRun_Type[] = [PlanCheckRun_Type.DATABASE_STATEMENT_ADVISE,];return types.flatMap((type) => {return getLatestAdviceOptions(- planCheckRunList.filter((checkRun) => checkRun.type === type)+ planCheckRunList.value.filter((checkRun) => checkRun.type === type));});}diff --git a/frontend/src/components/Plan/components/TargetListSection.vue b/frontend/src/components/Plan/components/TargetListSection.vuenew file mode 100644index 0000000000..2ecf7d60d5--- /dev/null+++ b/frontend/src/components/Plan/components/TargetListSection.vue@@ -0,0 +1,231 @@+<template>+ <div class="px-4 py-3 flex flex-col gap-y-2">+ <div class="flex items-center justify-between gap-2">+ <div class="flex items-center gap-1">+ <h3 class="text-base font-medium">Targets</h3>+ <span class="text-control-light">({{ targets.length }})</span>+ </div>+ </div>++ <div class="flex-1 overflow-y-auto">+ <div v-if="isLoading" class="flex items-center justify-center py-8">+ <BBSpin />+ </div>+ <div v-else-if="targets.length > 0" class="flex flex-wrap gap-2">+ <NTooltip+ v-for="(item, index) in tableData"+ :key="index"+ placement="top"+ >+ <template #trigger>+ <div+ class="inline-flex items-center gap-x-1.5 px-3 py-1.5 border rounded-lg hover:bg-control-bg-hover hover:border-control-border-hover transition-all cursor-default max-w-[20rem]"+ >+ <component+ :is="item.icon"+ class="w-4 h-4 text-control-light flex-shrink-0"+ />+ <div class="flex items-center gap-x-1 min-w-0">+ <NEllipsis :line-clamp="1" class="text-sm">+ <span class="font-medium">{{ item.name }}</span>+ <span+ v-if="item.type === 'database' && item.instance"+ class="text-control-light"+ >+ <span class="mx-1">·</span>{{ item.instance }}+ </span>+ </NEllipsis>+ </div>+ <div+ class="text-xs px-2 py-0.5 rounded-md bg-control-bg text-control-light flex-shrink-0"+ >+ {{ getTypeLabel(item.type) }}+ </div>+ </div>+ </template>++ <!-- Tooltip Content -->+ <div class="max-w-sm space-y-1">+ <div class="font-semibold">{{ item.name }}</div>+ <div class="text-sm space-y-0.5">+ <div+ v-if="item.type !== 'instance' && item.instance"+ class="flex items-center gap-1"+ >+ <ServerIcon class="w-3 h-3" />+ <span>{{ item.instance }}</span>+ </div>+ <div v-if="item.environment">+ Environment: {{ item.environment }}+ </div>+ <div v-if="item.description" class="pt-1 text-control-light">+ {{ item.description }}+ </div>+ </div>+ </div>+ </NTooltip>+ </div>+ <div v-else class="text-center text-control-light py-8">+ No targets found+ </div>+ </div>+ </div>+</template>++<script setup lang="ts">+import { ServerIcon, DatabaseIcon, FolderIcon } from "lucide-vue-next";+import { NEllipsis, NTooltip } from "naive-ui";+import { computed, ref, watchEffect } from "vue";+import { BBSpin } from "@/bbkit";+import {+ useInstanceV1Store,+ useDatabaseV1Store,+ useDBGroupStore,+} from "@/store";+import { extractInstanceResourceName, instanceV1Name } from "@/utils";+import { targetsForSpec } from "../logic/plan";+import { usePlanSpecContext } from "./SpecDetailView/context";++interface TargetRow {+ target: string;+ type: "instance" | "database" | "databaseGroup";+ icon: any;+ name: string;+ instance?: string;+ environment?: string;+ description?: string;+}++const { selectedSpec } = usePlanSpecContext();+const instanceStore = useInstanceV1Store();+const databaseStore = useDatabaseV1Store();+const dbGroupStore = useDBGroupStore();++const isLoading = ref(false);++const targets = computed(() => {+ if (!selectedSpec.value) return [];+ return targetsForSpec(selectedSpec.value);+});++const isCreateDatabaseSpec = computed(() => {+ return !!selectedSpec.value?.createDatabaseConfig;+});++// Prepare data - fetch resources when targets change+watchEffect(async () => {+ isLoading.value = true;+ try {+ if (!selectedSpec.value) return;++ const targetList = targets.value;+ if (targetList.length === 0) return;++ // Prepare promises for fetching resources+ const fetchPromises: Promise<any>[] = [];++ for (const target of targetList) {+ // For create database spec, target is instance+ if (isCreateDatabaseSpec.value) {+ const instanceResourceName = extractInstanceResourceName(target);+ fetchPromises.push(+ instanceStore.getOrFetchInstanceByName(instanceResourceName)+ );+ }+ // For database group targets+ else if (target.includes("/databaseGroups/")) {+ fetchPromises.push(dbGroupStore.getOrFetchDBGroupByName(target));+ }+ // For regular database targets+ else {+ fetchPromises.push(databaseStore.getOrFetchDatabaseByName(target));+ }+ }++ // Fetch all resources in parallel+ await Promise.allSettled(fetchPromises);+ } finally {+ isLoading.value = false;+ }+});++const tableData = computed((): TargetRow[] => {+ if (!selectedSpec.value) return [];++ return targets.value.map((target): TargetRow => {+ // For create database spec, target is instance+ if (isCreateDatabaseSpec.value) {+ const instanceResourceName = extractInstanceResourceName(target);+ const instance = instanceStore.getInstanceByName(instanceResourceName);++ return {+ target,+ type: "instance",+ icon: ServerIcon,+ name: instance ? instanceV1Name(instance) : instanceResourceName,+ environment: instance?.environmentEntity?.title || "Unknown",+ description: instance?.title || "",+ };+ }++ // For database group targets+ if (target.includes("/databaseGroups/")) {+ const match = target.match(/projects\/([^/]+)\/databaseGroups\/([^/]+)/);+ if (match) {+ const [_, projectId, groupName] = match;+ const dbGroup = dbGroupStore.getDBGroupByName(target);++ return {+ target,+ type: "databaseGroup",+ icon: FolderIcon,+ name: dbGroup?.title || groupName,+ description: dbGroup+ ? `Database group in project ${projectId}`+ : target,+ };+ }+ }++ // For regular database targets+ const database = databaseStore.getDatabaseByName(target);++ if (!database) {+ // Fallback when database is not found+ const match = target.match(/instances\/([^/]+)\/databases\/([^/]+)/);+ if (match) {+ const [_, instanceId, databaseName] = match;+ return {+ target,+ type: "database",+ icon: DatabaseIcon,+ name: databaseName,+ instance: instanceId,+ description: "Database not found",+ };+ }+ }++ const instance = database?.instanceResource;++ return {+ target,+ type: "database",+ icon: DatabaseIcon,+ name: database?.databaseName || target,+ instance: instance ? instanceV1Name(instance) : "",+ environment: database?.effectiveEnvironmentEntity?.title || "",+ description: database?.labels?.["bb.database.description"] || "",+ };+ });+});++const getTypeLabel = (type: TargetRow["type"]) => {+ const typeLabels = {+ instance: "Instance",+ database: "Database",+ databaseGroup: "Database Group",+ };+ return typeLabels[type];+};+</script>diff --git a/frontend/src/components/Plan/components/common/useSelectedSpec.ts b/frontend/src/components/Plan/components/common/useSelectedSpec.tsdeleted file mode 100644index 702909d29f..0000000000--- a/frontend/src/components/Plan/components/common/useSelectedSpec.ts+++ /dev/null@@ -1,11 +0,0 @@-import type { Ref } from "vue";-import type { Plan_Spec } from "@/types/proto/v1/plan_service";-import { usePlanContext } from "../../logic";--const useSelectedSpec = () => {- const { selectedSpec } = usePlanContext();-- return selectedSpec as Ref<Plan_Spec>;-};--export default useSelectedSpec;diff --git a/frontend/src/components/Plan/components/common/utils.ts b/frontend/src/components/Plan/components/common/utils.tsnew file mode 100644index 0000000000..260d33404e--- /dev/null+++ b/frontend/src/components/Plan/components/common/utils.ts@@ -0,0 +1,13 @@+import { type Router } from "vue-router";+import { PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL } from "@/router/dashboard/projectV1";++export const gotoSpec = (router: Router, specId: string) => {+ router.push({+ name: PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,+ params: {+ ...router.currentRoute.value.params,+ specId,+ },+ query: router.currentRoute.value.query,+ });+};diff --git a/frontend/src/components/Plan/components/common/validateSpec.ts b/frontend/src/components/Plan/components/common/validateSpec.tsindex 2d1bb7507b..98815f9b62 100644--- a/frontend/src/components/Plan/components/common/validateSpec.ts+++ b/frontend/src/components/Plan/components/common/validateSpec.ts@@ -1,8 +1,8 @@import { ref, watchEffect } from "vue";-import type { Plan_Spec } from "@/types/proto/v1/plan_service";+import { getLocalSheetByName } from "@/components/Plan";import { useSheetV1Store } from "@/store";+import type { Plan_Spec } from "@/types/proto/v1/plan_service";import { extractSheetUID, getSheetStatement, sheetNameOfSpec } from "@/utils";-import { getLocalSheetByName } from "@/components/Plan";// Hook to validate all specs in a planexport const useSpecsValidation = (specs: Plan_Spec[]) => {@@ -41,7 +41,7 @@ export const useSpecsValidation = (specs: Plan_Spec[]) => {watchEffect(async () => {const newMap = new Map<string, boolean>();-+// Check all specsawait Promise.all(specs.map(async (spec) => {@@ -49,7 +49,7 @@ export const useSpecsValidation = (specs: Plan_Spec[]) => {newMap.set(spec.id, isEmpty);}));-+validationMap.value = newMap;});@@ -60,4 +60,4 @@ export const useSpecsValidation = (specs: Plan_Spec[]) => {return {isSpecEmpty,};-};\ No newline at end of file+};diff --git a/frontend/src/components/Plan/components/index.ts b/frontend/src/components/Plan/components/index.tsindex dfa26219c6..1a755a9aa4 100644--- a/frontend/src/components/Plan/components/index.ts+++ b/frontend/src/components/Plan/components/index.ts@@ -1,17 +1,15 @@+import { ChecksView } from "./ChecksView";import HeaderSection from "./HeaderSection";-import Navigator from "./Navigator.vue";import Overview from "./Overview.vue";-import PlanCheckSection from "./PlanCheckSection";import SQLCheckSection from "./SQLCheckSection";-import { SpecDetailView } from "./SpecDetailView";+import SpecDetailView from "./SpecDetailView";import StatementSection from "./StatementSection";export {+ ChecksView,HeaderSection,- Navigator,Overview,SpecDetailView,- PlanCheckSection,SQLCheckSection,StatementSection,};diff --git a/frontend/src/components/Plan/logic/base.ts b/frontend/src/components/Plan/logic/base.tsindex a193a473f1..9ee7725d43 100644--- a/frontend/src/components/Plan/logic/base.ts+++ b/frontend/src/components/Plan/logic/base.ts@@ -1,48 +1,12 @@import Emittery from "emittery";-import { computed } from "vue";-import { useRoute, useRouter } from "vue-router";-import { PROJECT_V1_ROUTE_REVIEW_CENTER_DETAIL } from "@/router/dashboard/projectV1";-import type { Plan_Spec } from "@/types/proto/v1/plan_service";import type { PlanContext, PlanEvents } from "./context";export const useBasePlanContext = (- context: Pick<PlanContext, "isCreating" | "ready" | "plan">+ _: Pick<PlanContext, "isCreating" | "plan">): Partial<PlanContext> => {- const { plan } = context;- const route = useRoute();- const router = useRouter();-const events: PlanEvents = new Emittery();- const specs = computed(() => plan.value?.specs || []);-- const selectedSpec = computed((): Plan_Spec | undefined => {- // Check if spec is selected from URL.- const specId = route.query.spec as string;- if (specId) {- const specFound = specs.value.find((spec) => spec.id === specId);- if (specFound) {- return specFound;- }- }-- // Fallback to first spec.- return undefined;- });-- events.on("select-spec", ({ spec }) => {- router.replace({- name: PROJECT_V1_ROUTE_REVIEW_CENTER_DETAIL,- query: {- ...route.query,- spec: spec.id,- },- hash: route.hash,- });- });-return {events,- selectedSpec,};};diff --git a/frontend/src/components/Plan/logic/context.ts b/frontend/src/components/Plan/logic/context.tsindex 7148cbc12a..8bdabf5492 100644--- a/frontend/src/components/Plan/logic/context.ts+++ b/frontend/src/components/Plan/logic/context.ts@@ -2,28 +2,19 @@ import type Emittery from "emittery";import { v4 as uuidv4 } from "uuid";import type { InjectionKey, Ref } from "vue";import { inject, provide } from "vue";-import type {- Plan,- Plan_Spec,- PlanCheckRun,-} from "@/types/proto/v1/plan_service";+import type { Plan, PlanCheckRun } from "@/types/proto/v1/plan_service";export type PlanEvents = Emittery<{"status-changed": { eager: boolean };- "select-spec": { spec: Plan_Spec };- "select-target": { target: string };}>;export type PlanContext = {// Basic fieldsisCreating: Ref<boolean>;- ready: Ref<boolean>;plan: Ref<Plan>;planCheckRunList: Ref<PlanCheckRun[]>;// TODO(steven): save related issue/rollout for checking if the plan is changable.- selectedSpec: Ref<Plan_Spec | undefined>;-// UI eventsevents: PlanEvents;};diff --git a/frontend/src/components/Plan/logic/initialize/index.ts b/frontend/src/components/Plan/logic/initialize/index.tsindex a0f6e39815..03f2c4c378 100644--- a/frontend/src/components/Plan/logic/initialize/index.ts+++ b/frontend/src/components/Plan/logic/initialize/index.ts@@ -6,7 +6,6 @@ import { usePlanStore } from "@/store/modules/v1/plan";import { EMPTY_ID, UNKNOWN_ID } from "@/types";import type { Plan, PlanCheckRun } from "@/types/proto/v1/plan_service";import { emptyPlan } from "@/types/v1/issue/plan";-import { uidFromSlug } from "@/utils";import { createPlanSkeleton } from "./create";export * from "./create";@@ -14,17 +13,17 @@ export * from "./create";export * from "./util";export function useInitializePlan(- planSlug: MaybeRef<string>,+ planId: MaybeRef<string>,project: MaybeRef<string> = "-",redirectNotFound: boolean = true) {const isCreating = computed(() => {- return unref(planSlug).toLowerCase() === "create";+ return unref(planId).toLowerCase() === "create";});const uid = computed(() => {- const slug = unref(planSlug);- if (slug.toLowerCase() === "create") return String(EMPTY_ID);- const uid = Number(uidFromSlug(slug));+ const id = unref(planId);+ if (id.toLowerCase() === "create") return String(EMPTY_ID);+ const uid = Number(id);if (uid > 0) return String(uid);return String(UNKNOWN_ID);});diff --git a/frontend/src/components/Plan/logic/poll.ts b/frontend/src/components/Plan/logic/poll.tsindex 133e2d2ca5..8c948e1c52 100644--- a/frontend/src/components/Plan/logic/poll.ts+++ b/frontend/src/components/Plan/logic/poll.ts@@ -4,11 +4,11 @@ import { usePlanStore } from "@/store/modules/v1/plan";import { usePlanContext } from "./context";export const usePollPlan = () => {- const { isCreating, ready, plan, events } = usePlanContext();+ const { isCreating, plan, events } = usePlanContext();const planStore = usePlanStore();const shouldPollPlan = computed(() => {- return !isCreating.value && ready.value;+ return !isCreating.value;});const refreshPlan = () => {diff --git a/frontend/src/components/Project/useProjectSidebar.ts b/frontend/src/components/Project/useProjectSidebar.tsindex 58122ad2de..31b531f835 100644--- a/frontend/src/components/Project/useProjectSidebar.ts+++ b/frontend/src/components/Project/useProjectSidebar.ts@@ -25,9 +25,9 @@ import projectV1Routes, {PROJECT_V1_ROUTE_DATABASE_GROUPS,PROJECT_V1_ROUTE_EXPORT_CENTER,PROJECT_V1_ROUTE_AUDIT_LOGS,- PROJECT_V1_ROUTE_REVIEW_CENTER,PROJECT_V1_ROUTE_RELEASES,PROJECT_V1_ROUTE_MASKING_EXEMPTION,+ PROJECT_V1_ROUTE_PLANS,} from "@/router/dashboard/projectV1";import { useAppFeature } from "@/store";import type { ComposedProject, MaybeRef } from "@/types";@@ -128,9 +128,10 @@ export const useProjectSidebar = (databaseChangeMode.value === DatabaseChangeMode.EDITOR,},{+ // TODO(claude): rename title to "Plans".title: t("review-center.self"),icon: () => h(SearchCodeIcon),- path: PROJECT_V1_ROUTE_REVIEW_CENTER,+ path: PROJECT_V1_ROUTE_PLANS,type: "div",hide:isDefaultProject.value ||diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex d01ed7095b..1ecf274783 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -1007,8 +1007,7 @@"navigator": {"overview": "Overview","specifications": "Specifications",- "spec-number": "Spec {number}",- "no-specifications": "No specifications",+ "checks": "Checks","statement-empty": "Statement is empty"},"spec": {@@ -1020,19 +1019,11 @@"database-change": "Database Change","export-data": "Export Data","unknown": "Unknown"- },- "status": {- "pass": "Pass",- "warn": "Warn",- "error": "Error"}},"targets": {"title": "Targets","no-targets-found": "No targets found",- "no-targets": "No targets",- "one-target": "1 target",- "multiple-targets": "{count} targets","one-database": "1 database","multiple-databases": "{count} databases","database-group": "Database Group",diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex cce4cfedd1..3b25c297f5 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -1007,8 +1007,7 @@"navigator": {"overview": "Descripción general","specifications": "Presupuesto",- "spec-number": "Especificación {number}",- "no-specifications": "Sin especificaciones",+ "checks": "Cheques","statement-empty": "La declaración está vacía"},"spec": {@@ -1020,19 +1019,11 @@"database-change": "Cambio de base de datos","export-data": "Exportar datos","unknown": "Desconocido"- },- "status": {- "pass": "Aprobar",- "warn": "Advertir",- "error": "Error"}},"targets": {"title": "Objetivos","no-targets-found": "No se encontraron objetivos",- "no-targets": "Sin objetivos",- "one-target": "1 objetivo",- "multiple-targets": "{count} objetivos","one-database": "1 base de datos","multiple-databases": "{count} bases de datos","database-group": "Grupo de bases de datos",diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex 37387b288e..e28aab3b1a 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -1007,8 +1007,7 @@"navigator": {"overview": "概要","specifications": "仕様",- "spec-number": "スペック {number}",- "no-specifications": "仕様なし",+ "checks": "小切手","statement-empty": "ステートメントが空です"},"spec": {@@ -1020,19 +1019,11 @@"database-change": "データベースの変更","export-data": "データのエクスポート","unknown": "未知"- },- "status": {- "pass": "合格",- "warn": "警告する",- "error": "エラー"}},"targets": {"title": "ターゲット","no-targets-found": "ターゲットが見つかりません",- "no-targets": "ターゲットなし",- "one-target": "1つのターゲット",- "multiple-targets": "{count} 個のターゲット","one-database": "1 つのデータベース","multiple-databases": "{count} データベース","database-group": "データベースグループ",diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.jsonindex 38ec8f29ff..6e409e9bb8 100644--- a/frontend/src/locales/vi-VN.json+++ b/frontend/src/locales/vi-VN.json@@ -1007,8 +1007,7 @@"navigator": {"overview": "Tổng quan","specifications": "Thông số kỹ thuật",- "spec-number": "Đặc điểm kỹ thuật {number}",- "no-specifications": "Không có thông số kỹ thuật",+ "checks": "Kiểm tra","statement-empty": "Câu lệnh trống rỗng"},"spec": {@@ -1020,19 +1019,11 @@"database-change": "Thay đổi cơ sở dữ liệu","export-data": "Xuất dữ liệu","unknown": "Không rõ"- },- "status": {- "pass": "Vượt qua",- "warn": "Cảnh báo",- "error": "Lỗi"}},"targets": {"title": "Mục tiêu","no-targets-found": "Không tìm thấy mục tiêu",- "no-targets": "Không có mục tiêu",- "one-target": "1 mục tiêu",- "multiple-targets": "{count} mục tiêu","one-database": "1 cơ sở dữ liệu","multiple-databases": "{count} cơ sở dữ liệu","database-group": "Nhóm cơ sở dữ liệu",diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex 41b2663a9a..9cf2e7e6ac 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -1007,8 +1007,7 @@"navigator": {"overview": "概述","specifications": "变更项",- "spec-number": "变更项 {number}",- "no-specifications": "无变更项",+ "checks": "检查","statement-empty": "变更语句为空"},"spec": {@@ -1020,19 +1019,11 @@"database-change": "数据库变更","export-data": "导出数据","unknown": "未知"- },- "status": {- "pass": "通过",- "warn": "警告",- "error": "错误"}},"targets": {"title": "变更对象","no-targets-found": "未找到变更对象",- "no-targets": "没有变更对象",- "one-target": "1 个变更对象",- "multiple-targets": "{count} 个变更对象","one-database": "1 个数据库","multiple-databases": "{count} 个数据库","database-group": "数据库组",diff --git a/frontend/src/router/dashboard/projectV1.ts b/frontend/src/router/dashboard/projectV1.tsindex 44ffdfbbc2..586b73ef7f 100644--- a/frontend/src/router/dashboard/projectV1.ts+++ b/frontend/src/router/dashboard/projectV1.ts@@ -17,6 +17,9 @@ export const PROJECT_V1_ROUTE_ISSUES = `${PROJECT_V1_ROUTE_DASHBOARD}.issue`;export const PROJECT_V1_ROUTE_ISSUE_DETAIL = `${PROJECT_V1_ROUTE_DASHBOARD}.issue.detail`;export const PROJECT_V1_ROUTE_PLANS = `${PROJECT_V1_ROUTE_DASHBOARD}.plan`;export const PROJECT_V1_ROUTE_PLAN_DETAIL = `${PROJECT_V1_ROUTE_DASHBOARD}.plan.detail`;+export const PROJECT_V1_ROUTE_PLAN_DETAIL_SPECS = `${PROJECT_V1_ROUTE_PLAN_DETAIL}.specs`;+export const PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL = `${PROJECT_V1_ROUTE_PLAN_DETAIL}.spec.detail`;+export const PROJECT_V1_ROUTE_PLAN_DETAIL_CHECK_RUNS = `${PROJECT_V1_ROUTE_PLAN_DETAIL}.check-runs`;export const PROJECT_V1_ROUTE_CHANGELISTS = `${PROJECT_V1_ROUTE_DASHBOARD}.changelist`;export const PROJECT_V1_ROUTE_CHANGELIST_DETAIL = `${PROJECT_V1_ROUTE_DASHBOARD}.changelist.detail`;export const PROJECT_V1_ROUTE_SYNC_SCHEMA = `${PROJECT_V1_ROUTE_DASHBOARD}.sync-schema`;@@ -27,8 +30,6 @@ export const PROJECT_V1_ROUTE_WEBHOOK_DETAIL = `${PROJECT_V1_ROUTE_DASHBOARD}.weexport const PROJECT_V1_ROUTE_MEMBERS = `${PROJECT_V1_ROUTE_DASHBOARD}.members`;export const PROJECT_V1_ROUTE_SETTINGS = `${PROJECT_V1_ROUTE_DASHBOARD}.settings`;export const PROJECT_V1_ROUTE_EXPORT_CENTER = `${PROJECT_V1_ROUTE_DASHBOARD}.export-center`;-export const PROJECT_V1_ROUTE_REVIEW_CENTER = `${PROJECT_V1_ROUTE_DASHBOARD}.review-center`;-export const PROJECT_V1_ROUTE_REVIEW_CENTER_DETAIL = `${PROJECT_V1_ROUTE_DASHBOARD}.review-center.detail`;export const PROJECT_V1_ROUTE_RELEASES = `${PROJECT_V1_ROUTE_DASHBOARD}.release`;export const PROJECT_V1_ROUTE_RELEASE_CREATE = `${PROJECT_V1_ROUTE_DASHBOARD}.release.create`;export const PROJECT_V1_ROUTE_RELEASE_DETAIL = `${PROJECT_V1_ROUTE_DASHBOARD}.release.detail`;@@ -323,60 +324,60 @@ const projectV1Routes: RouteRecordRaw[] = [props: true,},{- path: "review-center",- meta: {- title: () => t("review-center.self"),- },+ path: "plans",props: true,children: [{path: "",- name: PROJECT_V1_ROUTE_REVIEW_CENTER,+ name: PROJECT_V1_ROUTE_PLANS,meta: {+ // TODO(claude): rename title to "Plans" later.+ title: () => t("review-center.self"),requiredPermissionList: () => ["bb.databases.list","bb.plans.list",],},- props: true,component: () => import("@/views/ReviewCenter/index.vue"),+ props: true,},{- path: ":planSlug",- name: PROJECT_V1_ROUTE_REVIEW_CENTER_DETAIL,+ path: ":planId",+ alias: [+ ":planId/planCheckRuns",+ ":planId/planCheckRuns/:planCheckRunId",+ ],+ name: PROJECT_V1_ROUTE_PLAN_DETAIL,meta: {requiredPermissionList: () => ["bb.plans.get"],},component: () => import("@/views/project/ProjectPlanDetail.vue"),props: true,+ children: [+ {+ path: "specs",+ name: PROJECT_V1_ROUTE_PLAN_DETAIL_SPECS,+ component: () =>+ import("@/views/project/ProjectPlanDetail.vue"),+ children: [+ {+ path: ":specId",+ name: PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,+ component: () =>+ import("@/views/project/ProjectPlanDetail.vue"),+ },+ ],+ },+ {+ path: "planCheckRuns",+ name: PROJECT_V1_ROUTE_PLAN_DETAIL_CHECK_RUNS,+ component: () =>+ import("@/views/project/ProjectPlanDetail.vue"),+ },+ ],},],},- {- path: "plans",- name: PROJECT_V1_ROUTE_PLANS,- redirect(to) {- return {- name: PROJECT_V1_ROUTE_REVIEW_CENTER,- params: {- projectId: to.params.projectId,- },- };- },- },- {- path: "plans/:planSlug",- name: PROJECT_V1_ROUTE_PLAN_DETAIL,- redirect(to) {- return {- name: PROJECT_V1_ROUTE_REVIEW_CENTER_DETAIL,- params: {- projectId: to.params.projectId,- planSlug: to.params.planSlug,- },- };- },- },{path: "releases",meta: {diff --git a/frontend/src/utils/databaseGroup/issue.ts b/frontend/src/utils/databaseGroup/issue.tsindex dc5d872835..e9987694f3 100644--- a/frontend/src/utils/databaseGroup/issue.ts+++ b/frontend/src/utils/databaseGroup/issue.ts@@ -1,7 +1,7 @@import dayjs from "dayjs";import {PROJECT_V1_ROUTE_ISSUE_DETAIL,- PROJECT_V1_ROUTE_REVIEW_CENTER_DETAIL,+ PROJECT_V1_ROUTE_PLAN_DETAIL,} from "@/router/dashboard/projectV1";import type { ComposedDatabaseGroup } from "@/types";import { extractProjectResourceName } from "../v1";@@ -30,12 +30,12 @@ export const generateDatabaseGroupIssueRoute = (return {name: planOnly- ? PROJECT_V1_ROUTE_REVIEW_CENTER_DETAIL+ ? PROJECT_V1_ROUTE_PLAN_DETAIL: PROJECT_V1_ROUTE_ISSUE_DETAIL,params: {projectId: extractProjectResourceName(databaseGroup.name),issueSlug: "create",- planSlug: "create",+ planId: "create",},query,};diff --git a/frontend/src/views/project/ProjectPlanDetail.vue b/frontend/src/views/project/ProjectPlanDetail.vueindex 273944bbaf..2aec5002a2 100644--- a/frontend/src/views/project/ProjectPlanDetail.vue+++ b/frontend/src/views/project/ProjectPlanDetail.vue@@ -34,19 +34,18 @@ defineOptions({const props = defineProps<{projectId: string;- planSlug: string;+ planId: string;}>();const { t } = useI18n();const { isCreating, plan, planCheckRunList, isInitializing } =- useInitializePlan(toRef(props, "planSlug"), toRef(props, "projectId"));+ useInitializePlan(toRef(props, "planId"), toRef(props, "projectId"));const ready = computed(() => {return !isInitializing.value && !!plan.value;});const planBaseContext = useBasePlanContext({isCreating,- ready,plan,});@@ -55,7 +54,6 @@ providePlanContext(isCreating,plan,planCheckRunList,- ready,...planBaseContext,},true /* root */