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: add disable status to export data buttons (#11579)
boojack0e9a8f63abbb
diff --git a/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseOperations.vue b/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseOperations.vueindex 02cc9ed980..580599fe83 100644--- a/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseOperations.vue+++ b/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseOperations.vue@@ -253,7 +253,13 @@ const allowTransferProject = computed(() => {});const allowDataExport = computed(() => {- return props.databases.length === 1;+ return props.databases.every((db) => {+ return hasProjectPermissionV2(+ db.projectEntity,+ currentUserV1.value,+ "bb.issues.create"+ );+ });});const allowEditLabels = computed(() => {@@ -398,13 +404,18 @@ const actions = computed((): DatabaseAction[] => {{icon: h(DownloadIcon),text: t("custom-approval.risk-rule.risk.namespace.data_export"),- disabled: !allowDataExport.value,+ disabled: !allowDataExport.value || props.databases.length !== 1,click: () => generateMultiDb("bb.issue.database.data.export"),- tooltip: () => {- if (props.databases.length === 0 || allowDataExport.value) {- return "";+ tooltip: (action) => {+ if (!allowDataExport.value) {+ return t("database.batch-action-permission-denied", {+ action,+ });+ }+ if (props.databases.length > 1) {+ return t("database.data-export-action-disabled");}- return t("database.data-export-action-disabled");+ return "";},},{diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex 1d2d5ed58f..79f5b3c92f 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -3214,7 +3214,8 @@}},"export-center": {- "self": "Export Center"+ "self": "Export Center",+ "permission-denied": "Permission denied"},"schema-designer": {"self": "Schema Designer",diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex 76869685d7..98afb3a3a7 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -3214,7 +3214,8 @@}},"export-center": {- "self": "centro de exportacion"+ "self": "centro de exportacion",+ "permission-denied": "Permiso denegado"},"schema-designer": {"self": "Diseñador de esquemas",@@ -3409,4 +3410,4 @@"head": "Cabeza","show-diff-with-branch-baseline": "Mostrar diferencia con la línea base de la rama"}-}+}\ No newline at end of filediff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex 40cf24a201..768e748156 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -3214,7 +3214,8 @@}},"export-center": {- "self": "エクスポートセンター"+ "self": "エクスポートセンター",+ "permission-denied": "許可が拒否されました"},"schema-designer": {"self": "スキーマデザイナー",@@ -3409,4 +3410,4 @@"head": "頭","show-diff-with-branch-baseline": "ブランチベースラインとの差分を表示"}-}+}\ No newline at end of filediff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.jsonindex 47b0e46906..817c7ea73d 100644--- a/frontend/src/locales/vi-VN.json+++ b/frontend/src/locales/vi-VN.json@@ -3214,7 +3214,8 @@}},"export-center": {- "self": "Trung tâm xuất khẩu"+ "self": "Trung tâm xuất khẩu",+ "permission-denied": "Quyền bị từ chối"},"schema-designer": {"self": "Nhà thiết kế lược đồ",@@ -3409,4 +3410,4 @@"head": "Cái đầu","show-diff-with-branch-baseline": "Hiển thị sự khác biệt với đường cơ sở của nhánh"}-}+}\ No newline at end of filediff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex b5d6a01116..ba848e8e5f 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -3214,7 +3214,8 @@}},"export-center": {- "self": "导出中心"+ "self": "导出中心",+ "permission-denied": "您没有权限执行此操作"},"schema-designer": {"self": "Schema 设计器",diff --git a/frontend/src/views/ExportCenter/index.vue b/frontend/src/views/ExportCenter/index.vueindex 526637c487..817873f0d5 100644--- a/frontend/src/views/ExportCenter/index.vue+++ b/frontend/src/views/ExportCenter/index.vue@@ -11,9 +11,18 @@:support-option-id-list="supportOptionIdList"/></div>- <NButton type="primary" @click="state.showRequestExportPanel = true">- {{ $t("quick-action.request-export-data") }}- </NButton>+ <NTooltip :disabled="allowDataExport">+ <template #trigger>+ <NButton+ type="primary"+ :disabled="!allowDataExport"+ @click="state.showRequestExportPanel = true"+ >+ {{ $t("quick-action.request-export-data") }}+ </NButton>+ </template>+ {{ $t("export-center.permission-denied") }}+ </NTooltip></div><div class="relative w-full mt-4 min-h-[20rem]">@@ -50,7 +59,7 @@</template><script lang="ts" setup>-import { NButton } from "naive-ui";+import { NButton, NTooltip } from "naive-ui";import { computed, reactive } from "vue";import DataExportPrepForm from "@/components/DataExportPrepForm";import PagedIssueTableV1 from "@/components/IssueV1/components/PagedIssueTableV1.vue";@@ -61,6 +70,7 @@ import {buildIssueFilterBySearchParams,buildUIIssueFilterBySearchParams,extractProjectResourceName,+ hasProjectPermissionV2,type SearchParams,type SearchScopeId,} from "@/utils";@@ -143,4 +153,18 @@ const supportOptionIdList = computed((): SearchScopeId[] => {}return scopes;});++const allowDataExport = computed(() => {+ if (specificProject.value) {+ return hasProjectPermissionV2(+ specificProject.value,+ currentUser.value,+ "bb.issues.create"+ );+ }++ return projectV1Store.projectList.some((project) =>+ hasProjectPermissionV2(project, currentUser.value, "bb.issues.create")+ );+});</script>