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: consolidate plan actions and remove unified directory (#18693)
boojack532a12ae6eb6
diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/ACTIONS.md b/frontend/src/components/Plan/components/HeaderSection/Actions/ACTIONS.mdindex f308869f11..09d8894ae8 100644--- a/frontend/src/components/Plan/components/HeaderSection/Actions/ACTIONS.md+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/ACTIONS.md@@ -17,13 +17,11 @@ Actions/│ ├── actions/│ │ ├── plan.ts # PLAN_CLOSE, PLAN_REOPEN│ │ ├── issue.ts # ISSUE_CREATE, ISSUE_REVIEW, ISSUE_STATUS_*-│ │ └── rollout.ts # ROLLOUT_CREATE, ROLLOUT_START, ROLLOUT_CANCEL+│ │ └── rollout.ts # ROLLOUT_CREATE, ROLLOUT_START, ROLLOUT_CANCEL, EXPORT_DOWNLOAD│ └── components/│ ├── ActionButton.vue # Single action button-│ └── ActionDropdown.vue # Secondary actions dropdown-├── unified/ # Legacy components (compatibility layer)-│ ├── UnifiedActionGroup.vue # Button group with dropdown-│ └── IssueReviewButton.vue # Special review popover+│ ├── ActionDropdown.vue # Secondary actions dropdown+│ └── IssueReviewButton.vue # Review popover with approve/reject/comment└── Actions.vue # Main orchestrator```@@ -31,10 +29,14 @@ Actions/**ActionContext**: Single reactive object containing all state needed for action decisions:- Entities: plan, issue, rollout, project-- Derived flags: isIssueOnly, isExportPlan, isCreator+- Derived flags: isIssueOnly, isExportPlan, hasDeferredRollout, isCreator- Permissions: updatePlan, createIssue, updateIssue, createRollout, runTasks- Validation: hasEmptySpec, planChecksRunning, planChecksFailed+**hasDeferredRollout**: Plans where rollout is created on-demand (export, create database). For these plans:+- ROLLOUT_CREATE is hidden; ROLLOUT_START creates rollout and runs tasks in one step+- ISSUE_STATUS_RESOLVE is hidden (issues auto-resolve when task completes)+**ActionDefinition**: Declarative action with pure functions:```typescriptinterface ActionDefinition {@@ -125,6 +127,8 @@ interface ActionDefinition {- Issue exists and is OPEN- Issue approval status is APPROVED or SKIPPED- All tasks in the rollout are finished (DONE or SKIPPED)+- Rollout exists (`plan.hasRollout`)+- Not a deferred rollout plan (export/create database plans auto-resolve when task completes)- User has `bb.issues.update` permission---@@ -144,10 +148,10 @@ interface ActionDefinition {#### `ISSUE_STATUS_REOPEN` (Primary, Priority: 20)**Label**: "Reopen"-**Description**: Reopens a closed or resolved issue.+**Description**: Reopens a canceled issue.**Visibility**:-- Issue exists and is CANCELED or DONE+- Issue exists and is CANCELED (not DONE - resolved issues cannot be reopened)- User has `bb.issues.update` permission---@@ -160,6 +164,8 @@ interface ActionDefinition {**Description**: Creates a rollout from the issue. Shows as primary action when ready, moves to dropdown when conditions aren't met.**Visibility**:+- Not a deferred rollout plan (export/create database plans use ROLLOUT_START instead)+- Not an issue-only plan- Plan has no rollout attached- Issue exists- User has `bb.rollouts.create` permission@@ -184,9 +190,15 @@ When warnings exist, user must check "Bypass stage requirements" checkbox to pro- "Export" (for export data issues)- "Rollout" (for other issues)-**Description**: Starts or retries tasks in the rollout.+**Description**: Starts or retries tasks in the rollout. For deferred rollout plans (export/create database), this action creates the rollout and runs all tasks in one step.**Visibility**:+For deferred rollout plans (export/create database):+- Issue exists and is APPROVED or SKIPPED+- No rollout yet (will create it) OR has startable tasks+- User has `bb.taskRuns.create` permission++For regular plans:- Rollout exists- Issue approval status is APPROVED or SKIPPED- Has DATABASE_CREATE or DATABASE_EXPORT tasks@@ -330,6 +342,5 @@ export const MY_NEW_ACTION: ActionDefinition = {## Implementation Files-- **registry/**: Action registry (source of truth)+- **registry/**: Action registry (source of truth for all actions and components)- **Actions.vue**: Main orchestrator-- **unified/**: Legacy components (compatibility layer)diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vueindex 3026382c81..4cb906cc31 100644--- a/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue@@ -88,13 +88,17 @@ import {import { CreateButton, CreateIssueButton, RolloutCreatePanel } from "./create";import { ExportArchiveDownloadAction } from "./export";import RolloutReadyLink from "./RolloutReadyLink.vue";-import { ActionButton, ActionDropdown, useActionRegistry } from "./registry";+import {+ ActionButton,+ ActionDropdown,+ IssueReviewButton,+ useActionRegistry,+} from "./registry";import type {IssueStatusAction,RolloutAction,UnifiedAction,} from "./registry/types";-import { IssueReviewButton } from "./unified";const { t } = useI18n();const router = useRouter();diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/registry/actions/issue.ts b/frontend/src/components/Plan/components/HeaderSection/Actions/registry/actions/issue.tsindex ded4e18ab5..0d4b75a8c7 100644--- a/frontend/src/components/Plan/components/HeaderSection/Actions/registry/actions/issue.ts+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/registry/actions/issue.ts@@ -115,10 +115,9 @@ export const ISSUE_STATUS_REOPEN: ActionDefinition = {category: "primary",priority: 20,+ // Only show reopen for canceled issues, not for done/resolved issuesisVisible: (ctx) =>- (ctx.issueStatus === IssueStatus.CANCELED ||- ctx.issueStatus === IssueStatus.DONE) &&- ctx.permissions.updateIssue,+ ctx.issueStatus === IssueStatus.CANCELED && ctx.permissions.updateIssue,isDisabled: () => false,disabledReason: () => undefined,diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/unified/IssueReviewButton.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/registry/components/IssueReviewButton.vuesimilarity index 100%rename from frontend/src/components/Plan/components/HeaderSection/Actions/unified/IssueReviewButton.vuerename to frontend/src/components/Plan/components/HeaderSection/Actions/registry/components/IssueReviewButton.vuediff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/registry/components/index.ts b/frontend/src/components/Plan/components/HeaderSection/Actions/registry/components/index.tsindex 3a7557551d..59f8fc36a1 100644--- a/frontend/src/components/Plan/components/HeaderSection/Actions/registry/components/index.ts+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/registry/components/index.ts@@ -1,2 +1,3 @@export { default as ActionButton } from "./ActionButton.vue";export { default as ActionDropdown } from "./ActionDropdown.vue";+export { default as IssueReviewButton } from "./IssueReviewButton.vue";diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/registry/index.ts b/frontend/src/components/Plan/components/HeaderSection/Actions/registry/index.tsindex e9aedc690e..faa4beb025 100644--- a/frontend/src/components/Plan/components/HeaderSection/Actions/registry/index.ts+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/registry/index.ts@@ -2,38 +2,4 @@ export * from "./types";export * from "./context";export * from "./useActionRegistry";export * from "./actions";-export { ActionButton, ActionDropdown } from "./components";--// Standalone helper to get action label without full registry-import { t } from "@/plugins/i18n";-import type { UnifiedAction } from "./types";--export function getActionLabel(- actionId: UnifiedAction,- isExportPlan = false-): string {- switch (actionId) {- case "ISSUE_REVIEW":- return t("issue.review.self");- case "ISSUE_STATUS_CLOSE":- return t("issue.batch-transition.close");- case "ISSUE_STATUS_REOPEN":- return t("issue.batch-transition.reopen");- case "ISSUE_STATUS_RESOLVE":- return t("issue.batch-transition.resolve");- case "ISSUE_CREATE":- return t("plan.ready-for-review");- case "PLAN_CLOSE":- return t("common.close");- case "PLAN_REOPEN":- return t("common.reopen");- case "ROLLOUT_CREATE":- return t("issue.create-rollout");- case "ROLLOUT_START":- return isExportPlan ? t("common.export") : t("common.rollout");- case "ROLLOUT_CANCEL":- return t("common.cancel");- case "EXPORT_DOWNLOAD":- return t("common.download");- }-}+export { ActionButton, ActionDropdown, IssueReviewButton } from "./components";diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/registry/types.ts b/frontend/src/components/Plan/components/HeaderSection/Actions/registry/types.tsindex 962696e7f3..ef6a2cd162 100644--- a/frontend/src/components/Plan/components/HeaderSection/Actions/registry/types.ts+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/registry/types.ts@@ -8,18 +8,34 @@ import type {import type { Plan } from "@/types/proto-es/v1/plan_service_pb";import type { Project } from "@/types/proto-es/v1/project_service_pb";import type { Rollout } from "@/types/proto-es/v1/rollout_service_pb";-import type { UnifiedAction } from "../unified/types";--// Re-export action types from unified-export type {- ExportAction,- IssueAction,- IssueReviewAction,- IssueStatusAction,- PlanAction,- RolloutAction,- UnifiedAction,-} from "../unified/types";++// Action type definitions+export type IssueReviewAction = "ISSUE_REVIEW";++export type IssueStatusAction =+ | "ISSUE_STATUS_CLOSE"+ | "ISSUE_STATUS_REOPEN"+ | "ISSUE_STATUS_RESOLVE";++export type IssueAction =+ | IssueReviewAction+ | IssueStatusAction+ | "ISSUE_CREATE";++export type PlanAction = "PLAN_CLOSE" | "PLAN_REOPEN";++export type RolloutAction =+ | "ROLLOUT_CREATE"+ | "ROLLOUT_START"+ | "ROLLOUT_CANCEL";++export type ExportAction = "EXPORT_DOWNLOAD";++export type UnifiedAction =+ | IssueAction+ | PlanAction+ | RolloutAction+ | ExportAction;export type ExecuteType =| "immediate"diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/unified/index.ts b/frontend/src/components/Plan/components/HeaderSection/Actions/unified/index.tsdeleted file mode 100644index e3438d9e53..0000000000--- a/frontend/src/components/Plan/components/HeaderSection/Actions/unified/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export { default as IssueReviewButton } from "./IssueReviewButton.vue";-export * from "./types";diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/unified/types.ts b/frontend/src/components/Plan/components/HeaderSection/Actions/unified/types.tsdeleted file mode 100644index da482b3f45..0000000000--- a/frontend/src/components/Plan/components/HeaderSection/Actions/unified/types.ts+++ /dev/null@@ -1,27 +0,0 @@-export type IssueReviewAction = "ISSUE_REVIEW";--export type IssueStatusAction =- | "ISSUE_STATUS_CLOSE"- | "ISSUE_STATUS_REOPEN"- | "ISSUE_STATUS_RESOLVE";--export type IssueAction =- | IssueReviewAction- | IssueStatusAction- | "ISSUE_CREATE";--export type PlanAction = "PLAN_CLOSE" | "PLAN_REOPEN";--export type RolloutAction =- | "ROLLOUT_CREATE"- | "ROLLOUT_START"- | "ROLLOUT_CANCEL";--export type ExportAction = "EXPORT_DOWNLOAD";--// All unified actions-export type UnifiedAction =- | IssueAction- | PlanAction- | RolloutAction- | ExportAction;diff --git a/frontend/src/components/Plan/logic/context.ts b/frontend/src/components/Plan/logic/context.tsindex b90134aa6e..ef1c002ac4 100644--- a/frontend/src/components/Plan/logic/context.ts+++ b/frontend/src/components/Plan/logic/context.ts@@ -8,7 +8,7 @@ import type { Rollout, TaskRun } from "@/types/proto-es/v1/rollout_service_pb";import type {IssueReviewAction,IssueStatusAction,-} from "../components/HeaderSection/Actions/unified";+} from "../components/HeaderSection/Actions/registry";export type PlanEvents = Emittery<{"status-changed": { eager: boolean };