Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: remove step section in plan detail page (#14445)
boojackb9d2e0b5a073
diff --git a/frontend/src/components/Plan/PlanDetailPage.vue b/frontend/src/components/Plan/PlanDetailPage.vueindex 06a31ebed1..56e013f845 100644--- a/frontend/src/components/Plan/PlanDetailPage.vue+++ b/frontend/src/components/Plan/PlanDetailPage.vue@@ -7,7 +7,6 @@<divclass="flex-1 flex flex-col hide-scrollbar divide-y overflow-x-hidden">- <StepSection /><SpecListSection /><SQLCheckSection v-if="isCreating" @update:advices="advices = $event" />@@ -21,12 +20,8 @@</template><script setup lang="ts">-import { onMounted, ref } from "vue";-import { useRouter } from "vue-router";-import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";-import { Issue } from "@/types/proto/v1/issue_service";+import { ref } from "vue";import type { Advice } from "@/types/proto/v1/sql_service";-import { extractProjectResourceName, issueV1Slug } from "@/utils";import { provideSQLCheckContext } from "../SQLCheck";import {HeaderSection,@@ -34,35 +29,14 @@ import {StatementSection,DescriptionSection,SQLCheckSection,- StepSection,SpecListSection,} from "./components";import { usePlanContext, usePollPlan } from "./logic";-const router = useRouter();-const { isCreating, plan } = usePlanContext();+const { isCreating } = usePlanContext();const advices = ref<Advice[]>();usePollPlan();provideSQLCheckContext();--onMounted(() => {- if (!plan.value.issue) {- return;- }-- router.replace({- name: PROJECT_V1_ROUTE_ISSUE_DETAIL,- params: {- projectId: extractProjectResourceName(plan.value.project),- issueSlug: issueV1Slug(- Issue.fromPartial({- title: plan.value.title,- name: plan.value.issue,- })- ),- },- });-});</script>diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateButton.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateButton.vueindex afaa46125d..0cc50dc360 100644--- a/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateButton.vue+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateButton.vue@@ -122,11 +122,9 @@ const doCreatePlan = async () => {// Create sheets for spec configs and update their resource names.const createSheets = async () => {- const steps = plan.value.steps ?? [];- const flattenSpecList = steps.flatMap((step) => {+ const flattenSpecList = plan.value.steps.flatMap((step) => {return step.specs;});-const configWithSheetList: Plan_ChangeDatabaseConfig[] = [];const pendingCreateSheetMap = new Map<string, Sheet>();diff --git a/frontend/src/components/Plan/components/SpecListSection/SpecListSection.vue b/frontend/src/components/Plan/components/SpecListSection/SpecListSection.vueindex 9ccda6af2c..66ffb955e1 100644--- a/frontend/src/components/Plan/components/SpecListSection/SpecListSection.vue+++ b/frontend/src/components/Plan/components/SpecListSection/SpecListSection.vue@@ -1,8 +1,8 @@<template>- <div v-if="shouldShowSpecBar" class="relative py-2">+ <div class="w-full relative"><divref="specBar"- class="spec-list gap-2 px-4 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 3xl:grid-cols-5 4xl:grid-cols-6 overflow-y-auto"+ class="spec-list w-full gap-2 px-4 py-2 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5 4xl:grid-cols-6 overflow-y-auto":class="{'more-bottom': specBarScrollState.bottom,'more-top': specBarScrollState.top,@@ -24,7 +24,7 @@ import SpecCard from "./SpecCard.vue";const MAX_LIST_HEIGHT = 207;-const { plan, selectedSpec, selectedStep } = usePlanContext();+const { plan, selectedSpec } = usePlanContext();const specBar = ref<HTMLDivElement>();const specBarScrollState = useVerticalScrollState(specBar, MAX_LIST_HEIGHT);@@ -33,11 +33,6 @@ const specList = computed(plan.value.steps.find((step) => step.specs.includes(selectedSpec.value))?.specs || []);--// Show the spec bar when some of the steps have more than one specs.-const shouldShowSpecBar = computed(() => {- return selectedStep.value && selectedStep.value.specs.length > 0;-});</script><style scoped lang="postcss">diff --git a/frontend/src/components/Plan/components/StatementSection/EditorView/EditorView.vue b/frontend/src/components/Plan/components/StatementSection/EditorView/EditorView.vueindex 766acd12f8..eac8157b9a 100644--- a/frontend/src/components/Plan/components/StatementSection/EditorView/EditorView.vue+++ b/frontend/src/components/Plan/components/StatementSection/EditorView/EditorView.vue@@ -192,7 +192,7 @@<script setup lang="ts">import { useElementSize } from "@vueuse/core";-import { cloneDeep, head, uniq } from "lodash-es";+import { cloneDeep, head } from "lodash-es";import { ExpandIcon } from "lucide-vue-next";import { NButton, NTooltip, useDialog } from "naive-ui";import { v1 as uuidv1 } from "uuid";@@ -208,7 +208,6 @@ import {databaseEngineForSpec,databaseForSpec,isGroupingChangeSpec,- sheetNameForSpec,} from "@/components/Plan/logic";import { usePlanContext } from "@/components/Plan/logic";import DownloadSheetButton from "@/components/Sheet/DownloadSheetButton.vue";@@ -369,52 +368,21 @@ const cancelEdit = () => {};const chooseUpdateStatementTarget = () => {- type Target = "CANCELED" | "SPEC" | "STEP" | "ALL";+ type Target = "CANCELED" | "SPEC" | "ALL";const d = defer<{ target: Target; specs: Plan_Spec[] }>();const targets: Record<Target, Plan_Spec[]> = {CANCELED: [],SPEC: [selectedSpec.value],- STEP:- plan.value.steps.find((step) => step.specs.includes(selectedSpec.value))- ?.specs || [],ALL: flattenSpecList(plan.value),};- if (targets.STEP.length === 1 && targets.ALL.length === 1) {+ // If there is only one spec, we don't need to ask the user to choose.+ if (targets.ALL.length === 1) {d.resolve({ target: "SPEC", specs: targets.SPEC });return d.promise;}- const distinctSheetIds = uniq(- targets.ALL.map((spec) => sheetNameForSpec(spec))- );- // For new multiple-database issues, one sheet is shared among multiple tasks- // So we should notice that the change will be applied to all tasks- if (distinctSheetIds.length === 1 && targets.ALL.length > 1) {- dialog.info({- title: t("issue.update-statement.self", { type: statementTitle.value }),- content: t(- "issue.update-statement.current-change-will-apply-to-all-tasks"- ),- type: "info",- autoFocus: false,- closable: false,- maskClosable: false,- closeOnEsc: false,- showIcon: false,- positiveText: t("common.confirm"),- negativeText: t("common.cancel"),- onPositiveClick: () => {- d.resolve({ target: "ALL", specs: targets.ALL });- },- onNegativeClick: () => {- d.resolve({ target: "CANCELED", specs: [] });- },- });- return d.promise;- }-const $d = dialog.create({title: t("issue.update-statement.self", { type: statementTitle.value }),content: t("issue.update-statement.apply-current-change-to"),@@ -437,47 +405,27 @@ const chooseUpdateStatementTarget = () => {default: () => t("common.cancel"),});+ const SPEC = h(+ NButton,+ { size: "small", onClick: () => finish("SPEC") },+ {+ default: () => t("issue.update-statement.target.selected-task"),+ }+ );+ const ALL = h(+ NButton,+ { size: "small", onClick: () => finish("ALL") },+ {+ default: () => t("issue.update-statement.target.all-tasks"),+ }+ );const buttons = [CANCEL];- // For database group change spec, don't show the option to select the spec.+ // For no grouping change spec, we can choose to update the current spec.if (!isGroupingChangeSpec(selectedSpec.value)) {- const SPEC = h(- NButton,- { size: "small", onClick: () => finish("SPEC") },- {- default: () => t("issue.update-statement.target.selected-task"),- }- );buttons.push(SPEC);-- if (targets.STEP.length > 1) {- // More than one editable specs in step- // Add "Selected step" option- const STEP = h(- NButton,- { size: "small", onClick: () => finish("STEP") },- {- default: () => t("issue.update-statement.target.selected-stage"),- }- );- buttons.push(STEP);- }- }- if (- isGroupingChangeSpec(selectedSpec.value) ||- targets.ALL.length > targets.STEP.length- ) {- // More editable specs in other steps- // Add "All specs" option- const ALL = h(- NButton,- { size: "small", onClick: () => finish("ALL") },- {- default: () => t("issue.update-statement.target.all-tasks"),- }- );- buttons.push(ALL);}+ buttons.push(ALL);return h("div",@@ -596,9 +544,7 @@ const updateStatement = async (statement: string) => {});Object.assign(plan.value, updatedPlan);-events.emit("status-changed", { eager: true });-pushNotification({module: "bytebase",style: "SUCCESS",diff --git a/frontend/src/components/Plan/components/StepSection/StepCard.vue b/frontend/src/components/Plan/components/StepSection/StepCard.vuedeleted file mode 100644index ce2393d589..0000000000--- a/frontend/src/components/Plan/components/StepSection/StepCard.vue+++ /dev/null@@ -1,123 +0,0 @@-<template>- <div class="step" :class="stepClass">- <ArrowRightIcon v-if="isSelectedStep" class="w-5 h-5 mr-1 inline-block" />- <NTooltip- v-if="isCreating && !validateSpecs()"- trigger="hover"- placement="top"- >- <template #trigger>- <heroicons:exclamation-circle-solid- class="w-6 h-6 mx-1 text-error hover:text-error-hover"- />- </template>- <span>{{ $t("issue.missing-sql-statement") }}</span>- </NTooltip>- <NTooltip- v-if="- !isCreating &&- (planCheckStatus === PlanCheckRun_Result_Status.ERROR ||- planCheckStatus === PlanCheckRun_Result_Status.WARNING)- "- trigger="hover"- placement="top"- >- <template #trigger>- <heroicons:exclamation-circle-solid- class="w-6 h-6 mx-1"- :class="[- planCheckStatus === PlanCheckRun_Result_Status.ERROR- ? 'text-error hover:text-error-hover'- : 'text-warning hover:text-warning-hover',- ]"- />- </template>- <span>{{- $t(- "custom-approval.issue-review.disallow-approve-reason.some-task-checks-didnt-pass"- )- }}</span>- </NTooltip>- <div class="text" @click="handleClickStep">- <div class="text-sm min-w-32 lg:min-w-fit space-x-1 whitespace-nowrap">- <span>{{ step.title }} {{ $t("common.stage") }}</span>- </div>- </div>- </div>-</template>--<script lang="ts" setup>-import { head, isEqual, uniqBy } from "lodash-es";-import { ArrowRightIcon } from "lucide-vue-next";-import { NTooltip } from "naive-ui";-import { computed } from "vue";-import {- isValidSpec,- planCheckRunListForSpec,- usePlanContext,-} from "@/components/Plan/logic";-import { planCheckRunSummaryForCheckRunList } from "@/components/PlanCheckRun/common";-import type { Plan_Step } from "@/types/proto/v1/plan_service";-import { PlanCheckRun_Result_Status } from "@/types/proto/v1/plan_service";--const props = defineProps<{- step: Plan_Step;-}>();--const { isCreating, plan, selectedStep, events } = usePlanContext();--const isSelectedStep = computed(() => {- return isEqual(props.step, selectedStep.value);-});--const stepClass = computed(() => {- const classList: string[] = [];- if (isSelectedStep.value) classList.push("selected");- return classList;-});--const validateSpecs = () => {- return props.step.specs.every((spec) => isValidSpec(spec));-};--const planCheckStatus = computed((): PlanCheckRun_Result_Status => {- if (isCreating.value) return PlanCheckRun_Result_Status.UNRECOGNIZED;- const planCheckList = uniqBy(- props.step.specs.flatMap((spec) =>- planCheckRunListForSpec(plan.value, spec)- ),- (checkRun) => checkRun.name- );- const summary = planCheckRunSummaryForCheckRunList(planCheckList);- if (summary.errorCount > 0) {- return PlanCheckRun_Result_Status.ERROR;- }- if (summary.warnCount > 0) {- return PlanCheckRun_Result_Status.WARNING;- }- return PlanCheckRun_Result_Status.SUCCESS;-});--const handleClickStep = () => {- if (isSelectedStep.value) return;-- const spec = head(props.step.specs);- if (!spec) {- return;- }- events.emit("select-spec", { spec });-};-</script>--<style scoped lang="postcss">-.step {- @apply cursor-default flex items-center justify-start w-full text-sm relative;- @apply lg:flex-1;-}-.step .text {- @apply cursor-pointer flex-1 flex flex-col text-gray-600 font-normal;-}-.step.selected .text {- @apply font-bold text-accent underline;-}-</style>diff --git a/frontend/src/components/Plan/components/StepSection/StepSection.vue b/frontend/src/components/Plan/components/StepSection/StepSection.vuedeleted file mode 100644index 55ea9e9d3a..0000000000--- a/frontend/src/components/Plan/components/StepSection/StepSection.vue+++ /dev/null@@ -1,63 +0,0 @@-<template>- <div v-if="show" class="w-full flex flex-col divide-y">- <template v-if="stepList.length > 0">- <div class="px-0">- <NScrollbar :x-scrollable="true" class="max-h-[180px] sm:max-h-max">- <div- class="flex flex-col sm:flex-row justify-between divide-y sm:divide-y-0"- >- <template- v-for="(step, index) in stepList"- :key="`${index}-${step.title}`"- >- <StepCard- :step="step"- :index="index"- class="px-2 sm:px-0 h-10"- :class="[- index === 0 && 'sm:pl-4',- index === stepList.length - 1 && 'sm:pr-4',- ]"- />- <div- v-if="index < stepList.length - 1"- class="hidden h-10 sm:block w-3.5 mr-2 pointer-events-none shrink-0"- aria-hidden="true"- >- <svg- class="h-full w-full text-gray-300"- viewBox="0 0 22 80"- fill="none"- preserveAspectRatio="none"- >- <path- d="M0 -2L20 40L0 82"- vector-effect="non-scaling-stroke"- stroke="currentcolor"- stroke-linejoin="round"- />- </svg>- </div>- </template>- </div>- </NScrollbar>- </div>- </template>- </div>-</template>--<script lang="ts" setup>-import { NScrollbar } from "naive-ui";-import { computed } from "vue";-import { isDatabaseChangeSpec, usePlanContext } from "@/components/Plan/logic";-import StepCard from "./StepCard.vue";--const { plan, selectedSpec } = usePlanContext();--// Only show steps when the selected spec is related with database changes.-const show = computed(() => isDatabaseChangeSpec(selectedSpec.value));--const stepList = computed(() => {- return plan.value.steps || [];-});-</script>diff --git a/frontend/src/components/Plan/components/StepSection/index.ts b/frontend/src/components/Plan/components/StepSection/index.tsdeleted file mode 100644index 52c2289789..0000000000--- a/frontend/src/components/Plan/components/StepSection/index.ts+++ /dev/null@@ -1,3 +0,0 @@-import StepSection from "./StepSection.vue";--export default StepSection;diff --git a/frontend/src/components/Plan/components/index.ts b/frontend/src/components/Plan/components/index.tsindex 3ec69243fe..85f9404392 100644--- a/frontend/src/components/Plan/components/index.ts+++ b/frontend/src/components/Plan/components/index.ts@@ -4,11 +4,9 @@ import PlanCheckSection from "./PlanCheckSection";import SQLCheckSection from "./SQLCheckSection";import SpecListSection from "./SpecListSection";import StatementSection from "./StatementSection";-import StepSection from "./StepSection";export {HeaderSection,- StepSection,SpecListSection,PlanCheckSection,StatementSection,diff --git a/frontend/src/components/Plan/logic/base.ts b/frontend/src/components/Plan/logic/base.tsindex 07c716072e..9be11abf4b 100644--- a/frontend/src/components/Plan/logic/base.ts+++ b/frontend/src/components/Plan/logic/base.ts@@ -5,11 +5,10 @@ import { computed } from "vue";import { useRoute, useRouter } from "vue-router";import { PROJECT_V1_ROUTE_PLAN_DETAIL } from "@/router/dashboard/projectV1";import { useUIStateStore } from "@/store";-import type { Plan_Spec, Plan_Step } from "@/types/proto/v1/plan_service";-import { emptyPlanSpec, emptyPlanStep } from "@/types/v1/issue/plan";+import type { Plan_Spec } from "@/types/proto/v1/plan_service";+import { emptyPlanSpec } from "@/types/v1/issue/plan";import { flattenSpecList } from "@/utils";import type { PlanContext, PlanEvents } from "./context";-import { stepForSpec } from "./utils";export const useBasePlanContext = (context: Pick<PlanContext, "isCreating" | "ready" | "plan">@@ -38,19 +37,12 @@ export const useBasePlanContext = (return first(specs.value) || emptyPlanSpec();});- const selectedStep = computed((): Plan_Step => {- return stepForSpec(plan.value, selectedSpec.value) || emptyPlanStep();- });-const formatOnSave = computed({get: () => uiStateStore.editorFormatStatementOnSave,set: (value: boolean) => uiStateStore.setEditorFormatStatementOnSave(value),});events.on("select-spec", ({ spec }) => {- const step = stepForSpec(plan.value, spec);- if (!step) return;-router.replace({name: PROJECT_V1_ROUTE_PLAN_DETAIL,query: {@@ -64,7 +56,6 @@ export const useBasePlanContext = (return {events,selectedSpec,- selectedStep,formatOnSave,dialog,};diff --git a/frontend/src/components/Plan/logic/context.ts b/frontend/src/components/Plan/logic/context.tsindex 0a67c1dc93..fad505c700 100644--- a/frontend/src/components/Plan/logic/context.ts+++ b/frontend/src/components/Plan/logic/context.ts@@ -3,7 +3,7 @@ import type { useDialog } from "naive-ui";import { v4 as uuidv4 } from "uuid";import type { InjectionKey, Ref } from "vue";import { inject, provide } from "vue";-import type { Plan_Spec, Plan_Step } from "@/types/proto/v1/plan_service";+import type { Plan_Spec } from "@/types/proto/v1/plan_service";import type { ComposedPlan } from "@/types/v1/issue/plan";export type PlanEvents = Emittery<{@@ -17,7 +17,6 @@ export type PlanContext = {ready: Ref<boolean>;plan: Ref<ComposedPlan>;- selectedStep: Ref<Plan_Step>;selectedSpec: Ref<Plan_Spec>;formatOnSave: Ref<boolean>;diff --git a/frontend/src/components/Plan/logic/utils.ts b/frontend/src/components/Plan/logic/utils.tsdeleted file mode 100644index 194cdf6e9f..0000000000--- a/frontend/src/components/Plan/logic/utils.ts+++ /dev/null@@ -1,6 +0,0 @@-import type { Plan_Spec } from "@/types/proto/v1/plan_service";-import type { ComposedPlan } from "@/types/v1/issue/plan";--export const stepForSpec = (plan: ComposedPlan, spec: Plan_Spec) => {- return plan.steps.find((step) => step.specs.find((s) => s.id === spec.id));-};