Skip to content

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

fix: add quick action for tenant project (#9853)

ecmadaof18e2ca78286
diff --git a/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue b/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue
index 96e85d9107..904f84c5ee 100644
--- a/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue
+++ b/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue
@@ -211,6 +211,7 @@
:custom-click="true"
:database-list="selectableDatabaseList"
:show-selection-column="true"
+ :show-sql-editor-button="false"
@select-database="
(db: ComposedDatabase) =>
toggleDatabasesSelection([db as ComposedDatabase], !isDatabaseSelected(db))
diff --git a/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseTableRow.vue b/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseTableRow.vue
index 4faccd6388..4325b2f03e 100644
--- a/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseTableRow.vue
+++ b/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseTableRow.vue
@@ -9,7 +9,7 @@
<div class="bb-grid-cell">
<div class="flex items-center space-x-2">
<SQLEditorButtonV1
- v-if="!isStandaloneMode"
+ v-if="showSqlEditorButton"
:database="database"
:disabled="!allowQuery"
:tooltip="true"
@@ -56,7 +56,7 @@
<script lang="ts" setup>
import { computed } from "vue";
import { InstanceV1Name, EnvironmentV1Name } from "@/components/v2";
-import { useEnvironmentV1Store, usePageMode } from "@/store";
+import { useEnvironmentV1Store } from "@/store";
import { ComposedDatabase } from "@/types";
import { isPITRDatabaseV1 } from "@/utils";
import LabelsColumn from "./LabelsColumn.vue";
@@ -73,20 +73,15 @@ const props = defineProps<{
showEnvironmentColumn: boolean;
showInstanceColumn: boolean;
showLabelsColumn: boolean;
+ showSqlEditorButton: boolean;
allowQuery: boolean;
}>();
defineEmits(["goto-sql-editor-failed"]);
-const pageMode = usePageMode();
-
const environment = computed(() => {
return useEnvironmentV1Store().getEnvironmentByName(
props.database.environment
);
});
-
-const isStandaloneMode = computed(() => {
- return pageMode.value === "STANDALONE";
-});
</script>
diff --git a/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseV1Table.vue b/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseV1Table.vue
index fdc1cdbb90..ed2b037367 100644
--- a/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseV1Table.vue
+++ b/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseV1Table.vue
@@ -45,6 +45,7 @@
:show-tenant-icon="showTenantIcon"
:show-instance-column="showInstanceColumn"
:show-labels-column="showLabelsColumn"
+ :show-sql-editor-button="showSQLEditorButton"
:allow-query="allowQuery(database as ComposedDatabase)"
@goto-sql-editor-failed="
handleGotoSQLEditorFailed(database as ComposedDatabase)
@@ -150,9 +151,8 @@ import {
import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
import { BBGridColumn } from "@/bbkit/types";
-import { useCurrentUserV1 } from "@/store";
+import { usePolicyV1Store, usePageMode, useCurrentUserV1 } from "@/store";
import { getProjectNameAndDatabaseGroupName } from "@/store/modules/v1/common";
-import { usePolicyV1Store } from "@/store/modules/v1/policy";
import { ComposedDatabase, ComposedDatabaseGroup } from "@/types";
import {
Policy,
@@ -248,6 +248,11 @@ const props = defineProps({
type: Boolean,
default: undefined,
},
+ showSqlEditorButton: {
+ required: false,
+ type: Boolean,
+ default: true,
+ },
});
const emit = defineEmits(["select-database"]);
@@ -259,6 +264,7 @@ const state = reactive<LocalState>({
showIncorrectProjectModal: false,
showReservedDatabaseList: false,
});
+const pageMode = usePageMode();
const wrapper = ref<HTMLElement>();
const regularDatabaseList = computed(() =>
@@ -375,6 +381,10 @@ const showMiscColumn = computed(() => {
return true;
});
+const showSQLEditorButton = computed(() => {
+ return pageMode.value === "BUNDLED" && props.showSqlEditorButton;
+});
+
const columnList = computed(() => {
const list = cloneDeep(columnListMap.value.get(props.mode)!).filter(Boolean);
if (props.showSelectionColumn) {
diff --git a/frontend/src/views/ProjectDetail.vue b/frontend/src/views/ProjectDetail.vue
index 09cb687829..646aa6d2f4 100644
--- a/frontend/src/views/ProjectDetail.vue
+++ b/frontend/src/views/ProjectDetail.vue
@@ -103,6 +103,7 @@ import {
} from "@/types";
import { State } from "@/types/proto/v1/common";
import { LogEntity_Action } from "@/types/proto/v1/logging_service";
+import { TenantMode } from "@/types/proto/v1/project_service";
import {
idFromSlug,
projectV1Slug,
@@ -251,11 +252,22 @@ const quickActionMapByRole = computed(() => {
pull(DEVELOPER_QUICK_ACTION_LIST, "quickaction.bb.database.create");
}
- return new Map([
- ["OWNER", DBA_AND_OWNER_QUICK_ACTION_LIST],
- ["DBA", DBA_AND_OWNER_QUICK_ACTION_LIST],
+ const map = new Map([
+ ["OWNER", [...DBA_AND_OWNER_QUICK_ACTION_LIST]],
+ ["DBA", [...DBA_AND_OWNER_QUICK_ACTION_LIST]],
["DEVELOPER", DEVELOPER_QUICK_ACTION_LIST],
]) as Map<RoleType, QuickActionType[]>;
+
+ if (project.value.tenantMode === TenantMode.TENANT_MODE_ENABLED) {
+ for (const value of map.values()) {
+ value.push(
+ "quickaction.bb.database.data.update",
+ "quickaction.bb.database.schema.update"
+ );
+ }
+ }
+
+ return map;
}
return new Map<RoleType, QuickActionType[]>();