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): simplify rollout creation flow (#18707)
boojacke264d73698e9
diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vueindex 4cb906cc31..d9deab5547 100644--- a/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue@@ -134,11 +134,6 @@ const globalDisabledReason = computed(() => {const pendingRolloutAction = ref<RolloutAction | undefined>(undefined);const showRolloutCreatePanel = ref(false);-// Helper to check if rollout creation has warnings-const hasRolloutCreationWarnings = computed(- () => context.value.rolloutCreationWarnings.hasAny-);-// Get the first stage for database creation/export rollouts// (the panel handles all stages internally for these task types)const rolloutStage = computed(() => rollout.value?.stages[0]);@@ -157,12 +152,7 @@ const handlePerformAction = async (action: UnifiedAction) => {await handlePlanStateChange("PLAN_REOPEN");break;case "ROLLOUT_CREATE":- // Show panel if there are warnings; otherwise create immediately- if (hasRolloutCreationWarnings.value) {- showRolloutCreatePanel.value = true;- } else {- await handleCreateRollout();- }+ showRolloutCreatePanel.value = true;break;case "ROLLOUT_START":// For deferred rollout plans without rollout, create and run all tasksdiff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/create/RolloutCreatePanel.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/create/RolloutCreatePanel.vueindex 529bf0d4e8..b79bc24a98 100644--- a/frontend/src/components/Plan/components/HeaderSection/Actions/create/RolloutCreatePanel.vue+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/create/RolloutCreatePanel.vue@@ -3,34 +3,33 @@:show="show":title="$t('issue.create-rollout')":loading="loading"- @show="resetState"+ @show="bypassWarnings = false"@close="$emit('close')"><template #default><div class="flex flex-col gap-y-4 h-full px-1">- <!-- Warning alert with messages -->+ <!-- Error alert (blocking) -->+ <NAlert v-if="errorMessages.length > 0" type="error" :title="$t('common.error')">+ <ul class="list-disc list-inside text-sm">+ <li v-for="msg in errorMessages" :key="msg">{{ msg }}</li>+ </ul>+ </NAlert>++ <!-- Warning alert (bypassable) --><NAlert- v-if="warningMessages.length > 0"+ v-else-if="warningMessages.length > 0"type="warning":title="$t('common.notices')">- <ul class="list-disc list-inside flex flex-col gap-y-1">- <li- v-for="(warning, index) in warningMessages"- :key="index"- class="text-sm"- >- {{ warning }}- </li>+ <ul class="list-disc list-inside text-sm">+ <li v-for="msg in warningMessages" :key="msg">{{ msg }}</li></ul></NAlert>- <!-- Approval Flow Section --><ApprovalFlowSection v-if="issue" :issue="issue" />- <!-- Plan Check Status --><div class="w-full flex flex-col gap-2">- <span class="font-medium text-control shrink-0">{{+ <span class="font-medium text-control">{{$t("plan.navigator.checks")}}</span><PlanCheckStatusCount :plan="plan" />@@ -38,27 +37,27 @@</div></template><template #footer>- <div class="w-full flex flex-row justify-between items-center gap-x-2">- <!-- Bypass checkbox -->- <div v-if="hasWarnings" class="flex items-center">- <NCheckbox v-model:checked="bypassWarnings" :disabled="loading">- {{ $t("rollout.bypass-stage-requirements") }}- </NCheckbox>- </div>+ <div class="w-full flex justify-between items-center gap-x-2">+ <NCheckbox+ v-if="warningMessages.length > 0 && errorMessages.length === 0"+ v-model:checked="bypassWarnings"+ :disabled="loading"+ >+ {{ $t("rollout.bypass-stage-requirements") }}+ </NCheckbox><div v-else />- <div class="flex justify-end gap-x-2">+ <div class="flex gap-x-2"><NButton quaternary @click="$emit('close')">- {{ $t("common.close") }}+ {{ $t("common.cancel") }}</NButton>-<NButton- :disabled="hasWarnings && !bypassWarnings"type="primary"+ :disabled="errorMessages.length > 0 || (warningMessages.length > 0 && !bypassWarnings)":loading="loading"@click="handleConfirm">- {{ $t("issue.create-rollout") }}+ {{ $t("common.confirm") }}</NButton></div></div>@@ -100,58 +99,69 @@ const { t } = useI18n();const router = useRouter();const { events } = usePlanContext();-// Use context from props for consistencyconst plan = computed(() => props.context.plan);const issue = computed(() => props.context.issue);const project = computed(() => props.context.project);-const warnings = computed(() => props.context.rolloutCreationWarnings);const loading = ref(false);const bypassWarnings = ref(false);-// Build warning messages based on current state-const warningMessages = computed(() => {- const messages: string[] = [];-- if (warnings.value.approvalNotReady) {- messages.push(+// Errors: require_*=true and condition not met (blocking)+const errorMessages = computed(() => {+ const msgs: string[] = [];+ if (project.value.requireIssueApproval && !props.context.issueApproved) {+ msgs.push(t("project.settings.issue-related.require-issue-approval.description"));}+ if (+ project.value.requirePlanCheckNoError &&+ props.context.validation.planChecksFailed+ ) {+ msgs.push(+ t(+ "project.settings.issue-related.require-plan-check-no-error.description"+ )+ );+ }+ return msgs;+});- if (warnings.value.planChecksRunning) {- messages.push(+// Warnings: require_*=false and condition not met (bypassable)+const warningMessages = computed(() => {+ const msgs: string[] = [];+ if (!project.value.requireIssueApproval && !props.context.issueApproved) {+ msgs.push(+ t("project.settings.issue-related.require-issue-approval.description")+ );+ }+ if (props.context.validation.planChecksRunning) {+ msgs.push(t("custom-approval.issue-review.disallow-approve-reason.some-task-checks-are-still-running"));- } else if (warnings.value.planChecksFailed) {- messages.push(+ } else if (+ !project.value.requirePlanCheckNoError &&+ props.context.validation.planChecksFailed+ ) {+ msgs.push(t("project.settings.issue-related.require-plan-check-no-error.description"));}-- return messages;+ return msgs;});-const hasWarnings = computed(() => warnings.value.hasAny);--const resetState = () => {- bypassWarnings.value = false;-};-const handleConfirm = async () => {if (loading.value) return;-loading.value = true;+try {- const request = create(CreateRolloutRequestSchema, {- parent: plan.value.name,- });- const createdRollout =- await rolloutServiceClientConnect.createRollout(request);+ const createdRollout = await rolloutServiceClientConnect.createRollout(+ create(CreateRolloutRequestSchema, { parent: plan.value.name })+ );pushNotification({module: "bytebase",diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/registry/actions/rollout.ts b/frontend/src/components/Plan/components/HeaderSection/Actions/registry/actions/rollout.tsindex cca8cd2781..8564a4fc53 100644--- a/frontend/src/components/Plan/components/HeaderSection/Actions/registry/actions/rollout.ts+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/registry/actions/rollout.ts@@ -5,9 +5,7 @@ export const ROLLOUT_CREATE: ActionDefinition = {id: "ROLLOUT_CREATE",label: () => t("issue.create-rollout"),buttonType: "default",- // Primary when ready, secondary (dropdown) when warnings exist- category: (ctx) =>- ctx.rolloutCreationWarnings.hasAny ? "secondary" : "primary",+ category: "primary",priority: 55,isVisible: (ctx) => {@@ -18,11 +16,7 @@ export const ROLLOUT_CREATE: ActionDefinition = {if (!ctx.issue) return false;if (!ctx.permissions.createRollout) return false;- // Hide when require_*=true and condition not met- if (!ctx.issueApproved && ctx.project.requireIssueApproval) return false;- if (ctx.validation.planChecksFailed && ctx.project.requirePlanCheckNoError)- return false;-+ // Project setting validations are handled in RolloutCreatePanelreturn true;},diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/registry/context.ts b/frontend/src/components/Plan/components/HeaderSection/Actions/registry/context.tsindex 8402fa2f9b..65ddeaac31 100644--- a/frontend/src/components/Plan/components/HeaderSection/Actions/registry/context.ts+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/registry/context.ts@@ -221,22 +221,6 @@ export function buildActionContext(input: ContextBuilderInput): ActionContext {issue?.approvalStatus === Issue_ApprovalStatus.APPROVED ||issue?.approvalStatus === Issue_ApprovalStatus.SKIPPED;- // Compute rollout creation warnings- // These flags indicate when ROLLOUT_CREATE should show in dropdown with warnings- // Warnings only apply when require_*=false; when require_*=true, button is hidden instead- const warnApprovalNotReady = !project.requireIssueApproval && !issueApproved;- const warnPlanChecksRunning = hasRunningPlanChecks;- const warnPlanChecksFailed =- !project.requirePlanCheckNoError && planCheckStatus === Advice_Level.ERROR;-- const rolloutCreationWarnings = {- approvalNotReady: warnApprovalNotReady,- planChecksRunning: warnPlanChecksRunning,- planChecksFailed: warnPlanChecksFailed,- hasAny:- warnApprovalNotReady || warnPlanChecksRunning || warnPlanChecksFailed,- };-return {plan,issue,@@ -263,7 +247,6 @@ export function buildActionContext(input: ContextBuilderInput): ActionContext {hasDatabaseCreateOrExportTasks,hasStartableTasks,hasRunningTasks,- rolloutCreationWarnings,permissions,validation,diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/registry/types.ts b/frontend/src/components/Plan/components/HeaderSection/Actions/registry/types.tsindex ef6a2cd162..5015f2fc05 100644--- a/frontend/src/components/Plan/components/HeaderSection/Actions/registry/types.ts+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/registry/types.ts@@ -88,15 +88,6 @@ export interface ActionContext {hasStartableTasks: boolean;hasRunningTasks: boolean;- // Warning flags for rollout creation (button moves to dropdown when hasAny=true)- // Note: When require_*=true and condition not met, button is HIDDEN (not a warning)- rolloutCreationWarnings: {- approvalNotReady: boolean; // require_issue_approval=false AND not approved- planChecksRunning: boolean; // plan checks currently running- planChecksFailed: boolean; // require_plan_check_no_error=false AND checks failed- hasAny: boolean; // convenience: true if any warning is active- };-// Groupedpermissions: ActionPermissions;validation: ActionValidation;diff --git a/frontend/src/components/Plan/components/IssueReviewView/DatabaseExportView/OptionsSection.vue b/frontend/src/components/Plan/components/IssueReviewView/DatabaseExportView/OptionsSection.vueindex f42b0e43a6..8f30df3c0c 100644--- a/frontend/src/components/Plan/components/IssueReviewView/DatabaseExportView/OptionsSection.vue+++ b/frontend/src/components/Plan/components/IssueReviewView/DatabaseExportView/OptionsSection.vue@@ -47,7 +47,7 @@<script lang="ts" setup>import { create } from "@bufbuild/protobuf";-import { cloneDeep, includes } from "lodash-es";+import { cloneDeep } from "lodash-es";import { NButton } from "naive-ui";import { computed, reactive, watchEffect } from "vue";import { useI18n } from "vue-i18n";@@ -55,13 +55,12 @@ import { planServiceClientConnect } from "@/grpcweb";import { pushNotification } from "@/store";import type { Plan_ExportDataConfig } from "@/types/proto-es/v1/plan_service_pb";import { UpdatePlanRequestSchema } from "@/types/proto-es/v1/plan_service_pb";-import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";import { usePlanContext } from "../../../logic";import ExportFormatSelector from "../../ExportOption/ExportFormatSelector.vue";import ExportPasswordInputer from "../../ExportOption/ExportPasswordInputer.vue";const { t } = useI18n();-const { plan, rollout, readonly, isCreating } = usePlanContext();+const { plan, readonly, isCreating } = usePlanContext();// Get export config from plan contextconst exportDataConfig = computed(() => {@@ -106,34 +105,8 @@ const shouldShowEditButton = computed(() => {if (state.isEditing) {return false;}-- // Check if any export tasks are running or completed- if (plan.value.hasRollout && rollout?.value) {- const exportDataSpec = plan.value.specs.find(- (spec) => spec.config?.case === "exportDataConfig"- );-- if (exportDataSpec) {- const tasks = rollout.value.stages- .flatMap((stage) => stage.tasks)- .filter((task) => task.specId === exportDataSpec.id);-- if (- tasks.some((task) =>- includes(- [- Task_Status.RUNNING,- Task_Status.PENDING,- Task_Status.DONE,- Task_Status.SKIPPED,- ],- task.status- )- )- ) {- return false;- }- }+ if (plan.value.hasRollout) {+ return false;}return true;});