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: improve plan configuration UI and component consistency (#17463)
boojackf162342ae415
diff --git a/frontend/src/components/Plan/components/Configuration/Configuration.vue b/frontend/src/components/Plan/components/Configuration/Configuration.vueindex 07cc0e0ae0..34927e4d14 100644--- a/frontend/src/components/Plan/components/Configuration/Configuration.vue+++ b/frontend/src/components/Plan/components/Configuration/Configuration.vue@@ -1,14 +1,16 @@<template>- <div v-if="shouldShow" class="w-full flex flex-col gap-2">- <p class="text-base">- {{ $t("plan.options.self") }}- </p>- <div class="w-auto flex flex-col gap-2">+ <div v-if="shouldShow" class="w-full">+ <div class="mb-4">+ <h3 class="text-lg font-medium text-main">+ {{ $t("plan.options.self") }}+ </h3>+ </div>+ <div class="space-y-4">+ <InstanceRoleSection v-if="shouldShowInstanceRoleSection" /><TransactionModeSection v-if="shouldShowTransactionModeSection" /><IsolationLevelSection v-if="shouldShowIsolationLevelSection" />- <GhostSection v-if="shouldShowGhostSection" /><PreBackupSection v-if="shouldShowPreBackupSection" />- <InstanceRoleSection v-if="shouldShowInstanceRoleSection" />+ <GhostSection v-if="shouldShowGhostSection" /></div></div></template>diff --git a/frontend/src/components/Plan/components/Configuration/GhostSection/GhostSection.vue b/frontend/src/components/Plan/components/Configuration/GhostSection/GhostSection.vueindex 2ea22e1e78..e7b398bf2a 100644--- a/frontend/src/components/Plan/components/Configuration/GhostSection/GhostSection.vue+++ b/frontend/src/components/Plan/components/Configuration/GhostSection/GhostSection.vue@@ -1,19 +1,21 @@<template><div class="flex flex-col items-start gap-1">- <div- class="w-full flex flex-row items-center gap-2 whitespace-nowrap flex-wrap"- >- <GhostSwitch />- <div class="textlabel flex items-center gap-x-1 whitespace-nowrap">+ <div class="w-full flex items-center gap-3">+ <div class="flex items-center min-w-24">+ <label class="text-sm text-main">+ {{ $t("task.online-migration.self") }}+ </label><NTooltip><template #trigger>- {{ $t("task.online-migration.self") }}+ <heroicons:information-circle+ class="w-4 h-4 text-control-light cursor-help"+ /></template><template #default><i18n-ttag="p"keypath="issue.migration-mode.online.description"- class="whitespace-pre-line max-w-[20rem]"+ class="whitespace-pre-line max-w-xs"><template #link><!-- TODO: update docs for mariadb -->@@ -26,6 +28,7 @@</template></NTooltip></div>+ <GhostSwitch /><NButtonv-if="enabled && allowChange"tag="div"diff --git a/frontend/src/components/Plan/components/Configuration/InstanceRoleSection/InstanceRoleSection.vue b/frontend/src/components/Plan/components/Configuration/InstanceRoleSection/InstanceRoleSection.vueindex 2ecd1cab95..2cb44e7b1c 100644--- a/frontend/src/components/Plan/components/Configuration/InstanceRoleSection/InstanceRoleSection.vue+++ b/frontend/src/components/Plan/components/Configuration/InstanceRoleSection/InstanceRoleSection.vue@@ -1,24 +1,32 @@<template><div class="w-full flex items-center gap-3">- <NTooltip>- <template #trigger>- <span class="text-sm font-medium cursor-help flex items-center gap-1">- {{ $t("common.role.self") }}- <heroicons:question-mark-circle class="w-4 h-4 text-gray-400" />- </span>- </template>- <template #default>- <div class="max-w-xs space-y-1">- <p class="font-medium">{{ $t("plan.spec.role-selection.title") }}</p>- <p class="text-sm">- {{ $t("plan.spec.role-selection.description") }}- </p>- <p class="text-xs text-gray-400">- {{ $t("plan.spec.role-selection.technical-note") }}- </p>- </div>- </template>- </NTooltip>+ <div class="flex items-center min-w-24">+ <label class="text-sm text-main">+ {{ $t("common.role.self") }}+ </label>+ <NTooltip>+ <template #trigger>+ <heroicons:information-circle+ class="w-4 h-4 text-control-light cursor-help"+ />+ </template>+ <template #default>+ <div class="max-w-xs">+ <div class="space-y-1">+ <p class="font-medium">+ {{ $t("plan.spec.role-selection.title") }}+ </p>+ <p class="text-sm">+ {{ $t("plan.spec.role-selection.description") }}+ </p>+ <p class="text-xs text-gray-400">+ {{ $t("plan.spec.role-selection.technical-note") }}+ </p>+ </div>+ </div>+ </template>+ </NTooltip>+ </div><InstanceRoleSelect /></div></template>diff --git a/frontend/src/components/Plan/components/Configuration/InstanceRoleSection/context.ts b/frontend/src/components/Plan/components/Configuration/InstanceRoleSection/context.tsindex 0deaa63cb2..e8574a9916 100644--- a/frontend/src/components/Plan/components/Configuration/InstanceRoleSection/context.ts+++ b/frontend/src/components/Plan/components/Configuration/InstanceRoleSection/context.ts@@ -7,10 +7,14 @@ import { isValidDatabaseName } from "@/types";import { Engine } from "@/types/proto-es/v1/common_pb";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 {+ Plan_ChangeDatabaseConfig_Type,+ 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 { Task, Rollout } from "@/types/proto-es/v1/rollout_service_pb";-import { Task_Status, Task_Type } from "@/types/proto-es/v1/rollout_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(@@ -26,22 +30,13 @@ export const provideInstanceRoleSettingContext = (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 databaseStore = useDatabaseV1Store();- const {- isCreating,- plan,- selectedSpec,- selectedTask,- issue,- rollout,- readonly,- } = refs;+ const { isCreating, plan, selectedSpec, issue, rollout, readonly } = refs;const events = new Emittery<{update: never;@@ -71,31 +66,10 @@ export const provideInstanceRoleSettingContext = (refs: {if (selectedSpec.value.config?.case !== "changeDatabaseConfig") {return false;}-- // Get the task type- let taskType: Task_Type | undefined;- if (selectedTask?.value) {- taskType = selectedTask.value.type;- } else if (rollout?.value) {- const tasks = flattenTaskV1List(rollout.value);- const task = tasks.find((t) => t.specId === selectedSpec.value?.id);- taskType = task?.type;- } else {- // For creating mode, we can infer from the change type- const config = selectedSpec.value.config.value;- // Check if it's a schema or data update based on the config- taskType = config.sheet- ? Task_Type.DATABASE_SCHEMA_UPDATE- : Task_Type.DATABASE_DATA_UPDATE;- }-- return (- taskType &&- [- Task_Type.DATABASE_SCHEMA_UPDATE,- Task_Type.DATABASE_DATA_UPDATE,- ].includes(taskType)- );+ return [+ Plan_ChangeDatabaseConfig_Type.DATA,+ Plan_ChangeDatabaseConfig_Type.MIGRATE,+ ].includes(selectedSpec.value.config.value.type);});const allowChange = computed(() => {@@ -114,23 +88,17 @@ export const provideInstanceRoleSettingContext = (refs: {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 is running/done/etc, disallow+ const tasks = flattenTaskV1List(rollout?.value) || [];+ // If any task is running/done/etc, disallowif (- task &&- [- Task_Status.PENDING,- Task_Status.RUNNING,- Task_Status.DONE,- Task_Status.SKIPPED,- ].includes(task.status)+ tasks.some((task) => {+ return [+ Task_Status.PENDING,+ Task_Status.RUNNING,+ Task_Status.DONE,+ Task_Status.SKIPPED,+ ].includes(task.status);+ })) {return false;}@@ -141,7 +109,6 @@ export const provideInstanceRoleSettingContext = (refs: {const context = {isCreating,selectedSpec,- selectedTask,plan,shouldShow,allowChange,diff --git a/frontend/src/components/Plan/components/Configuration/IsolationLevelSection/IsolationLevelSection.vue b/frontend/src/components/Plan/components/Configuration/IsolationLevelSection/IsolationLevelSection.vueindex f71334b900..79e4069f19 100644--- a/frontend/src/components/Plan/components/Configuration/IsolationLevelSection/IsolationLevelSection.vue+++ b/frontend/src/components/Plan/components/Configuration/IsolationLevelSection/IsolationLevelSection.vue@@ -1,24 +1,40 @@<template>- <div- v-if="shouldShow"- class="w-full flex flex-row justify-start items-center gap-4"- >- <label class="w-28 shrink-0 text-sm text-control-light">- {{ $t("plan.isolation-level.self") }}- </label>+ <div v-if="shouldShowCombined" class="w-full flex items-center gap-3">+ <div class="flex items-center min-w-24">+ <label class="text-sm text-main">+ {{ $t("plan.isolation-level.self") }}+ </label>+ <NTooltip>+ <template #trigger>+ <heroicons:information-circle+ class="w-4 h-4 text-control-light cursor-help"+ />+ </template>+ <template #default>+ <div class="max-w-xs">+ {{ $t("plan.isolation-level.self") }}+ </div>+ </template>+ </NTooltip>+ </div><IsolationLevelSelect /></div></template><script lang="ts" setup>+import { NTooltip } from "naive-ui";import { computed } from "vue";import { useTransactionModeSettingContext } from "../TransactionModeSection/context";import IsolationLevelSelect from "./IsolationLevelSelect.vue";+import { useIsolationLevelSettingContext } from "./context";-// Only show isolation level when transaction mode is ON+// Check if isolation level section should be shown based on context+const { shouldShow } = useIsolationLevelSettingContext();++// Only show isolation level when transaction mode is ON and context allows itconst { transactionMode } = useTransactionModeSettingContext();-const shouldShow = computed(() => {- return transactionMode.value === "on";+const shouldShowCombined = computed(() => {+ return shouldShow.value && transactionMode.value === "on";});</script>diff --git a/frontend/src/components/Plan/components/Configuration/IsolationLevelSection/IsolationLevelSelect.vue b/frontend/src/components/Plan/components/Configuration/IsolationLevelSection/IsolationLevelSelect.vueindex 39274ab060..8f30ababdc 100644--- a/frontend/src/components/Plan/components/Configuration/IsolationLevelSection/IsolationLevelSelect.vue+++ b/frontend/src/components/Plan/components/Configuration/IsolationLevelSection/IsolationLevelSelect.vue@@ -26,7 +26,6 @@ import {type IsolationLevel,} from "../../StatementSection/directiveUtils";import { useSpecSheet } from "../../StatementSection/useSpecSheet";-import { useTransactionModeSettingContext } from "../TransactionModeSection/context";import { useIsolationLevelSettingContext } from "./context";const {@@ -35,9 +34,6 @@ const {events,} = useIsolationLevelSettingContext();-// Also need transaction mode to know if we should show this-const { transactionMode } = useTransactionModeSettingContext();-const selectedSpec = useSelectedSpec();const { sheetStatement, sheet, sheetReady } = useSpecSheet(selectedSpec);const { plan, isCreating } = usePlanContext();@@ -114,17 +110,6 @@ watch({ immediate: true });-// Clear isolation level if transaction mode is turned off-watch(- () => transactionMode.value,- (mode) => {- if (mode === "off" && contextIsolationLevel.value) {- contextIsolationLevel.value = undefined;- setIsolationInStatement(undefined);- }- }-);-const setIsolationInStatement = async (isolationLevel: IsolationLevel | undefined) => {diff --git a/frontend/src/components/Plan/components/Configuration/IsolationLevelSection/context.ts b/frontend/src/components/Plan/components/Configuration/IsolationLevelSection/context.tsindex 4d1495410b..3c98abc664 100644--- a/frontend/src/components/Plan/components/Configuration/IsolationLevelSection/context.ts+++ b/frontend/src/components/Plan/components/Configuration/IsolationLevelSection/context.ts@@ -7,14 +7,14 @@ import { isValidDatabaseName } from "@/types";import { Engine } from "@/types/proto-es/v1/common_pb";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,- Plan_ChangeDatabaseConfig,+import {+ Plan_ChangeDatabaseConfig_Type,+ 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 { Task, Rollout } from "@/types/proto-es/v1/rollout_service_pb";-import { Task_Status, Task_Type } from "@/types/proto-es/v1/rollout_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";@@ -22,15 +22,9 @@ export const KEY = Symbol("bb.plan.setting.isolation-level") as InjectionKey<IsolationLevelSettingContext>;-export type IsolationLevelSettingContext = {- allowChange: Ref<boolean>;- isolationLevel: Ref<IsolationLevel | undefined>;- databases: Ref<any[]>;- shouldShow: Ref<boolean>;- events: Emittery<{- update: never;- }>;-};+type IsolationLevelSettingContext = ReturnType<+ typeof provideIsolationLevelSettingContext+>;export const useIsolationLevelSettingContext = () => {return inject(KEY)!;@@ -41,15 +35,13 @@ export const provideIsolationLevelSettingContext = (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 databaseStore = useDatabaseV1Store();- const { isCreating, selectedSpec, selectedTask, issue, rollout, readonly } =- refs;+ const { isCreating, plan, selectedSpec, issue, rollout, readonly } = refs;const events = new Emittery<{update: never;@@ -80,64 +72,54 @@ export const provideIsolationLevelSettingContext = (refs: {if (selectedSpec.value.config?.case !== "changeDatabaseConfig") {return false;}-- // Get the task type from spec or selected task- let taskType: Task_Type | undefined;- if (selectedTask?.value) {- taskType = selectedTask.value.type;- } else if (rollout?.value) {- const tasks = flattenTaskV1List(rollout.value);- const task = tasks.find((t) => t.specId === selectedSpec.value?.id);- taskType = task?.type;- } else {- // For creating mode, we can infer from the change type- const config = selectedSpec.value.config- .value as Plan_ChangeDatabaseConfig;- // Check if it's a schema or data update based on the config- taskType = config.sheet- ? Task_Type.DATABASE_SCHEMA_UPDATE- : Task_Type.DATABASE_DATA_UPDATE;- }-- return (- !!taskType &&- [- Task_Type.DATABASE_SCHEMA_UPDATE,- Task_Type.DATABASE_DATA_UPDATE,- ].includes(taskType)- );+ return [+ Plan_ChangeDatabaseConfig_Type.DATA,+ Plan_ChangeDatabaseConfig_Type.MIGRATE,+ ].includes(selectedSpec.value.config.value.type);});const allowChange = computed(() => {- if (readonly?.value) return false;-- if (isCreating.value) return true;+ // If readonly mode, disallow changes+ if (readonly?.value) {+ return false;+ }- if (issue?.value?.status !== IssueStatus.OPEN) return false;+ // Allow changes when creating+ if (isCreating.value) {+ return true;+ }- if (selectedTask?.value) {- return [Task_Status.NOT_STARTED, Task_Status.PENDING].includes(- selectedTask.value.status- );+ // If issue is not open, disallow+ if (issue?.value && issue.value.status !== IssueStatus.OPEN) {+ return false;}- if (rollout?.value) {- const tasks = flattenTaskV1List(rollout.value);- const task = tasks.find((t) => t.specId === selectedSpec.value?.id);- if (!task) return false;- return [Task_Status.NOT_STARTED, Task_Status.PENDING].includes(- task.status- );+ 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);+ })+ ) {+ return false;}- return false;+ return true;});- const context: IsolationLevelSettingContext = {+ const context = {+ isCreating,+ selectedSpec,+ plan,+ shouldShow,allowChange,isolationLevel,databases,- shouldShow,events,};diff --git a/frontend/src/components/Plan/components/Configuration/IsolationLevelSection/index.ts b/frontend/src/components/Plan/components/Configuration/IsolationLevelSection/index.tsindex 54ba6e7612..b95acd8cd3 100644--- a/frontend/src/components/Plan/components/Configuration/IsolationLevelSection/index.ts+++ b/frontend/src/components/Plan/components/Configuration/IsolationLevelSection/index.ts@@ -1,2 +1,3 @@-export { default } from "./IsolationLevelSection.vue";-export * from "./context";+import IsolationLevelSection from "./IsolationLevelSection.vue";++export default IsolationLevelSection;diff --git a/frontend/src/components/Plan/components/Configuration/PreBackupSection/PreBackupSection.vue b/frontend/src/components/Plan/components/Configuration/PreBackupSection/PreBackupSection.vueindex 5a40279c83..4ebcf5c9b1 100644--- a/frontend/src/components/Plan/components/Configuration/PreBackupSection/PreBackupSection.vue+++ b/frontend/src/components/Plan/components/Configuration/PreBackupSection/PreBackupSection.vue@@ -1,20 +1,23 @@<template>- <div- class="w-full flex items-center justify-start gap-x-2 flex-wrap whitespace-nowrap"- >+ <div class="w-full flex items-center gap-3">+ <div class="flex items-center min-w-24">+ <label class="text-sm text-main">+ {{ $t("task.prior-backup") }}+ </label>+ <NTooltip>+ <template #trigger>+ <heroicons:information-circle+ class="w-4 h-4 text-control-light cursor-help"+ />+ </template>+ <template #default>+ <div class="max-w-xs">+ {{ $t("task.prior-backup-tips") }}+ </div>+ </template>+ </NTooltip>+ </div><PreBackupSwitch />- <NTooltip>- <template #trigger>- <div class="textlabel flex items-center">- <span>{{ $t("task.prior-backup") }}</span>- </div>- </template>- <template #default>- <div class="max-w-[20rem]">- {{ $t("task.prior-backup-tips") }}- </div>- </template>- </NTooltip></div></template>diff --git a/frontend/src/components/Plan/components/Configuration/TransactionModeSection/TransactionModeSection.vue b/frontend/src/components/Plan/components/Configuration/TransactionModeSection/TransactionModeSection.vueindex cbb15941cf..53bd296f85 100644--- a/frontend/src/components/Plan/components/Configuration/TransactionModeSection/TransactionModeSection.vue+++ b/frontend/src/components/Plan/components/Configuration/TransactionModeSection/TransactionModeSection.vue@@ -1,25 +1,28 @@<template>- <div- class="w-full flex items-center justify-start gap-x-2 flex-wrap whitespace-nowrap"- >- <TransactionModeSwitch />- <NTooltip>- <template #trigger>- <div class="textlabel flex items-center">- <span>{{ $t("issue.transaction-mode.label") }}</span>- </div>- </template>- <template #default>- <div class="max-w-[20rem]">- <div v-if="transactionMode === 'on'">- {{ $t("issue.transaction-mode.on-tooltip") }}- </div>- <div v-else>- {{ $t("issue.transaction-mode.off-tooltip") }}+ <div class="w-full flex items-center gap-3">+ <div class="flex items-center min-w-24">+ <label class="text-sm text-main">+ {{ $t("issue.transaction-mode.label") }}+ </label>+ <NTooltip>+ <template #trigger>+ <heroicons:information-circle+ class="w-4 h-4 text-control-light cursor-help"+ />+ </template>+ <template #default>+ <div class="max-w-xs">+ <div v-if="transactionMode === 'on'">+ {{ $t("issue.transaction-mode.on-tooltip") }}+ </div>+ <div v-else>+ {{ $t("issue.transaction-mode.off-tooltip") }}+ </div></div>- </div>- </template>- </NTooltip>+ </template>+ </NTooltip>+ </div>+ <TransactionModeSwitch /></div></template>diff --git a/frontend/src/components/Plan/components/Configuration/TransactionModeSection/TransactionModeSwitch.vue b/frontend/src/components/Plan/components/Configuration/TransactionModeSection/TransactionModeSwitch.vueindex e8b30c34d2..a93f276a34 100644--- a/frontend/src/components/Plan/components/Configuration/TransactionModeSection/TransactionModeSwitch.vue+++ b/frontend/src/components/Plan/components/Configuration/TransactionModeSection/TransactionModeSwitch.vue@@ -31,11 +31,6 @@ const { plan, isCreating } = usePlanContext();// Flag to prevent circular updatesconst isUpdatingFromUI = ref(false);-// Default transaction mode-const getDefaultForCurrentTask = () => {- return getDefaultTransactionMode();-};-const isTransactionOn = computed({get: () => transactionMode.value === "on",set: (value: boolean) => {@@ -53,7 +48,7 @@ const isTransactionOn = computed({const initializeFromStatement = () => {if (!sheetReady.value || !sheetStatement.value) {// If sheet is not ready or statement is empty, use default- transactionMode.value = getDefaultForCurrentTask() ? "on" : "off";+ transactionMode.value = getDefaultTransactionMode() ? "on" : "off";return;}@@ -61,7 +56,7 @@ const initializeFromStatement = () => {if (parsed.transactionMode !== undefined) {transactionMode.value = parsed.transactionMode;} else {- transactionMode.value = getDefaultForCurrentTask() ? "on" : "off";+ transactionMode.value = getDefaultTransactionMode() ? "on" : "off";}};diff --git a/frontend/src/components/Plan/components/Configuration/TransactionModeSection/context.ts b/frontend/src/components/Plan/components/Configuration/TransactionModeSection/context.tsindex ce11d83b5e..3dcedc0a95 100644--- a/frontend/src/components/Plan/components/Configuration/TransactionModeSection/context.ts+++ b/frontend/src/components/Plan/components/Configuration/TransactionModeSection/context.ts@@ -6,10 +6,14 @@ import { useDatabaseV1Store } from "@/store";import { isValidDatabaseName } from "@/types";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 {+ Plan_ChangeDatabaseConfig_Type,+ 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 { Task, Rollout } from "@/types/proto-es/v1/rollout_service_pb";-import { Task_Status, Task_Type } from "@/types/proto-es/v1/rollout_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";export const KEY = Symbol(@@ -25,22 +29,13 @@ export const provideTransactionModeSettingContext = (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 databaseStore = useDatabaseV1Store();- const {- isCreating,- plan,- selectedSpec,- selectedTask,- issue,- rollout,- readonly,- } = refs;+ const { isCreating, plan, selectedSpec, issue, rollout, readonly } = refs;const events = new Emittery<{update: never;@@ -70,31 +65,10 @@ export const provideTransactionModeSettingContext = (refs: {if (selectedSpec.value.config?.case !== "changeDatabaseConfig") {return false;}-- // Get the task type from spec or selected task- let taskType: Task_Type | undefined;- if (selectedTask?.value) {- taskType = selectedTask.value.type;- } else if (rollout?.value) {- const tasks = flattenTaskV1List(rollout.value);- const task = tasks.find((t) => t.specId === selectedSpec.value?.id);- taskType = task?.type;- } else {- // For creating mode, we can infer from the change type- const config = selectedSpec.value.config.value;- // Check if it's a schema or data update based on the config- taskType = config.sheet- ? Task_Type.DATABASE_SCHEMA_UPDATE- : Task_Type.DATABASE_DATA_UPDATE;- }-- return (- taskType &&- [- Task_Type.DATABASE_SCHEMA_UPDATE,- Task_Type.DATABASE_DATA_UPDATE,- ].includes(taskType)- );+ return [+ Plan_ChangeDatabaseConfig_Type.DATA,+ Plan_ChangeDatabaseConfig_Type.MIGRATE,+ ].includes(selectedSpec.value.config.value.type);});const allowChange = computed(() => {@@ -113,23 +87,17 @@ export const provideTransactionModeSettingContext = (refs: {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 is running/done/etc, disallow+ const tasks = flattenTaskV1List(rollout?.value) || [];+ // If any task is running/done/etc, disallowif (- task &&- [- Task_Status.PENDING,- Task_Status.RUNNING,- Task_Status.DONE,- Task_Status.SKIPPED,- ].includes(task.status)+ tasks.some((task) => {+ return [+ Task_Status.PENDING,+ Task_Status.RUNNING,+ Task_Status.DONE,+ Task_Status.SKIPPED,+ ].includes(task.status);+ })) {return false;}@@ -140,7 +108,6 @@ export const provideTransactionModeSettingContext = (refs: {const context = {isCreating,selectedSpec,- selectedTask,plan,shouldShow,allowChange,