Skip to content

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

chore: update database group related tables (#11750)

boojacka91a7bcab407
diff --git a/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue b/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue
index fbe605d55f..4c11da72be 100644
--- a/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue
+++ b/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue
@@ -91,13 +91,12 @@
/>
</div>
<div v-else-if="state.databaseSelectedTab === 'DATABASE_GROUP'">
- <SelectDatabaseGroupTable
- :show-selection="true"
+ <DatabaseGroupDataTable
:database-group-list="filteredDatabaseGroupList"
- :selected-database-group-name="
- state.selectedDatabaseGroupName
+ :show-edit="false"
+ @update:selected-database-groups="
+ handleDatabaseGroupsSelectionChanged
"
- @update="(name) => selectDatabaseGroup(name, true)"
/>
</div>
</NTabPane>
@@ -171,13 +170,12 @@
:placeholder="$t('database.filter-database')"
:support-option-id-list="supportOptionIdList"
/>
- <SelectDatabaseGroupTable
+ <DatabaseGroupDataTable
:database-group-list="filteredDatabaseGroupList"
- :selected-database-group-name="
- state.selectedDatabaseGroupName
+ :show-edit="false"
+ @update:selected-database-groups="
+ handleDatabaseGroupsSelectionChanged
"
- :show-selection="true"
- @update="(name) => selectDatabaseGroup(name, true)"
/>
</div>
</NTabPane>
@@ -264,7 +262,7 @@
</template>
<script lang="ts" setup>
-import { uniqBy } from "lodash-es";
+import { head, uniqBy } from "lodash-es";
import {
NButton,
NTabs,
@@ -277,6 +275,7 @@ import type { PropType } from "vue";
import { computed, reactive, ref, watch, watchEffect, h } from "vue";
import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
+import { DatabaseGroupDataTable } from "@/components/DatabaseGroup";
import FeatureBadge from "@/components/FeatureGuard/FeatureBadge.vue";
import DatabaseV1Table from "@/components/v2/Model/DatabaseV1Table";
import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
@@ -314,7 +313,6 @@ import ProjectStandardView from "./ProjectStandardView.vue";
import ProjectTenantView from "./ProjectTenantView.vue";
import SchemaEditorModal from "./SchemaEditorModal.vue";
import SchemalessDatabaseTable from "./SchemalessDatabaseTable.vue";
-import SelectDatabaseGroupTable from "./SelectDatabaseGroupTable.vue";
type LocalState = {
label: string;
@@ -639,6 +637,14 @@ const handleDatabasesSelectionChanged = (
);
};
+const handleDatabaseGroupsSelectionChanged = (
+ databaseGroupNames: Set<string>
+): void => {
+ const databaseGroupName = head(Array.from(databaseGroupNames));
+ if (!databaseGroupName) return;
+ selectDatabaseGroup(databaseGroupName, true);
+};
+
const selectDatabaseGroup = async (
databaseGroupName: string,
showModal = false
diff --git a/frontend/src/components/AlterSchemaPrepForm/SelectDatabaseGroupTable.vue b/frontend/src/components/AlterSchemaPrepForm/SelectDatabaseGroupTable.vue
deleted file mode 100644
index 62f0e024a6..0000000000
--- a/frontend/src/components/AlterSchemaPrepForm/SelectDatabaseGroupTable.vue
+++ /dev/null
@@ -1,88 +0,0 @@
-<template>
- <BBGrid
- :column-list="COLUMN_LIST"
- :data-source="databaseGroupList"
- row-key="name"
- class="border"
- :row-clickable="true"
- :show-placeholder="true"
- @click-row="handleDatabaseGroupSelect"
- >
- <template #item="{ item: dbGroup }: { item: ComposedDatabaseGroup }">
- <div
- v-if="showSelection"
- class="bb-grid-cell justify-center items-center"
- >
- <NRadio
- :checked="state.selectedDatabaseGroupName === dbGroup.name"
- :value="dbGroup.name"
- name="database-group"
- @update:checked="handleDatabaseGroupSelect(dbGroup)"
- >
- </NRadio>
- </div>
- <div class="bb-grid-cell">
- {{ dbGroup.databasePlaceholder }}
- </div>
- <div class="bb-grid-cell">
- <ProjectNameCell :project="dbGroup.projectEntity" />
- </div>
- </template>
- </BBGrid>
-</template>
-
-<script lang="ts" setup>
-import { NRadio } from "naive-ui";
-import { reactive, computed } from "vue";
-import { useI18n } from "vue-i18n";
-import type { BBGridColumn } from "@/bbkit";
-import { ProjectNameCell } from "@/components/v2/Model/DatabaseV1Table/cells";
-import type { ComposedDatabaseGroup } from "@/types";
-
-interface LocalState {
- selectedDatabaseGroupName?: string;
-}
-
-const props = defineProps<{
- databaseGroupList: ComposedDatabaseGroup[];
- selectedDatabaseGroupName?: string;
- showSelection?: boolean;
-}>();
-
-const emit = defineEmits<{
- (event: "update", dbGroupName: string): void;
-}>();
-
-const { t } = useI18n();
-const state = reactive<LocalState>({
- selectedDatabaseGroupName: props.selectedDatabaseGroupName,
-});
-
-const COLUMN_LIST = computed(() => {
- const columns: BBGridColumn[] = [
- { title: t("common.name"), width: "1fr" },
- {
- title: t("common.project"),
- width: "1fr",
- },
- ];
-
- if (props.showSelection) {
- columns.unshift({
- title: "",
- width: "2rem",
- });
- }
-
- return columns;
-});
-
-const handleDatabaseGroupSelect = (dbGroup: ComposedDatabaseGroup) => {
- if (state.selectedDatabaseGroupName === dbGroup.name) {
- return;
- }
-
- state.selectedDatabaseGroupName = dbGroup.name;
- emit("update", state.selectedDatabaseGroupName || "");
-};
-</script>
diff --git a/frontend/src/components/AlterSchemaPrepForm/utils.ts b/frontend/src/components/AlterSchemaPrepForm/utils.ts
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/frontend/src/components/DatabaseGroup/DatabaseGroupDataTable.vue b/frontend/src/components/DatabaseGroup/DatabaseGroupDataTable.vue
new file mode 100644
index 0000000000..3c34c59bf9
--- /dev/null
+++ b/frontend/src/components/DatabaseGroup/DatabaseGroupDataTable.vue
@@ -0,0 +1,138 @@
+<template>
+ <NDataTable
+ size="small"
+ :columns="columnList"
+ :data="data"
+ :striped="true"
+ :bordered="bordered"
+ :loading="loading"
+ :row-key="(data: ComposedDatabaseGroup) => data.name"
+ :checked-row-keys="Array.from(state.selectedDatabaseGroupNameList)"
+ :row-props="rowProps"
+ :pagination="{ pageSize: 20 }"
+ @update:checked-row-keys="
+ (val) => (state.selectedDatabaseGroupNameList = new Set(val as string[]))
+ "
+ ></NDataTable>
+</template>
+
+<script lang="tsx" setup>
+import { NButton, NDataTable, type DataTableColumn } from "naive-ui";
+import { computed, reactive, watch } from "vue";
+import { useI18n } from "vue-i18n";
+import type { ComposedDatabaseGroup } from "@/types";
+
+interface LocalState {
+ // The selected database group name list.
+ selectedDatabaseGroupNameList: Set<string>;
+}
+
+type DatabaseGroupDataTableColumn = DataTableColumn<ComposedDatabaseGroup> & {
+ hide?: boolean;
+};
+
+const props = withDefaults(
+ defineProps<{
+ databaseGroupList: ComposedDatabaseGroup[];
+ bordered?: boolean;
+ loading?: boolean;
+ showSelection?: boolean;
+ showEdit?: boolean;
+ customClick?: boolean;
+ }>(),
+ {
+ bordered: true,
+ showSelection: true,
+ }
+);
+
+const emit = defineEmits<{
+ (
+ event: "row-click",
+ e: MouseEvent,
+ databaseGroup: ComposedDatabaseGroup
+ ): void;
+ (event: "update:selected-database-groups", val: Set<string>): void;
+ (event: "edit", databaseGroup: ComposedDatabaseGroup): void;
+}>();
+
+const { t } = useI18n();
+const state = reactive<LocalState>({
+ selectedDatabaseGroupNameList: new Set(),
+});
+
+const columnList = computed((): DatabaseGroupDataTableColumn[] => {
+ const SELECTION: DatabaseGroupDataTableColumn = {
+ type: "selection",
+ multiple: false,
+ hide: !props.showSelection,
+ cellProps: () => {
+ return {
+ onClick: (e: MouseEvent) => {
+ e.stopPropagation();
+ },
+ };
+ },
+ };
+ const NAME: DatabaseGroupDataTableColumn = {
+ key: "title",
+ title: t("common.name"),
+ render: (data) => {
+ return <span>{data.databasePlaceholder}</span>;
+ },
+ };
+ const EDIT_BUTTON: DatabaseGroupDataTableColumn = {
+ key: "edit",
+ title: "",
+ hide: !props.showEdit,
+ width: 150,
+ render: (data) => {
+ return (
+ <div class="flex justify-end">
+ <NButton
+ size="small"
+ onClick={(e) => {
+ e.preventDefault();
+ e.stopPropagation();
+ emit("edit", data);
+ }}
+ >
+ {t("common.configure")}
+ </NButton>
+ </div>
+ );
+ },
+ };
+
+ // Maybe we can add more columns here. e.g. matched databases, etc.
+ return [SELECTION, NAME, EDIT_BUTTON].filter((column) => !column.hide);
+});
+
+const data = computed(() => {
+ return [...props.databaseGroupList];
+});
+
+const rowProps = (databaseGroup: ComposedDatabaseGroup) => {
+ return {
+ style: "cursor: pointer;",
+ onClick: (e: MouseEvent) => {
+ if (props.customClick) {
+ emit("row-click", e, databaseGroup);
+ return;
+ }
+
+ state.selectedDatabaseGroupNameList = new Set([databaseGroup.name]);
+ },
+ };
+};
+
+watch(
+ () => state.selectedDatabaseGroupNameList,
+ () => {
+ emit(
+ "update:selected-database-groups",
+ state.selectedDatabaseGroupNameList
+ );
+ }
+);
+</script>
diff --git a/frontend/src/components/DatabaseGroup/DatabaseGroupTable.vue b/frontend/src/components/DatabaseGroup/DatabaseGroupTable.vue
deleted file mode 100644
index 28f026ef86..0000000000
--- a/frontend/src/components/DatabaseGroup/DatabaseGroupTable.vue
+++ /dev/null
@@ -1,69 +0,0 @@
-<template>
- <BBGrid
- :column-list="COLUMN_LIST"
- :data-source="databaseGroupList"
- :row-clickable="rowClickable"
- :show-placeholder="true"
- row-key="name"
- class="border"
- @click-row="clickDatabaseGroup"
- >
- <template #item="{ item }: { item: ComposedDatabaseGroup }">
- <div class="bb-grid-cell">
- {{ item.databasePlaceholder }}
- </div>
- <div v-if="props.showEdit" class="bb-grid-cell gap-x-2 justify-end">
- <NButton size="small" @click.stop="$emit('edit', item)">
- {{ $t("common.configure") }}
- </NButton>
- </div>
- </template>
- </BBGrid>
-</template>
-
-<script lang="ts" setup>
-import { computed } from "vue";
-import { useI18n } from "vue-i18n";
-import { useRouter } from "vue-router";
-import type { BBGridColumn } from "@/bbkit";
-import { PROJECT_V1_ROUTE_DATABASE_GROUP_DETAIL } from "@/router/dashboard/projectV1";
-import type { ComposedDatabaseGroup } from "@/types";
-import type { DatabaseGroup } from "@/types/proto/v1/project_service";
-
-const props = defineProps<{
- rowClickable?: boolean;
- databaseGroupList: ComposedDatabaseGroup[];
- showEdit?: boolean;
-}>();
-
-defineEmits<{
- (event: "edit", databaseGroup: DatabaseGroup): void;
-}>();
-
-const { t } = useI18n();
-const router = useRouter();
-
-const COLUMN_LIST = computed(() => {
- const columns: BBGridColumn[] = [{ title: t("common.name"), width: "1fr" }];
- if (props.showEdit) {
- columns.push({
- title: "",
- width: "10rem",
- });
- }
- return columns;
-});
-
-const clickDatabaseGroup = (databaseGroup: ComposedDatabaseGroup) => {
- if (!props.showEdit) {
- return;
- }
-
- router.push({
- name: PROJECT_V1_ROUTE_DATABASE_GROUP_DETAIL,
- params: {
- databaseGroupName: databaseGroup.databaseGroupName,
- },
- });
-};
-</script>
diff --git a/frontend/src/components/DatabaseGroup/ProjectDatabaseGroupPanel.vue b/frontend/src/components/DatabaseGroup/ProjectDatabaseGroupPanel.vue
index 5bc2af40ae..315ac3d801 100644
--- a/frontend/src/components/DatabaseGroup/ProjectDatabaseGroupPanel.vue
+++ b/frontend/src/components/DatabaseGroup/ProjectDatabaseGroupPanel.vue
@@ -2,11 +2,13 @@
<div class="w-full space-y-4">
<FeatureAttention feature="bb.feature.database-grouping" />
- <DatabaseGroupTable
+ <DatabaseGroupDataTable
:database-group-list="databaseGroupList"
:show-edit="allowEdit"
- :row-clickable="hasDatabaseGroupFeature"
- @edit="handleConfigureDatabaseGroup"
+ :custom-click="true"
+ :show-selection="false"
+ @row-click="handleDatabaseGroupClick"
+ @edit="handleEditDatabaseGroup"
/>
</div>
@@ -28,11 +30,13 @@
<script lang="ts" setup>
import { cloneDeep } from "lodash-es";
import { computed, onMounted, reactive } from "vue";
+import { useRouter } from "vue-router";
+import DatabaseGroupDataTable from "@/components/DatabaseGroup/DatabaseGroupDataTable.vue";
+import { PROJECT_V1_ROUTE_DATABASE_GROUP_DETAIL } from "@/router/dashboard/projectV1";
import { useDBGroupStore, hasFeature } from "@/store";
-import type { ComposedProject } from "@/types";
+import type { ComposedDatabaseGroup, ComposedProject } from "@/types";
import type { DatabaseGroup } from "@/types/proto/v1/project_service";
import DatabaseGroupPanel from "./DatabaseGroupPanel.vue";
-import DatabaseGroupTable from "./DatabaseGroupTable.vue";
interface LocalState {
showDatabaseGroupPanel: boolean;
@@ -45,6 +49,7 @@ const props = defineProps<{
allowEdit: boolean;
}>();
+const router = useRouter();
const dbGroupStore = useDBGroupStore();
const state = reactive<LocalState>({
showFeatureModal: false,
@@ -63,7 +68,24 @@ onMounted(async () => {
await dbGroupStore.getOrFetchDBGroupListByProjectName(props.project.name);
});
-const handleConfigureDatabaseGroup = (databaseGroup: DatabaseGroup) => {
+const handleDatabaseGroupClick = (
+ event: MouseEvent,
+ databaseGroup: ComposedDatabaseGroup
+) => {
+ const url = router.resolve({
+ name: PROJECT_V1_ROUTE_DATABASE_GROUP_DETAIL,
+ params: {
+ databaseGroupName: databaseGroup.databaseGroupName,
+ },
+ }).fullPath;
+ if (event.ctrlKey || event.metaKey) {
+ window.open(url, "_blank");
+ } else {
+ router.push(url);
+ }
+};
+
+const handleEditDatabaseGroup = (databaseGroup: ComposedDatabaseGroup) => {
if (!hasDatabaseGroupFeature.value) {
state.showFeatureModal = true;
return;
diff --git a/frontend/src/components/DatabaseGroup/SchemaGroupDataTable.vue b/frontend/src/components/DatabaseGroup/SchemaGroupDataTable.vue
new file mode 100644
index 0000000000..9f8943af00
--- /dev/null
+++ b/frontend/src/components/DatabaseGroup/SchemaGroupDataTable.vue
@@ -0,0 +1,132 @@
+<template>
+ <NDataTable
+ size="small"
+ :columns="columnList"
+ :data="data"
+ :striped="true"
+ :bordered="bordered"
+ :loading="loading"
+ :row-key="(data: ComposedSchemaGroup) => data.name"
+ :checked-row-keys="Array.from(state.selectedSchemaGroupNameList)"
+ :row-props="rowProps"
+ :pagination="{ pageSize: 20 }"
+ @update:checked-row-keys="
+ (val) => (state.selectedSchemaGroupNameList = new Set(val as string[]))
+ "
+ ></NDataTable>
+</template>
+
+<script lang="tsx" setup>
+import { NButton, NDataTable, type DataTableColumn } from "naive-ui";
+import { computed, reactive, watch } from "vue";
+import { useI18n } from "vue-i18n";
+import type { ComposedSchemaGroup } from "@/types";
+
+interface LocalState {
+ // The selected schema group name list.
+ selectedSchemaGroupNameList: Set<string>;
+}
+
+type SchemaGroupDataTableColumn = DataTableColumn<ComposedSchemaGroup> & {
+ hide?: boolean;
+};
+
+const props = withDefaults(
+ defineProps<{
+ schemaGroupList: ComposedSchemaGroup[];
+ bordered?: boolean;
+ loading?: boolean;
+ showSelection?: boolean;
+ showEdit?: boolean;
+ customClick?: boolean;
+ }>(),
+ {
+ bordered: true,
+ showEdit: true,
+ customClick: true,
+ }
+);
+
+const emit = defineEmits<{
+ (event: "row-click", e: MouseEvent, schemaGroup: ComposedSchemaGroup): void;
+ (event: "update:selected-schema-groups", val: Set<string>): void;
+ (event: "edit", schemaGroup: ComposedSchemaGroup): void;
+}>();
+
+const { t } = useI18n();
+const state = reactive<LocalState>({
+ selectedSchemaGroupNameList: new Set(),
+});
+
+const columnList = computed((): SchemaGroupDataTableColumn[] => {
+ const SELECTION: SchemaGroupDataTableColumn = {
+ type: "selection",
+ multiple: false,
+ hide: !props.showSelection,
+ cellProps: () => {
+ return {
+ onClick: (e: MouseEvent) => {
+ e.stopPropagation();
+ },
+ };
+ },
+ };
+ const NAME: SchemaGroupDataTableColumn = {
+ key: "title",
+ title: t("common.name"),
+ render: (data) => {
+ return <span>{data.tablePlaceholder}</span>;
+ },
+ };
+ const EDIT_BUTTON: SchemaGroupDataTableColumn = {
+ key: "edit",
+ title: "",
+ hide: !props.showEdit,
+ width: 150,
+ render: (data) => {
+ return (
+ <div class="flex justify-end">
+ <NButton
+ size="small"
+ onClick={(e) => {
+ e.preventDefault();
+ e.stopPropagation();
+ emit("edit", data);
+ }}
+ >
+ {t("common.configure")}
+ </NButton>
+ </div>
+ );
+ },
+ };
+
+ // Maybe we can add more columns here. e.g. matched tables, etc.
+ return [SELECTION, NAME, EDIT_BUTTON].filter((column) => !column.hide);
+});
+
+const data = computed(() => {
+ return [...props.schemaGroupList];
+});
+
+const rowProps = (schemaGroup: ComposedSchemaGroup) => {
+ return {
+ style: "cursor: pointer;",
+ onClick: (e: MouseEvent) => {
+ if (props.customClick) {
+ emit("row-click", e, schemaGroup);
+ return;
+ }
+
+ state.selectedSchemaGroupNameList = new Set([schemaGroup.name]);
+ },
+ };
+};
+
+watch(
+ () => state.selectedSchemaGroupNameList,
+ () => {
+ emit("update:selected-schema-groups", state.selectedSchemaGroupNameList);
+ }
+);
+</script>
diff --git a/frontend/src/components/DatabaseGroup/SchemaGroupTable.vue b/frontend/src/components/DatabaseGroup/SchemaGroupTable.vue
deleted file mode 100644
index df4969f061..0000000000
--- a/frontend/src/components/DatabaseGroup/SchemaGroupTable.vue
+++ /dev/null
@@ -1,67 +0,0 @@
-<template>
- <BBGrid
- :column-list="COLUMN_LIST"
- :data-source="schemaGroupList"
- :row-clickable="true"
- row-key="name"
- class="border"
- @click-row="clickSchemaGroup"
- >
- <template #item="{ item }: { item: ComposedSchemaGroup }">
- <div class="bb-grid-cell">
- {{ item.tablePlaceholder }}
- </div>
- <div class="bb-grid-cell gap-x-2 justify-end">
- <NButton size="small" @click.stop="$emit('edit', item)">{{
- $t("common.configure")
- }}</NButton>
- </div>
- </template>
- </BBGrid>
-</template>
-
-<script lang="ts" setup>
-import { computed } from "vue";
-import { useI18n } from "vue-i18n";
-import { useRouter } from "vue-router";
-import type { BBGridColumn } from "@/bbkit";
-import { PROJECT_V1_ROUTE_DATABASE_GROUP_TABLE_GROUP_DETAIL } from "@/router/dashboard/projectV1";
-import { getProjectNameAndDatabaseGroupNameAndSchemaGroupName } from "@/store/modules/v1/common";
-import type { ComposedSchemaGroup } from "@/types";
-import type { SchemaGroup } from "@/types/proto/v1/project_service";
-
-defineProps<{
- schemaGroupList: SchemaGroup[];
-}>();
-
-defineEmits<{
- (event: "edit", schemaGroup: SchemaGroup): void;
-}>();
-
-const { t } = useI18n();
-const router = useRouter();
-
-const COLUMN_LIST = computed(() => {
- const columns: BBGridColumn[] = [
- { title: t("common.name"), width: "1fr" },
- {
- title: "",
- width: "10rem",
- },
- ];
-
- return columns;
-});
-
-const clickSchemaGroup = (schemaGroup: ComposedSchemaGroup) => {
- const [, , schemaGroupName] =
- getProjectNameAndDatabaseGroupNameAndSchemaGroupName(schemaGroup.name);
-
- router.push({
- name: PROJECT_V1_ROUTE_DATABASE_GROUP_TABLE_GROUP_DETAIL,
- params: {
- schemaGroupName: schemaGroupName,
- },
- });
-};
-</script>
diff --git a/frontend/src/components/DatabaseGroup/index.ts b/frontend/src/components/DatabaseGroup/index.ts
index e69de29bb2..bd09e86255 100644
--- a/frontend/src/components/DatabaseGroup/index.ts
+++ b/frontend/src/components/DatabaseGroup/index.ts
@@ -0,0 +1,4 @@
+import DatabaseGroupDataTable from "./DatabaseGroupDataTable.vue";
+import SchemaGroupDataTable from "./SchemaGroupDataTable.vue";
+
+export { DatabaseGroupDataTable, SchemaGroupDataTable };
diff --git a/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseV1Table.vue b/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseV1Table.vue
index d1e436abf2..579a039d0a 100644
--- a/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseV1Table.vue
+++ b/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseV1Table.vue
@@ -1,21 +1,19 @@
<template>
- <div>
- <NDataTable
- size="small"
- :columns="columnList"
- :data="data"
- :striped="true"
- :bordered="bordered"
- :loading="loading"
- :row-key="(data: ComposedDatabase) => data.name"
- :checked-row-keys="Array.from(state.selectedDatabaseNameList)"
- :row-props="rowProps"
- :pagination="{ pageSize: 20 }"
- @update:checked-row-keys="
+ <NDataTable
+ size="small"
+ :columns="columnList"
+ :data="data"
+ :striped="true"
+ :bordered="bordered"
+ :loading="loading"
+ :row-key="(data: ComposedDatabase) => data.name"
+ :checked-row-keys="Array.from(state.selectedDatabaseNameList)"
+ :row-props="rowProps"
+ :pagination="{ pageSize: 20 }"
+ @update:checked-row-keys="
(val) => (state.selectedDatabaseNameList = new Set(val as string[]))
"
- ></NDataTable>
- </div>
+ ></NDataTable>
</template>
<script setup lang="tsx">
diff --git a/frontend/src/views/DatabaseGroupDetail.vue b/frontend/src/views/DatabaseGroupDetail.vue
index 79e083f521..64ce55c9f6 100644
--- a/frontend/src/views/DatabaseGroupDetail.vue
+++ b/frontend/src/views/DatabaseGroupDetail.vue
@@ -98,8 +98,9 @@
{{ $t("database-group.table-group.create") }}
</NButton>
</div>
- <SchemaGroupTable
+ <SchemaGroupDataTable
:schema-group-list="schemaGroupList"
+ @row-click="handleSchemaGroupClick"
@edit="handleEditSchemaGroup"
/>
</div>
@@ -127,10 +128,11 @@
import { useDebounceFn } from "@vueuse/core";
import { NButton } from "naive-ui";
import { onMounted, reactive, computed, watch, ref } from "vue";
+import { useRouter } from "vue-router";
import DatabaseGroupPrevEditorModal from "@/components/AlterSchemaPrepForm/DatabaseGroupPrevEditorModal.vue";
+import { SchemaGroupDataTable } from "@/components/DatabaseGroup";
import DatabaseGroupPanel from "@/components/DatabaseGroup/DatabaseGroupPanel.vue";
import MatchedDatabaseView from "@/components/DatabaseGroup/MatchedDatabaseView.vue";
-import SchemaGroupTable from "@/components/DatabaseGroup/SchemaGroupTable.vue";
import type { ResourceType } from "@/components/DatabaseGroup/utils";
import { FactorList } from "@/components/DatabaseGroup/utils";
import {
@@ -139,15 +141,23 @@ import {
} from "@/components/DatabaseGroup/utils";
import ExprEditor from "@/components/ExprEditor";
import type { ConditionGroupExpr } from "@/plugins/cel";
+import { PROJECT_V1_ROUTE_DATABASE_GROUP_TABLE_GROUP_DETAIL } from "@/router/dashboard/projectV1";
import {
useCurrentUserV1,
useDBGroupStore,
useProjectV1Store,
useSubscriptionV1Store,
} from "@/store";
-import { databaseGroupNamePrefix } from "@/store/modules/v1/common";
+import {
+ databaseGroupNamePrefix,
+ getProjectNameAndDatabaseGroupNameAndSchemaGroupName,
+} from "@/store/modules/v1/common";
import { projectNamePrefix } from "@/store/modules/v1/common";
-import type { ComposedDatabase, ComposedDatabaseGroup } from "@/types";
+import type {
+ ComposedDatabase,
+ ComposedDatabaseGroup,
+ ComposedSchemaGroup,
+} from "@/types";
import type {
DatabaseGroup,
SchemaGroup,
@@ -172,6 +182,7 @@ const props = defineProps<{
allowEdit: boolean;
}>();
+const router = useRouter();
const projectStore = useProjectV1Store();
const dbGroupStore = useDBGroupStore();
const subscriptionV1Store = useSubscriptionV1Store();
@@ -243,6 +254,25 @@ const createMigration = (
issueType.value = type;
};
+const handleSchemaGroupClick = (
+ event: MouseEvent,
+ schemaGroup: ComposedSchemaGroup
+) => {
+ const [, , schemaGroupName] =
+ getProjectNameAndDatabaseGroupNameAndSchemaGroupName(schemaGroup.name);
+ const url = router.resolve({
+ name: PROJECT_V1_ROUTE_DATABASE_GROUP_TABLE_GROUP_DETAIL,
+ params: {
+ schemaGroupName: schemaGroupName,
+ },
+ }).fullPath;
+ if (event.ctrlKey || event.metaKey) {
+ window.open(url, "_blank");
+ } else {
+ router.push(url);
+ }
+};
+
watch(
() => [databaseGroup.value],
async () => {