Skip to content

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

feat: improve the pop-up windows for "Alter schema" and "Change data" (#2187)

ZhengXd030ce8b8447
diff --git a/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue b/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue
index 8616059c6a..81bcd822a5 100644
--- a/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue
+++ b/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue
@@ -1,7 +1,5 @@
<template>
<div class="mx-4 space-y-4 max-w-min overflow-x-hidden">
- <VCSTipsInfo :project="state.project" />
-
<div class="overflow-x-auto">
<div class="mx-1 w-192">
<template v-if="projectId">
@@ -65,34 +63,21 @@
</template>
</template>
<template v-else>
- <NTabs v-model:value="state.tab">
- <NTabPane :tab="$t('project.mode.standard')" name="standard">
- <!-- a simple table -->
- <DatabaseTable
- mode="ALL_SHORT"
- :bordered="true"
- :custom-click="true"
- :database-list="standardProjectDatabaseList"
- @select-database="selectDatabase"
- />
- </NTabPane>
- <NTabPane :tab="$t('project.mode.tenant')" name="tenant">
- <CommonTenantView
- :state="state"
- :database-list="databaseList"
- :environment-list="environmentList"
- @dismiss="cancel"
- />
- </NTabPane>
- <template #suffix>
- <BBTableSearch
- v-if="state.tab === 'standard'"
- class="m-px"
- :placeholder="$t('database.search-database-name')"
- @change-text="(text) => (state.searchText = text)"
- />
- </template>
- </NTabs>
+ <aside class="flex justify-end mb-4">
+ <BBTableSearch
+ class="m-px"
+ :placeholder="$t('database.search-database-name')"
+ @change-text="(text) => (state.searchText = text)"
+ />
+ </aside>
+ <!-- a simple table -->
+ <DatabaseTable
+ mode="ALL_SHORT"
+ :bordered="true"
+ :custom-click="true"
+ :database-list="databaseList"
+ @select-database="selectDatabase"
+ />
</template>
</div>
</div>
@@ -152,16 +137,13 @@ import {
UNKNOWN_ID,
} from "@/types";
import { allowGhostMigration, sortDatabaseList } from "@/utils";
-import VCSTipsInfo from "./VCSTipsInfo.vue";
import ProjectStandardView, {
State as ProjectStandardState,
} from "./ProjectStandardView.vue";
import ProjectTenantView, {
State as ProjectTenantState,
} from "./ProjectTenantView.vue";
-import CommonTenantView, {
- State as CommonTenantState,
-} from "./CommonTenantView.vue";
+import { State as CommonTenantState } from "./CommonTenantView.vue";
import GhostDialog from "./GhostDialog.vue";
import {
hasFeature,
@@ -177,7 +159,6 @@ type LocalState = ProjectStandardState &
ProjectTenantState &
CommonTenantState & {
project?: Project;
- tab: "standard" | "tenant";
showFeatureModal: boolean;
searchText: string;
};
@@ -185,11 +166,9 @@ type LocalState = ProjectStandardState &
export default defineComponent({
name: "AlterSchemaPrepForm",
components: {
- VCSTipsInfo,
DatabaseTable,
ProjectStandardView,
ProjectTenantView,
- CommonTenantView,
NTabs,
NTabPane,
GhostDialog,
@@ -226,7 +205,6 @@ export default defineComponent({
project: props.projectId
? projectStore.getProjectById(props.projectId)
: undefined,
- tab: "standard",
alterType: "SINGLE_DB",
selectedDatabaseIdListForEnvironment: new Map(),
tenantProjectId: undefined,
@@ -270,18 +248,6 @@ export default defineComponent({
return sortDatabaseList(cloneDeep(list), environmentList.value);
});
- const standardProjectDatabaseList = computed(() => {
- return databaseList.value.filter(
- (db) => db.project.tenantMode !== "TENANT"
- );
- });
-
- const tenantProjectDatabaseList = computed(() => {
- return databaseList.value.filter(
- (db) => db.project.tenantMode === "TENANT"
- );
- });
-
const flattenSelectedDatabaseIdList = computed(() => {
const flattenDatabaseIdList: DatabaseId[] = [];
for (const databaseIdList of state.selectedDatabaseIdListForEnvironment.values()) {
@@ -368,10 +334,6 @@ export default defineComponent({
if (isTenantProject.value && state.alterType === "MULTI_DB") {
return true;
}
- // True when no project is selected and "Tenant" tab is selected.
- if (!props.projectId && state.tab === "tenant") {
- return true;
- }
return false;
});
@@ -491,8 +453,6 @@ export default defineComponent({
isTenantProject,
environmentList,
databaseList,
- standardProjectDatabaseList,
- tenantProjectDatabaseList,
showGenerateMultiDb,
allowGenerateMultiDb,
generateMultiDb,
diff --git a/frontend/src/components/AlterSchemaPrepForm/VCSTipsInfo.vue b/frontend/src/components/AlterSchemaPrepForm/VCSTipsInfo.vue
deleted file mode 100644
index c245062f3f..0000000000
--- a/frontend/src/components/AlterSchemaPrepForm/VCSTipsInfo.vue
+++ /dev/null
@@ -1,30 +0,0 @@
-<template>
- <template v-if="project">
- <div v-if="project.workflowType == 'VCS'" class="textlabel">
- {{ $t("alter-schema.vcs-enabled") }}
- </div>
- </template>
- <template v-else>
- <div class="flex flex-row space-x-2 align-top">
- <heroicons-outline:collection class="w-4 h-4 text-control mt-0.5" />
- <p class="textlabel flex-1">
- {{ $t("alter-schema.vcs-info") }}
- </p>
- </div>
- </template>
-</template>
-
-<script lang="ts">
-import { defineComponent, PropType } from "vue";
-import { Project } from "../../types";
-
-export default defineComponent({
- name: "VCSTipsInfo",
- props: {
- project: {
- type: Object as PropType<Project>,
- default: undefined,
- },
- },
-});
-</script>
diff --git a/frontend/src/components/DatabaseTable.vue b/frontend/src/components/DatabaseTable.vue
index 7a7a962427..edd03f681b 100644
--- a/frontend/src/components/DatabaseTable.vue
+++ b/frontend/src/components/DatabaseTable.vue
@@ -51,6 +51,18 @@
<BBTableCell v-if="showProjectColumn" class="w-[15%]">
<div class="flex flex-row space-x-2 items-center">
<div>{{ projectName(database.project) }}</div>
+ <div
+ v-if="
+ ['ALL', 'ALL_SHORT', 'INSTANCE'].includes(mode) &&
+ database.project.tenantMode === 'TENANT'
+ "
+ class="tooltip-wrapper"
+ >
+ <span class="tooltip whitespace-nowrap">
+ {{ $t("project.mode.tenant") }}
+ </span>
+ <TenantIcon class="w-4 h-4 text-control" />
+ </div>
<div class="tooltip-wrapper">
<svg
v-if="database.project.workflowType == 'UI'"
@@ -61,9 +73,13 @@
xmlns="http://www.w3.org/2000/svg"
></svg>
<template v-else-if="database.project.workflowType == 'VCS'">
- <span class="tooltip whitespace-nowrap">
+ <span v-if="mode === 'ALL_SHORT'" class="tooltip w-40">
+ {{ $t("alter-schema.vcs-info") }}
+ </span>
+ <span v-else class="tooltip whitespace-nowrap">
{{ $t("database.version-control-enabled") }}
</span>
+
<heroicons-outline:collection
class="w-4 h-4 text-control hover:text-control-hover"
/>
@@ -186,6 +202,7 @@ import { BBTableColumn } from "../bbkit/types";
import InstanceEngineIcon from "./InstanceEngineIcon.vue";
import { cloneDeep } from "lodash-es";
import { useI18n } from "vue-i18n";
+import TenantIcon from "./TenantIcon.vue";
type Mode = "ALL" | "ALL_SHORT" | "INSTANCE" | "PROJECT" | "PROJECT_SHORT";
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 1c9910d687..7caf6711a0 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -510,7 +510,7 @@
},
"alter-schema": {
"vcs-enabled": "This project has enabled VCS based version control and selecting database below will navigate you to the corresponding Git repository to initiate the change process.",
- "vcs-info": "indicates the project has enabled VCS based version control. Selecting database belonging to such project will navigate you to the corresponding Git repository to initiate the change process.",
+ "vcs-info": "VCS enabled. Selecting this will navigate you to the corresponding Git repository to initiate the change process.",
"alter-single-db": "Alter single database",
"alter-multiple-db": "Alter multiple databases",
"alter-multiple-db-info": "For each environment, you can select multiple databases to alter their schemas or just skip that environment. This allows you to compose a single pipeline to propagate changes across multiple environments."
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index f64c58f014..2179335b0f 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -511,7 +511,7 @@
},
"alter-schema": {
"vcs-enabled": "该项目开启了基于 VCS 的版本管理,选择下面的数据库会将您导航到相应的 Git 仓库以发起变更流程。",
- "vcs-info": "代表项目开启了基于 VCS 的版本管理。选择该类项目下的数据库会将您导航到对应的 Git 仓库以发起变更流程。",
+ "vcs-info": "已开启 VCS 版本管理。选择该数据库会跳转到对应的 Git 仓库以发起变更流程。",
"alter-single-db": "变更单个数据库",
"alter-multiple-db": "变更多个数据库",
"alter-multiple-db-info": "针对每个环境,您可以选择多个数据库进行变更或者直接跳过该环境,这样您就可以在一条流水线上把变更逐步作用到多个环境。"