Skip to content

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

chore: minor improvements for db group (#12753)

boojack174ed8ffa40f
diff --git a/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue b/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue
index 5e237a5f09..e6c93bae0e 100644
--- a/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue
+++ b/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue
@@ -16,8 +16,11 @@
class="space-y-4 h-full w-[calc(100vw-8rem)] lg:w-[60rem] max-w-[calc(100vw-8rem)] overflow-x-auto"
>
<div v-if="ready">
- <NTabs v-model:value="state.databaseSelectedTab">
- <NTabPane :tab="$t('common.database')" name="DATABASE">
+ <NTabs v-model:value="state.selectedTab">
+ <NTabPane
+ :tab="$t('common.database')"
+ :name="DATABASE_CHANGE_TARGET_TYPE.DATABASE"
+ >
<div class="space-y-3">
<div class="w-full flex items-center space-x-2">
<AdvancedSearch
@@ -45,7 +48,10 @@
/>
</div>
</NTabPane>
- <NTabPane :tab="renderDatabaseGroupTabTitle" name="DATABASE_GROUP">
+ <NTabPane
+ :tab="renderDatabaseGroupTabTitle"
+ :name="DATABASE_CHANGE_TARGET_TYPE.DATABASE_GROUP"
+ >
<div class="space-y-3">
<AdvancedSearch
v-model:params="state.params"
@@ -178,10 +184,11 @@ import { useCommonSearchScopeOptions } from "../AdvancedSearch/useCommonSearchSc
import { DatabaseLabelFilter, DrawerContent } from "../v2";
import SchemaEditorModal from "./SchemaEditorModal.vue";
import SchemalessDatabaseTable from "./SchemalessDatabaseTable.vue";
+import { DATABASE_CHANGE_TARGET_TYPE } from "./type";
type LocalState = {
label: string;
- databaseSelectedTab: "DATABASE" | "DATABASE_GROUP";
+ selectedTab: DATABASE_CHANGE_TARGET_TYPE;
showSchemaLessDatabaseList: boolean;
selectedLabels: { key: string; value: string }[];
selectedDatabaseUidList: Set<string>;
@@ -207,6 +214,10 @@ const props = defineProps({
type: Boolean,
default: false,
},
+ defaultSelectedTab: {
+ type: String as PropType<DATABASE_CHANGE_TARGET_TYPE>,
+ default: DATABASE_CHANGE_TARGET_TYPE.DATABASE,
+ },
});
const emit = defineEmits(["dismiss"]);
@@ -234,7 +245,7 @@ const schemaEditorContext = ref<{
const state = reactive<LocalState>({
selectedDatabaseUidList: new Set<string>(),
label: "environment",
- databaseSelectedTab: "DATABASE",
+ selectedTab: props.defaultSelectedTab,
showSchemaLessDatabaseList: false,
showSchemaEditorModal: false,
selectedLabels: [],
@@ -248,7 +259,7 @@ const state = reactive<LocalState>({
const scopeOptions = useCommonSearchScopeOptions(
computed(() => state.params),
computed(() =>
- state.databaseSelectedTab === "DATABASE"
+ state.selectedTab === DATABASE_CHANGE_TARGET_TYPE.DATABASE
? ["project", "instance", "environment"]
: ["project", "environment"]
)
@@ -419,7 +430,7 @@ const flattenSelectedProjectList = computed(() => {
});
const allowGenerateMultiDb = computed(() => {
- if (state.databaseSelectedTab === "DATABASE") {
+ if (state.selectedTab === DATABASE_CHANGE_TARGET_TYPE.DATABASE) {
return (
flattenSelectedProjectList.value.length === 1 &&
flattenSelectedDatabaseUidList.value.length > 0
@@ -462,7 +473,7 @@ const flattenSelectedDatabaseList = computed(() =>
// Also works when single db selected.
const generateMultiDb = async () => {
if (
- state.databaseSelectedTab === "DATABASE_GROUP" &&
+ state.selectedTab === DATABASE_CHANGE_TARGET_TYPE.DATABASE_GROUP &&
state.selectedDatabaseGroupName
) {
previewDatabaseGroupIssue();
diff --git a/frontend/src/components/AlterSchemaPrepForm/type.ts b/frontend/src/components/AlterSchemaPrepForm/type.ts
new file mode 100644
index 0000000000..2e321f9a07
--- /dev/null
+++ b/frontend/src/components/AlterSchemaPrepForm/type.ts
@@ -0,0 +1,4 @@
+export enum DATABASE_CHANGE_TARGET_TYPE {
+ DATABASE = "DATABASE",
+ DATABASE_GROUP = "DATABASE_GROUP",
+}
diff --git a/frontend/src/components/DatabaseGroup/DatabaseGroupDataTable.vue b/frontend/src/components/DatabaseGroup/DatabaseGroupDataTable.vue
index d4ba56c0a5..24a2e816c5 100644
--- a/frontend/src/components/DatabaseGroup/DatabaseGroupDataTable.vue
+++ b/frontend/src/components/DatabaseGroup/DatabaseGroupDataTable.vue
@@ -84,7 +84,7 @@ const columnList = computed((): DatabaseGroupDataTableColumn[] => {
<span>{data.databasePlaceholder}</span>
{data.multitenancy && (
<NTag round type="info" size="small">
- {t("database-group.multitenancy")}
+ {t("database-group.multitenancy.self")}
</NTag>
)}
</div>
diff --git a/frontend/src/components/Project/useProjectSidebar.ts b/frontend/src/components/Project/useProjectSidebar.ts
index 3f8adbc52d..701d13e8e8 100644
--- a/frontend/src/components/Project/useProjectSidebar.ts
+++ b/frontend/src/components/Project/useProjectSidebar.ts
@@ -10,10 +10,11 @@ import {
PencilRuler,
SearchCodeIcon,
DownloadIcon,
+ SquareGanttChartIcon,
} from "lucide-vue-next";
import { computed, h, unref } from "vue";
import type {
- RouteLocationNormalizedLoadedGeneric,
+ RouteLocationNormalizedLoaded,
RouteRecordRaw,
} from "vue-router";
import { useRoute } from "vue-router";
@@ -54,7 +55,7 @@ interface ProjectSidebarItem extends SidebarItem {
export const useProjectSidebar = (
project: MaybeRef<ComposedProject>,
- _route?: RouteLocationNormalizedLoadedGeneric
+ _route?: RouteLocationNormalizedLoaded
) => {
const currentUser = useCurrentUserV1();
const route = _route ?? useRoute();
@@ -141,11 +142,6 @@ export const useProjectSidebar = (
path: PROJECT_V1_ROUTE_DATABASE_GROUPS,
type: "div",
},
- {
- title: t("common.deployment-config"),
- path: PROJECT_V1_ROUTE_DEPLOYMENT_CONFIG,
- type: "div",
- },
{
title: t("common.change-history"),
path: PROJECT_V1_ROUTE_CHANGE_HISTORIES,
@@ -243,6 +239,13 @@ export const useProjectSidebar = (
},
],
},
+ {
+ title: t("common.deployment-config"),
+ icon: () => h(SquareGanttChartIcon),
+ path: PROJECT_V1_ROUTE_DEPLOYMENT_CONFIG,
+ type: "div",
+ hide: isDefaultProject.value,
+ },
{
title: t("common.setting"),
icon: () => h(Settings),
diff --git a/frontend/src/components/QuickActionPanel.vue b/frontend/src/components/QuickActionPanel.vue
index b34781ac16..244e8ef02e 100644
--- a/frontend/src/components/QuickActionPanel.vue
+++ b/frontend/src/components/QuickActionPanel.vue
@@ -49,12 +49,14 @@
v-if="state.quickActionType === 'quickaction.bb.database.schema.update'"
:project-id="project?.uid"
:type="'bb.issue.database.schema.update'"
+ :default-selected-tab="databaseChangeTargetType"
@dismiss="state.quickActionType = undefined"
/>
<AlterSchemaPrepForm
v-if="state.quickActionType === 'quickaction.bb.database.data.update'"
:project-id="project?.uid"
:type="'bb.issue.database.data.update'"
+ :default-selected-tab="databaseChangeTargetType"
@dismiss="state.quickActionType = undefined"
/>
<TransferDatabaseForm
@@ -127,7 +129,10 @@ import RequestQueryPanel from "@/components/Issue/panel/RequestQueryPanel/index.
import ProjectCreatePanel from "@/components/Project/ProjectCreatePanel.vue";
import TransferDatabaseForm from "@/components/TransferDatabaseForm.vue";
import { Drawer } from "@/components/v2";
-import { PROJECT_V1_ROUTE_DATABASE_GROUP_DETAIL } from "@/router/dashboard/projectV1";
+import {
+ PROJECT_V1_ROUTE_DATABASE_GROUP_DETAIL,
+ PROJECT_V1_ROUTE_DATABASE_GROUPS,
+} from "@/router/dashboard/projectV1";
import { PROJECT_V1_ROUTE_DASHBOARD } from "@/router/dashboard/workspaceRoutes";
import {
useInstanceV1Store,
@@ -143,6 +148,7 @@ import type {
DatabaseGroupQuickActionType,
FeatureType,
} from "@/types";
+import { DATABASE_CHANGE_TARGET_TYPE } from "./AlterSchemaPrepForm/type";
interface LocalState {
feature?: FeatureType;
@@ -214,6 +220,13 @@ const shouldShowAlterDatabaseEntries = computed(() => {
.includes(true);
});
+const databaseChangeTargetType = computed(() => {
+ if (route.name?.toString().startsWith(PROJECT_V1_ROUTE_DATABASE_GROUPS)) {
+ return DATABASE_CHANGE_TARGET_TYPE.DATABASE_GROUP;
+ }
+ return DATABASE_CHANGE_TARGET_TYPE.DATABASE;
+});
+
watch(route, () => {
state.quickActionType = undefined;
});
diff --git a/frontend/src/views/DatabaseGroupDetail.vue b/frontend/src/views/DatabaseGroupDetail.vue
index 15f9914b6b..660c41f783 100644
--- a/frontend/src/views/DatabaseGroupDetail.vue
+++ b/frontend/src/views/DatabaseGroupDetail.vue
@@ -23,7 +23,7 @@
<template #icon>
<TenantIcon />
</template>
- {{ $t("database-group.multitenancy") }}
+ {{ $t("database-group.multitenancy.self") }}
</NTag>
</div>
</div>