Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: show alert when applying release (#15122)

boojack7bad8fadbb26
diff --git a/frontend/src/components/Release/ReleaseDetail/NavBar/ApplyToDatabasePanel.vue b/frontend/src/components/Release/ReleaseDetail/NavBar/ApplyToDatabasePanel.vue
index 063820e911..9551a1b6a7 100644
--- a/frontend/src/components/Release/ReleaseDetail/NavBar/ApplyToDatabasePanel.vue
+++ b/frontend/src/components/Release/ReleaseDetail/NavBar/ApplyToDatabasePanel.vue
@@ -23,6 +23,7 @@
<PreviewPlanDetail
:release="release"
:preview-plan-result="state.previewPlanResult"
+ :database-select-state="state.targetSelectState"
:allow-out-of-order="state.allowOutOfOrder"
/>
</div>
diff --git a/frontend/src/components/Release/ReleaseDetail/NavBar/PreviewPlanDetail.vue b/frontend/src/components/Release/ReleaseDetail/NavBar/PreviewPlanDetail.vue
index 0e62352355..05ab5fc853 100644
--- a/frontend/src/components/Release/ReleaseDetail/NavBar/PreviewPlanDetail.vue
+++ b/frontend/src/components/Release/ReleaseDetail/NavBar/PreviewPlanDetail.vue
@@ -1,4 +1,9 @@
<template>
+ <NAlert v-if="shouldShowAppliedAlert" type="info">{{
+ $t(
+ "release.messages.bytebase-will-skip-those-files-has-been-applied-on-target-database"
+ )
+ }}</NAlert>
<div class="w-full flex flex-row flex-wrap gap-2">
<p class="w-full">
{{ $t("release.tasks-to-apply") }}
@@ -116,10 +121,11 @@
</template>
<script lang="ts" setup>
-import { NTag, NTable } from "naive-ui";
+import { NTag, NTable, NAlert } from "naive-ui";
import { computed } from "vue";
+import type { DatabaseSelectState } from "@/components/DatabaseAndGroupSelector";
import DatabaseView from "@/components/v2/Model/DatabaseView.vue";
-import { useDatabaseV1Store } from "@/store";
+import { useDatabaseV1Store, useDBGroupStore } from "@/store";
import type { ComposedDatabase, ComposedRelease } from "@/types";
import type {
Plan_Spec,
@@ -129,11 +135,14 @@ import type {
const props = defineProps<{
release: ComposedRelease;
previewPlanResult: PreviewPlanResponse;
+ databaseSelectState?: DatabaseSelectState;
allowOutOfOrder?: boolean;
}>();
const databaseStore = useDatabaseV1Store();
+const databaseGroupStore = useDBGroupStore();
+
const flattenSpecList = computed((): Plan_Spec[] => {
return (
props.previewPlanResult.plan?.steps.flatMap((step) => {
@@ -142,6 +151,31 @@ const flattenSpecList = computed((): Plan_Spec[] => {
);
});
+const targetDatabases = computed(() => {
+ if (!props.databaseSelectState) {
+ return [];
+ }
+ if (props.databaseSelectState.changeSource === "DATABASE") {
+ return props.databaseSelectState.selectedDatabaseNameList.map((name) =>
+ databaseStore.getDatabaseByName(name)
+ );
+ } else {
+ return (
+ databaseGroupStore.getDBGroupByName(
+ props.databaseSelectState.selectedDatabaseNameList[0]
+ )?.matchedDatabases || []
+ );
+ }
+});
+
+// Should show the alert when the number of files to apply is greater than the number of specs in the preview plan.
+const shouldShowAppliedAlert = computed(() => {
+ return (
+ props.release.files.length * targetDatabases.value.length >
+ flattenSpecList.value.length
+ );
+});
+
const databaseForPlanSpec = (spec: Plan_Spec): ComposedDatabase => {
return databaseStore.getDatabaseByName(spec.changeDatabaseConfig!.target);
};
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 1c0155e6a2..c9ecd72857 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -2708,7 +2708,8 @@
"messages": {
"succeed-to-create-release": "Succeed to create release",
"files-will-always-be-sorted-and-executed-in-version-order": "The files will always be sorted and executed in version order.",
- "cannot-modify-files-after-created": "You cannot modify files after the release is created."
+ "cannot-modify-files-after-created": "You cannot modify files after the release is created.",
+ "bytebase-will-skip-those-files-has-been-applied-on-target-database": "Bytebase will automatically skip those files that have already been executed on the target database."
},
"usage-description": "The release is only used in custom GitOps with API integration."
},
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index efac64d444..d5f8b9aa9e 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -2708,7 +2708,8 @@
"messages": {
"succeed-to-create-release": "Tener éxito en crear el lanzamiento",
"files-will-always-be-sorted-and-executed-in-version-order": "Los archivos siempre se ordenarán y ejecutarán en orden de versión.",
- "cannot-modify-files-after-created": "No es posible modificar archivos una vez creada la versión."
+ "cannot-modify-files-after-created": "No es posible modificar archivos una vez creada la versión.",
+ "bytebase-will-skip-those-files-has-been-applied-on-target-database": "Bytebase omitirá automáticamente aquellos archivos que ya se hayan ejecutado en la base de datos de destino."
},
"usage-description": "El lanzamiento solo se utiliza en GitOps personalizado con integración de API."
},
@@ -2748,4 +2749,4 @@
"last-visit": "Última visita",
"changelog-for-version": "Registro de cambios para {version}"
}
-}
+}
\ No newline at end of file
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index 5272a37804..4259baf526 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -2708,7 +2708,8 @@
"messages": {
"succeed-to-create-release": "リリースの作成に成功",
"files-will-always-be-sorted-and-executed-in-version-order": "ファイルは常にバージョン順に並べ替えられ、実行されます。",
- "cannot-modify-files-after-created": "リリースの作成後はファイルを変更できません。"
+ "cannot-modify-files-after-created": "リリースの作成後はファイルを変更できません。",
+ "bytebase-will-skip-those-files-has-been-applied-on-target-database": "Bytebase は、ターゲット データベースですでに実行されているファイルを自動的にスキップします。"
},
"usage-description": "このリリースは、API統合を使用したカスタムGitOpsでのみ使用されます。"
},
@@ -2748,4 +2749,4 @@
"last-visit": "最終訪問",
"changelog-for-version": "{version} の変更履歴"
}
-}
+}
\ No newline at end of file
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index b089864559..2ad8ef4e8d 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -2708,7 +2708,8 @@
"messages": {
"succeed-to-create-release": "成功创建发布",
"files-will-always-be-sorted-and-executed-in-version-order": "文件将始终按照版本顺序排序和执行。",
- "cannot-modify-files-after-created": "发布创建后您无法修改文件。"
+ "cannot-modify-files-after-created": "发布创建后您无法修改文件。",
+ "bytebase-will-skip-those-files-has-been-applied-on-target-database": "Bytebase 将自动跳过那些已经在目标数据库上执行过的文件。"
},
"usage-description": "发布包仅用于自定义的 GitOps 与 Bytebase API 集成。"
},