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(frontend): move DatabaseChangeView to sidebar (#18399)
boojack792c286fe166
diff --git a/frontend/src/components/Plan/components/IssueReviewView/DatabaseChangeView.vue b/frontend/src/components/Plan/components/IssueReviewView/DatabaseChangeView.vuedeleted file mode 100644index dc0d4431b0..0000000000--- a/frontend/src/components/Plan/components/IssueReviewView/DatabaseChangeView.vue+++ /dev/null@@ -1,118 +0,0 @@-<template>- <div v-if="shouldShowOverview" class="w-full overflow-y-auto">- <div class="grid grid-cols-[auto_1fr] gap-y-4 gap-x-8">- <!-- SQL Checks -->- <h3 class="text-base text-control">- {{ $t("plan.navigator.checks") }}- </h3>- <div class="flex items-center gap-4">- <PlanCheckStatusCount- :plan="plan"- clickable- @click="selectedResultStatus = $event"- />- <span v-if="!hasAnyChecks" class="text-sm text-control">- {{ $t("plan.overview.no-checks") }}- </span>- </div>-- <!-- Stages -->- <template v-if="rollout">- <h3 class="text-base text-control">- {{ $t("rollout.stage.self", 2) }}- </h3>- <div class="flex items-center gap-1 flex-wrap">- <template v-if="rollout.stages.length > 0">- <div- v-for="(stage, index) in rollout.stages"- :key="stage.name"- class="flex items-center gap-1"- >- <div- class="flex items-center gap-1 cursor-pointer hover:opacity-80 transition-opacity"- @click="navigateToStage(stage.name)"- >- <TaskStatus- :status="getStageStatus(stage)"- size="small"- disabled- />- <EnvironmentV1Name- :environment="getEnvironmentEntity(stage.environment)"- :link="false"- :null-environment-placeholder="'Null'"- />- </div>- <span- v-if="index < rollout.stages.length - 1"- class="text-gray-400 text-sm mx-2"- >- →- </span>- </div>- </template>- <span v-else class="text-sm text-control">- {{ $t("common.no-data") }}- </span>- </div>- </template>- </div>- </div>-- <ChecksDrawer- v-if="selectedResultStatus"- :status="selectedResultStatus"- @close="selectedResultStatus = undefined"- />-</template>--<script setup lang="ts">-import { computed, ref } from "vue";-import { useRouter } from "vue-router";-import TaskStatus from "@/components/Rollout/kits/TaskStatus.vue";-import { EnvironmentV1Name } from "@/components/v2";-import { PROJECT_V1_ROUTE_ROLLOUT_DETAIL_STAGE_DETAIL } from "@/router/dashboard/projectV1";-import { useCurrentProjectV1, useEnvironmentV1Store } from "@/store";-import { Issue_Type } from "@/types/proto-es/v1/issue_service_pb";-import { Advice_Level } from "@/types/proto-es/v1/sql_service_pb";-import { extractProjectResourceName, getStageStatus } from "@/utils";-import { usePlanCheckStatus, usePlanContext } from "../../logic";-import ChecksDrawer from "../ChecksView/ChecksDrawer.vue";-import PlanCheckStatusCount from "../PlanCheckStatusCount.vue";--// Use usePlanContext instead of usePlanContextWithIssue to handle plan creation-// where issue doesn't exist yet-const { plan, rollout, issue } = usePlanContext();-const environmentStore = useEnvironmentV1Store();-const router = useRouter();-const { project } = useCurrentProjectV1();-const { hasAnyStatus: hasAnyChecks } = usePlanCheckStatus(plan);--const selectedResultStatus = ref<Advice_Level | undefined>(undefined);--const shouldShowOverview = computed(() => {- return issue.value?.type === Issue_Type.DATABASE_CHANGE || rollout?.value;-});--const getEnvironmentEntity = (environmentName: string) => {- return environmentStore.getEnvironmentByName(environmentName);-};--const navigateToStage = (stageName: string) => {- if (!rollout?.value) return;-- const rolloutId = rollout.value.name.split("/").pop();- const stageId = stageName.split("/").pop();-- if (!rolloutId || !stageId) return;-- router.push({- name: PROJECT_V1_ROUTE_ROLLOUT_DETAIL_STAGE_DETAIL,- params: {- projectId: extractProjectResourceName(project.value.name),- rolloutId,- stageId,- },- });-};-</script>diff --git a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/DatabaseChangeSection.vue b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/DatabaseChangeSection.vuenew file mode 100644index 0000000000..978e4cfc24--- /dev/null+++ b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/DatabaseChangeSection.vue@@ -0,0 +1,106 @@+<template>+ <template v-if="shouldShowSection">+ <!-- SQL Checks -->+ <div class="flex flex-col gap-y-1">+ <h3 class="textlabel">+ {{ $t("plan.navigator.checks") }}+ </h3>+ <div class="flex items-center gap-2">+ <PlanCheckStatusCount+ :plan="plan"+ clickable+ @click="selectedResultStatus = $event"+ />+ <span v-if="!hasAnyChecks" class="text-sm text-control-placeholder">+ {{ $t("plan.overview.no-checks") }}+ </span>+ </div>+ </div>++ <!-- Stages -->+ <div v-if="rollout" class="flex flex-col gap-y-1">+ <h3 class="textlabel">+ {{ $t("rollout.stage.self", 2) }}+ </h3>+ <div class="flex flex-col gap-1">+ <template v-if="rollout.stages.length > 0">+ <div+ v-for="stage in rollout.stages"+ :key="stage.name"+ class="flex items-center gap-2 cursor-pointer hover:opacity-80 transition-opacity"+ @click="navigateToStage(stage.name)"+ >+ <TaskStatus+ :status="getStageStatus(stage)"+ size="small"+ disabled+ />+ <EnvironmentV1Name+ :environment="getEnvironmentEntity(stage.environment)"+ :link="false"+ :null-environment-placeholder="'Null'"+ />+ </div>+ </template>+ <span v-else class="text-sm text-control-placeholder">+ {{ $t("common.no-data") }}+ </span>+ </div>+ </div>++ <ChecksDrawer+ v-if="selectedResultStatus"+ :status="selectedResultStatus"+ @close="selectedResultStatus = undefined"+ />+ </template>+</template>++<script setup lang="ts">+import { computed, ref } from "vue";+import { useRouter } from "vue-router";+import TaskStatus from "@/components/Rollout/kits/TaskStatus.vue";+import { EnvironmentV1Name } from "@/components/v2";+import { PROJECT_V1_ROUTE_ROLLOUT_DETAIL_STAGE_DETAIL } from "@/router/dashboard/projectV1";+import { useCurrentProjectV1, useEnvironmentV1Store } from "@/store";+import { Issue_Type } from "@/types/proto-es/v1/issue_service_pb";+import { Advice_Level } from "@/types/proto-es/v1/sql_service_pb";+import { extractProjectResourceName, getStageStatus } from "@/utils";+import { usePlanCheckStatus, usePlanContext } from "../../../logic";+import ChecksDrawer from "../../ChecksView/ChecksDrawer.vue";+import PlanCheckStatusCount from "../../PlanCheckStatusCount.vue";++const { plan, rollout, issue } = usePlanContext();+const environmentStore = useEnvironmentV1Store();+const router = useRouter();+const { project } = useCurrentProjectV1();+const { hasAnyStatus: hasAnyChecks } = usePlanCheckStatus(plan);++const selectedResultStatus = ref<Advice_Level | undefined>(undefined);++const shouldShowSection = computed(() => {+ return issue.value?.type === Issue_Type.DATABASE_CHANGE || rollout?.value;+});++const getEnvironmentEntity = (environmentName: string) => {+ return environmentStore.getEnvironmentByName(environmentName);+};++const navigateToStage = (stageName: string) => {+ if (!rollout?.value) return;++ const rolloutId = rollout.value.name.split("/").pop();+ const stageId = stageName.split("/").pop();++ if (!rolloutId || !stageId) return;++ router.push({+ name: PROJECT_V1_ROUTE_ROLLOUT_DETAIL_STAGE_DETAIL,+ params: {+ projectId: extractProjectResourceName(project.value.name),+ rolloutId,+ stageId,+ },+ });+};+</script>diff --git a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/Sidebar.vue b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/Sidebar.vueindex 9ca1d87913..b7e999b906 100644--- a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/Sidebar.vue+++ b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/Sidebar.vue@@ -10,6 +10,8 @@:disabled="!allowChange"@update:value="onIssueLabelsUpdate"/>++ <DatabaseChangeSection /></div></template>@@ -33,6 +35,7 @@ import {import { hasProjectPermissionV2 } from "@/utils";import { usePlanContextWithIssue } from "../../../logic/context";import ApprovalFlowSection from "./ApprovalFlowSection/ApprovalFlowSection.vue";+import DatabaseChangeSection from "./DatabaseChangeSection.vue";import IssueStatusSection from "./IssueStatusSection.vue";const { t } = useI18n();diff --git a/frontend/src/views/project/IssueDetailV1View.vue b/frontend/src/views/project/IssueDetailV1View.vueindex be2d6fc87f..ca4f43613e 100644--- a/frontend/src/views/project/IssueDetailV1View.vue+++ b/frontend/src/views/project/IssueDetailV1View.vue@@ -11,9 +11,6 @@<!-- Grant Request View --><GrantRequestView v-else-if="issueType === IssueType.GRANT_REQUEST" />-- <!-- CI/CD View (default) -->- <DatabaseChangeView v-else /></IssueBaseLayout></template>@@ -22,7 +19,6 @@ import { computed, onMounted, ref } from "vue";import { useRoute, useRouter } from "vue-router";import { BBSpin } from "@/bbkit";import { usePlanContextWithIssue } from "@/components/Plan";-import DatabaseChangeView from "@/components/Plan/components/IssueReviewView/DatabaseChangeView.vue";import DatabaseCreateView from "@/components/Plan/components/IssueReviewView/DatabaseCreateView.vue";import DatabaseExportView from "@/components/Plan/components/IssueReviewView/DatabaseExportView.vue";import GrantRequestView from "@/components/Plan/components/IssueReviewView/GrantRequestView.vue";@@ -34,7 +30,6 @@ import { issueV1Slug } from "@/utils";enum IssueType {CREATE_DATABASE = "CREATE_DATABASE",- CHANGE_DATABASE = "CHANGE_DATABASE",EXPORT_DATA = "EXPORT_DATA",GRANT_REQUEST = "GRANT_REQUEST",}@@ -67,7 +62,7 @@ const issueType = computed(() => {) {return IssueType.EXPORT_DATA;}- return IssueType.CHANGE_DATABASE;+ return undefined;});onMounted(() => {