Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix(frontend): check hasRollout in configuration sections to match backend API (#18648)
boojack9d52cfc2fbd5
diff --git a/frontend/src/components/IssueV1/components/Sidebar/PreBackupSection/PreBackupSection.vue b/frontend/src/components/IssueV1/components/Sidebar/PreBackupSection/PreBackupSection.vueindex e8f556118f..a9685d55f2 100644--- a/frontend/src/components/IssueV1/components/Sidebar/PreBackupSection/PreBackupSection.vue+++ b/frontend/src/components/IssueV1/components/Sidebar/PreBackupSection/PreBackupSection.vue@@ -32,9 +32,7 @@ const {selectedSpec: computed(() =>specForTask(issue.value.planEntity as Plan, selectedTask.value)),- selectedTask,issue,- rollout: computed(() => issue.value.rolloutEntity),});const database = computed(() =>diff --git a/frontend/src/components/IssueV1/components/Sidebar/Sidebar.vue b/frontend/src/components/IssueV1/components/Sidebar/Sidebar.vueindex 050132a5ad..4b9916dd9c 100644--- a/frontend/src/components/IssueV1/components/Sidebar/Sidebar.vue+++ b/frontend/src/components/IssueV1/components/Sidebar/Sidebar.vue@@ -111,7 +111,6 @@ const { shouldShow: shouldShowGhostSection, events: ghostEvents } =project,plan: computed(() => issue.value.planEntity as Plan),selectedSpec,- selectedTask: selectedTask,issue,});diff --git a/frontend/src/components/Plan/components/Configuration/Configuration.vue b/frontend/src/components/Plan/components/Configuration/Configuration.vueindex 21e6ff3001..f74c64ea6f 100644--- a/frontend/src/components/Plan/components/Configuration/Configuration.vue+++ b/frontend/src/components/Plan/components/Configuration/Configuration.vue@@ -31,7 +31,7 @@ import TransactionModeSection from "./TransactionModeSection";import { provideTransactionModeSettingContext } from "./TransactionModeSection/context";const { project } = useCurrentProjectV1();-const { isCreating, plan, events, issue, rollout, readonly } = usePlanContext();+const { isCreating, plan, events, issue, readonly } = usePlanContext();const { selectedSpec } = useSelectedSpec();const {@@ -43,7 +43,6 @@ const {selectedSpec,isCreating,issue,- rollout,readonly,});@@ -56,7 +55,6 @@ const {selectedSpec,isCreating,issue,- rollout,readonly,});@@ -69,7 +67,6 @@ const {selectedSpec,isCreating,issue,- rollout,readonly,});@@ -80,7 +77,6 @@ const { shouldShow: shouldShowGhostSection, events: ghostEvents } =selectedSpec,isCreating,issue,- rollout,readonly,});@@ -91,7 +87,6 @@ const { shouldShow: shouldShowPreBackupSection, events: preBackupEvents } =selectedSpec,isCreating,issue,- rollout,readonly,});diff --git a/frontend/src/components/Plan/components/Configuration/GhostSection/context.ts b/frontend/src/components/Plan/components/Configuration/GhostSection/context.tsindex d39b9042b6..7f1c39125a 100644--- a/frontend/src/components/Plan/components/Configuration/GhostSection/context.ts+++ b/frontend/src/components/Plan/components/Configuration/GhostSection/context.ts@@ -8,13 +8,7 @@ import type { Issue } from "@/types/proto-es/v1/issue_service_pb";import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";import type { Plan, Plan_Spec } from "@/types/proto-es/v1/plan_service_pb";import type { Project } from "@/types/proto-es/v1/project_service_pb";-import type { Rollout, Task } from "@/types/proto-es/v1/rollout_service_pb";-import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";-import {- flattenTaskV1List,- hasProjectPermissionV2,- isNullOrUndefined,-} from "@/utils";+import { hasProjectPermissionV2, isNullOrUndefined } from "@/utils";import { GHOST_AVAILABLE_ENGINES, getGhostEnabledForSpec } from "./common";export const KEY = Symbol(@@ -30,24 +24,13 @@ export const provideGhostSettingContext = (refs: {project: Ref<Project>;plan: Ref<Plan>;selectedSpec: Ref<Plan_Spec | undefined>;- selectedTask?: Ref<Task | undefined>;issue?: Ref<Issue | undefined>;- rollout?: Ref<Rollout | undefined>;readonly?: Ref<boolean>;}) => {const currentUser = useCurrentUserV1();const databaseStore = useDatabaseV1Store();- const {- isCreating,- project,- plan,- selectedSpec,- selectedTask,- issue,- rollout,- readonly,- } = refs;+ const { isCreating, project, plan, selectedSpec, issue, readonly } = refs;const events = new Emittery<{update: never;@@ -78,33 +61,18 @@ export const provideGhostSettingContext = (refs: {return false;}- // Allow toggle pre-backup when creating.+ // Allow toggle gh-ost when creating.if (isCreating.value) {return true;}- // If issue is not open, disallow.- if (issue?.value && issue.value.status !== IssueStatus.OPEN) {+ // Disallow changes if the plan has started rollout.+ if (unref(plan).hasRollout) {return false;}- let task: Task | undefined;- if (selectedTask?.value) {- task = selectedTask.value;- } else if (rollout?.value) {- const tasks = flattenTaskV1List(rollout.value);- task = tasks.find((t) => t.specId === selectedSpec.value?.id);- }- // If task of the spec is running/done/etc..., disallow.- if (- task &&- [- Task_Status.PENDING,- Task_Status.RUNNING,- Task_Status.DONE,- Task_Status.SKIPPED,- ].includes(task.status)- ) {+ // If issue is not open, disallow.+ if (issue?.value && issue.value.status !== IssueStatus.OPEN) {return false;}@@ -131,7 +99,6 @@ export const provideGhostSettingContext = (refs: {const context = {isCreating,selectedSpec,- selectedTask,plan,shouldShow,allowChange,diff --git a/frontend/src/components/Plan/components/Configuration/InstanceRoleSection/context.ts b/frontend/src/components/Plan/components/Configuration/InstanceRoleSection/context.tsindex 33fd85aeba..aaa024c944 100644--- a/frontend/src/components/Plan/components/Configuration/InstanceRoleSection/context.ts+++ b/frontend/src/components/Plan/components/Configuration/InstanceRoleSection/context.ts@@ -9,9 +9,6 @@ import type { Issue } from "@/types/proto-es/v1/issue_service_pb";import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";import { type Plan, type Plan_Spec } 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 { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";-import { flattenTaskV1List } from "@/utils";export const KEY = Symbol("bb.plan.setting.instance-role"@@ -27,12 +24,11 @@ export const provideInstanceRoleSettingContext = (refs: {plan: Ref<Plan>;selectedSpec: Ref<Plan_Spec | undefined>;issue?: Ref<Issue | undefined>;- rollout?: Ref<Rollout | undefined>;readonly?: Ref<boolean>;}) => {const databaseStore = useDatabaseV1Store();- const { isCreating, plan, selectedSpec, issue, rollout, readonly } = refs;+ const { isCreating, plan, selectedSpec, issue, readonly } = refs;const events = new Emittery<{update: never;@@ -78,23 +74,13 @@ export const provideInstanceRoleSettingContext = (refs: {return true;}- // If issue is not open, disallow- if (issue?.value && issue.value.status !== IssueStatus.OPEN) {+ // Disallow changes if the plan has started rollout.+ if (plan.value.hasRollout) {return false;}- const tasks = flattenTaskV1List(rollout?.value) || [];- // If any task is running/done/etc, disallow- if (- tasks.some((task) => {- return [- Task_Status.PENDING,- Task_Status.RUNNING,- Task_Status.DONE,- Task_Status.SKIPPED,- ].includes(task.status);- })- ) {+ // If issue is not open, disallow+ if (issue?.value && issue.value.status !== IssueStatus.OPEN) {return false;}diff --git a/frontend/src/components/Plan/components/Configuration/IsolationLevelSection/context.ts b/frontend/src/components/Plan/components/Configuration/IsolationLevelSection/context.tsindex f83e0bccff..c6441e2183 100644--- a/frontend/src/components/Plan/components/Configuration/IsolationLevelSection/context.ts+++ b/frontend/src/components/Plan/components/Configuration/IsolationLevelSection/context.ts@@ -9,9 +9,6 @@ import type { Issue } from "@/types/proto-es/v1/issue_service_pb";import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";import { type Plan, type Plan_Spec } 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 { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";-import { flattenTaskV1List } from "@/utils";import type { IsolationLevel } from "../../StatementSection/directiveUtils";export const KEY = Symbol(@@ -32,12 +29,11 @@ export const provideIsolationLevelSettingContext = (refs: {plan: Ref<Plan>;selectedSpec: Ref<Plan_Spec | undefined>;issue?: Ref<Issue | undefined>;- rollout?: Ref<Rollout | undefined>;readonly?: Ref<boolean>;}) => {const databaseStore = useDatabaseV1Store();- const { isCreating, plan, selectedSpec, issue, rollout, readonly } = refs;+ const { isCreating, plan, selectedSpec, issue, readonly } = refs;const events = new Emittery<{update: never;@@ -84,23 +80,13 @@ export const provideIsolationLevelSettingContext = (refs: {return true;}- // If issue is not open, disallow- if (issue?.value && issue.value.status !== IssueStatus.OPEN) {+ // Disallow changes if the plan has started rollout.+ if (plan.value.hasRollout) {return false;}- const tasks = flattenTaskV1List(rollout?.value) || [];- // If any task is running/done/etc, disallow- if (- tasks.some((task) => {- return [- Task_Status.PENDING,- Task_Status.RUNNING,- Task_Status.DONE,- Task_Status.SKIPPED,- ].includes(task.status);- })- ) {+ // If issue is not open, disallow+ if (issue?.value && issue.value.status !== IssueStatus.OPEN) {return false;}diff --git a/frontend/src/components/Plan/components/Configuration/PreBackupSection/context.ts b/frontend/src/components/Plan/components/Configuration/PreBackupSection/context.tsindex 4d201ae687..bce13692e5 100644--- a/frontend/src/components/Plan/components/Configuration/PreBackupSection/context.ts+++ b/frontend/src/components/Plan/components/Configuration/PreBackupSection/context.ts@@ -20,9 +20,7 @@ import {UpdatePlanRequestSchema,} from "@/types/proto-es/v1/plan_service_pb";import type { Project } from "@/types/proto-es/v1/project_service_pb";-import type { Rollout, Task } from "@/types/proto-es/v1/rollout_service_pb";-import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";-import { flattenTaskV1List, hasProjectPermissionV2 } from "@/utils";+import { hasProjectPermissionV2 } from "@/utils";import { BACKUP_AVAILABLE_ENGINES } from "./common";const KEY = Symbol(@@ -38,15 +36,12 @@ export const providePreBackupSettingContext = (refs: {project: Ref<Project>;plan: Ref<Plan>;selectedSpec: Ref<Plan_Spec | undefined>;- selectedTask?: Ref<Task | undefined>;issue?: Ref<Issue | undefined>;- rollout?: Ref<Rollout | undefined>;readonly?: Ref<boolean>;}) => {const currentUser = useCurrentUserV1();const databaseStore = useDatabaseV1Store();- const { isCreating, project, plan, selectedSpec, issue, rollout, readonly } =- refs;+ const { isCreating, project, plan, selectedSpec, issue, readonly } = refs;const events = new Emittery<{update: never;@@ -92,26 +87,14 @@ export const providePreBackupSettingContext = (refs: {return true;}- // If issue is not open, disallow.- if (issue?.value && issue.value.status !== IssueStatus.OPEN) {+ // Disallow changes if the plan has started rollout.+ if (unref(plan).hasRollout) {return false;}- // If task of the spec is running/done/etc..., disallow.- if (rollout?.value) {- const tasks = flattenTaskV1List(rollout.value);- const task = tasks.find((t) => t.specId === selectedSpec.value?.id);- if (- task &&- [- Task_Status.PENDING,- Task_Status.RUNNING,- Task_Status.DONE,- Task_Status.SKIPPED,- ].includes(task.status)- ) {- return false;- }+ // If issue is not open, disallow.+ if (issue?.value && issue.value.status !== IssueStatus.OPEN) {+ return false;}// Allowed to the plan/issue creator.diff --git a/frontend/src/components/Plan/components/Configuration/TransactionModeSection/context.ts b/frontend/src/components/Plan/components/Configuration/TransactionModeSection/context.tsindex 93a5e11f87..f4f983f3d5 100644--- a/frontend/src/components/Plan/components/Configuration/TransactionModeSection/context.ts+++ b/frontend/src/components/Plan/components/Configuration/TransactionModeSection/context.ts@@ -9,9 +9,7 @@ import type { Issue } from "@/types/proto-es/v1/issue_service_pb";import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";import { type Plan, type Plan_Spec } 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 { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";-import { flattenTaskV1List, instanceV1SupportsTransactionMode } from "@/utils";+import { instanceV1SupportsTransactionMode } from "@/utils";export const KEY = Symbol("bb.plan.setting.transaction-mode"@@ -27,12 +25,11 @@ export const provideTransactionModeSettingContext = (refs: {plan: Ref<Plan>;selectedSpec: Ref<Plan_Spec | undefined>;issue?: Ref<Issue | undefined>;- rollout?: Ref<Rollout | undefined>;readonly?: Ref<boolean>;}) => {const databaseStore = useDatabaseV1Store();- const { isCreating, plan, selectedSpec, issue, rollout, readonly } = refs;+ const { isCreating, plan, selectedSpec, issue, readonly } = refs;const events = new Emittery<{update: never;@@ -78,23 +75,13 @@ export const provideTransactionModeSettingContext = (refs: {return true;}- // If issue is not open, disallow- if (issue?.value && issue.value.status !== IssueStatus.OPEN) {+ // Disallow changes if the plan has started rollout.+ if (plan.value.hasRollout) {return false;}- const tasks = flattenTaskV1List(rollout?.value) || [];- // If any task is running/done/etc, disallow- if (- tasks.some((task) => {- return [- Task_Status.PENDING,- Task_Status.RUNNING,- Task_Status.DONE,- Task_Status.SKIPPED,- ].includes(task.status);- })- ) {+ // If issue is not open, disallow+ if (issue?.value && issue.value.status !== IssueStatus.OPEN) {return false;}