Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: show detail message for action disabled reason (#9804)
ecmadao25c78d60914c
diff --git a/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseOperations.vue b/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseOperations.vueindex ffba4615c0..a5aadc1a1c 100644--- a/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseOperations.vue+++ b/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseOperations.vue@@ -10,9 +10,7 @@}}<div class="flex items-center"><template v-for="action in actions" :key="action.text">- <NTooltip- :disabled="!action.disabled || !getDisabledTooltip(action.text)"- >+ <NTooltip :disabled="!action.disabled || !action.tooltip(action.text)"><template #trigger><NButtonquaternary@@ -28,7 +26,7 @@</NButton></template><span class="w-56 text-sm">- {{ getDisabledTooltip(action.text) }}+ {{ action.tooltip(action.text) }}</span></NTooltip></template>@@ -106,6 +104,7 @@ interface DatabaseAction {text: string;disabled: boolean;click: () => void;+ tooltip: (action: string) => string;}interface LocalState {@@ -201,6 +200,12 @@ const canEditDatabase = (return false;};+const databaseSupportAlterSchema = computed(() => {+ return props.databases.every((db) => {+ return instanceV1HasAlterSchema(db.instanceEntity);+ });+});+const allowEditSchema = computed(() => {return props.databases.every((db) => {return (@@ -326,44 +331,77 @@ const actions = computed((): DatabaseAction[] => {text: t("common.sync"),disabled: props.databases.length < 1,click: syncSchema,+ tooltip: (action) => getDisabledTooltip(action),});- if (allowTransferProject.value) {- resp.unshift({- icon: h(SwitchHorizontalIcon),- text: t("database.transfer-project"),- disabled: !selectedProjectUid.value,- click: () => (state.showTransferOutDatabaseForm = true),- });- }- if (allowEditLabels.value) {- resp.push({- icon: h(TagIcon),- text: t("database.edit-labels"),- disabled: props.databases.length < 1,- click: () => (state.showLabelEditorDrawer = true),- });- }- }- if (allowChangeData.value) {resp.unshift({+ icon: h(SwitchHorizontalIcon),+ text: t("database.transfer-project"),+ disabled: !allowTransferProject.value || !selectedProjectUid.value,+ click: () => (state.showTransferOutDatabaseForm = true),+ tooltip: (action) => {+ if (!allowTransferProject.value) {+ return t("database.batch-action-permission-denied", {+ action,+ });+ }+ return getDisabledTooltip(action);+ },+ });+ resp.push({+ icon: h(TagIcon),+ text: t("database.edit-labels"),+ disabled: !allowEditLabels.value || props.databases.length < 1,+ click: () => (state.showLabelEditorDrawer = true),+ tooltip: (action) => {+ if (!allowEditLabels.value) {+ return t("database.batch-action-permission-denied", {+ action,+ });+ }+ return getDisabledTooltip(action);+ },+ });+ }+ resp.unshift(+ {icon: h(PencilIcon),text: t("database.change-data"),disabled:+ !allowChangeData.value ||!selectedProjectUid.value ||selectedProjectNames.value.has(DEFAULT_PROJECT_V1_NAME),click: () => generateMultiDb("bb.issue.database.data.update"),- });- }- if (allowEditSchema.value) {- resp.unshift({+ tooltip: (action) => {+ if (!allowChangeData.value) {+ return t("database.batch-action-permission-denied", {+ action,+ });+ }+ return getDisabledTooltip(action);+ },+ },+ {icon: h(PencilAltIcon),text: t("database.edit-schema"),disabled:+ !databaseSupportAlterSchema.value ||+ !allowEditSchema.value ||!selectedProjectUid.value ||selectedProjectNames.value.has(DEFAULT_PROJECT_V1_NAME),click: () => generateMultiDb("bb.issue.database.schema.update"),- });- }+ tooltip: (action) => {+ if (!databaseSupportAlterSchema.value) {+ return t("database.batch-action-not-support-alter-schema");+ }+ if (!allowEditSchema.value) {+ return t("database.batch-action-permission-denied", {+ action,+ });+ }+ return getDisabledTooltip(action);+ },+ }+ );return resp;});diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex bdb5a19f5a..b2e91e131c 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -1528,6 +1528,8 @@"select-branch": "Select a branch","delete-this-branch": "Delete this branch","table-detail": "Table detail",+ "batch-action-not-support-alter-schema": "Some databases don't support altering schema",+ "batch-action-permission-denied": "Don't have permission to {action} for databases","batch-action-disabled": "Can not {action} for the databases from different projects","batch-action-disabled-for-unassigned": "Can not {action} for unassigned database","successfully-transferred-updateddatabase-name-to-project-updateddatabase-project-name": "Successfully transferred '{0}' to project '{1}'.",diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex 34f693f69c..3641d3e5ae 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -1527,6 +1527,8 @@"select-branch": "Seleccione una rama","delete-this-branch": "Eliminar esta rama","table-detail": "Detalle de la tabla",+ "batch-action-not-support-alter-schema": "Algunas bases de datos no admiten la modificación del esquema",+ "batch-action-permission-denied": "No tengo permiso para {action} para bases de datos","batch-action-disabled": "No se puede {action} para las bases de datos de diferentes proyectos","batch-action-disabled-for-unassigned": "No se puede {action} para una base de datos no asignada","successfully-transferred-updateddatabase-name-to-project-updateddatabase-project-name": "Se transfirió correctamente '{0}' al proyecto '{1}'.",diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex ab55ba7cdd..245e6b50a1 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -1524,6 +1524,8 @@"select-branch": "选择一个分支","delete-this-branch": "删除这个分支","table-detail": "表详情",+ "batch-action-not-support-alter-schema": "一些数据库不支持修改表结构",+ "batch-action-permission-denied": "没有权限对数据库{action}","batch-action-disabled": "无法对来自不同项目的数据库{action}","batch-action-disabled-for-unassigned": "无法对未分配的数据库{action}","successfully-transferred-updateddatabase-name-to-project-updateddatabase-project-name": "成功将'{0}'转移到项目'{1}'。",