Skip to content

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

feat(frontend): database list improvement (#3954)

Liu Ji224919cd2c5f
diff --git a/frontend/src/bbkit/BBGrid/BBGrid.vue b/frontend/src/bbkit/BBGrid/BBGrid.vue
index f54c3bd01b..444ce352a5 100644
--- a/frontend/src/bbkit/BBGrid/BBGrid.vue
+++ b/frontend/src/bbkit/BBGrid/BBGrid.vue
@@ -1,5 +1,10 @@
<template>
- <div role="table" class="bb-grid border-block-border" :class="gridClass">
+ <div
+ role="table"
+ class="bb-grid border-block-border"
+ :class="gridClass"
+ v-bind="$attrs"
+ >
<template v-if="customHeader">
<slot name="header" />
</template>
@@ -27,9 +32,9 @@
>
<slot name="item" :item="item" :row="row" />
</div>
-
- <slot name="footer" />
</div>
+
+ <slot name="footer" />
</template>
<script lang="ts" setup>
diff --git a/frontend/src/components/AccessControl/AddRuleForm.vue b/frontend/src/components/AccessControl/AddRuleForm.vue
index 4c7dec5b12..63687f2a69 100644
--- a/frontend/src/components/AccessControl/AddRuleForm.vue
+++ b/frontend/src/components/AccessControl/AddRuleForm.vue
@@ -10,7 +10,8 @@
<DatabaseTable
mode="ALL_TINY"
- :bordered="true"
+ class="max-h-[55vh] overflow-y-auto"
+ table-class="border"
:custom-click="true"
:database-list="databaseList"
:show-selection-column="true"
diff --git a/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue b/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue
index b356ea2ac1..181c990639 100644
--- a/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue
+++ b/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue
@@ -8,6 +8,7 @@
<NTabs v-model:value="state.alterType">
<NTabPane :tab="$t('alter-schema.alter-db-group')" name="TENANT">
<ProjectTenantView
+ class="max-h-[55vh] overflow-y-auto"
:state="state"
:database-list="databaseList"
:environment-list="environmentList"
@@ -21,7 +22,8 @@
>
<DatabaseTable
mode="PROJECT_SHORT"
- :bordered="true"
+ class="max-h-[55vh] overflow-y-auto"
+ table-class="border"
:custom-click="true"
:database-list="databaseList"
:show-selection-column="true"
@@ -81,7 +83,7 @@
<!-- a simple table -->
<DatabaseTable
mode="ALL_SHORT"
- :bordered="true"
+ table-class="border"
:custom-click="true"
:database-list="databaseList"
@select-database="selectDatabase"
diff --git a/frontend/src/components/AlterSchemaPrepForm/ProjectStandardView.vue b/frontend/src/components/AlterSchemaPrepForm/ProjectStandardView.vue
index 1203d63ea2..f13a2929ac 100644
--- a/frontend/src/components/AlterSchemaPrepForm/ProjectStandardView.vue
+++ b/frontend/src/components/AlterSchemaPrepForm/ProjectStandardView.vue
@@ -8,7 +8,7 @@
{{ $t("alter-schema.alter-multiple-db-info") }}
</div>
<slot name="header"></slot>
- <div class="space-y-4">
+ <div class="space-y-4 max-h-[55vh] overflow-y-auto">
<div
v-for="{
environment,
@@ -53,7 +53,7 @@
: 'cursor-not-allowed'
"
>
- <div class="radio text-sm">
+ <div class="radio text-sm flex justify-start">
<input
type="checkbox"
class="h-4 w-4 text-accent rounded disabled:cursor-not-allowed border-control-border focus:ring-accent"
@@ -66,12 +66,8 @@
@input="(e: any) => toggleDatabaseIdForEnvironment(database.id, environment.id, e.target.checked)"
/>
<span
- class="font-medium"
- :class="
- database.syncStatus == 'OK'
- ? 'ml-2 text-main'
- : 'ml-6 text-control-light'
- "
+ class="font-medium ml-2 text-main"
+ :class="database.syncStatus !== 'OK' && 'opacity-40'"
>{{ database.name }}</span
>
</div>
@@ -99,7 +95,7 @@
<slot name="header"></slot>
<DatabaseTable
mode="PROJECT_SHORT"
- :bordered="true"
+ table-class="border"
:custom-click="true"
:database-list="databaseList"
@select-database="selectDatabase"
diff --git a/frontend/src/components/DatabaseTable.vue b/frontend/src/components/DatabaseTable.vue
index 5b472295d4..4cf9a17e2c 100644
--- a/frontend/src/components/DatabaseTable.vue
+++ b/frontend/src/components/DatabaseTable.vue
@@ -1,201 +1,203 @@
<template>
- <BBTable
- :column-list="columnList"
- :data-source="mixedDatabaseList"
- :show-header="true"
- :left-bordered="bordered"
- :right-bordered="bordered"
- :top-bordered="bordered"
- :bottom-bordered="bordered"
- :custom-header="true"
- header-class="capitalize"
- data-label="bb-database-table"
- @click-row="clickDatabase"
- >
- <template #header>
- <tr>
- <th
- v-for="(column, index) in columnList"
- :key="index"
- scope="col"
- class="py-2 text-left text-xs font-medium text-gray-500 tracking-wider capitalize"
- :class="[
- !showSelectionColumn && index === 0 ? 'pl-4' : 'pl-2',
- column.center && 'text-center pr-2',
- ]"
- >
- <template v-if="showSelectionColumn && index === 0">
- <slot name="selection-all" :database-list="mixedDatabaseList" />
- </template>
- <template v-else>{{ column.title }}</template>
- </th>
- </tr>
- </template>
-
- <template #body="{ rowData: database }: { rowData: Database }">
- <BBTableCell v-if="showSelectionColumn" class="w-[1%]">
- <!-- width: 1% means as narrow as possible -->
- <slot name="selection" :database="database" />
- </BBTableCell>
- <BBTableCell :left-padding="showSelectionColumn ? 2 : 4" class="w-[25%]">
- <div class="flex items-center space-x-2">
- <button
- v-if="showSQLEditorLink"
- class="btn-icon tooltip-wrapper disabled:hover:text-control"
- :disabled="!allowQuery(database)"
- @click.stop="gotoSQLEditor(database)"
- >
- <heroicons-solid:terminal class="w-5 h-5" />
- <div v-if="allowQuery(database)" class="tooltip whitespace-nowrap">
- {{ $t("sql-editor.self") }}
- </div>
- </button>
- <span>{{ database.name }}</span>
- <BBBadge
- v-if="isPITRDatabase(database)"
- text="PITR"
- :can-remove="false"
- class="text-xs"
- />
- <NTooltip
- v-if="!showMiscColumn && database.syncStatus != 'OK'"
- placement="right"
- >
- <template #trigger>
- <heroicons-outline:exclamation-circle
- class="w-5 h-5 text-error"
- />
- </template>
-
- <div class="whitespace-nowrap">
- {{
- $t("database.last-sync-status-long", [
- database.syncStatus,
- humanizeTs(database.lastSuccessfulSyncTs),
- ])
- }}
- </div>
- </NTooltip>
- </div>
- </BBTableCell>
- <BBTableCell v-if="showSchemaVersionColumn" class="w-[10%]">
- {{ database.schemaVersion }}
- </BBTableCell>
- <BBTableCell v-if="showProjectColumn" class="w-[15%]">
- <div class="flex flex-row space-x-2 items-center">
- <div>{{ projectName(database.project) }}</div>
+ <div ref="wrapper" rule="database-table" v-bind="$attrs">
+ <BBGrid
+ :column-list="columnList"
+ :data-source="pagedDataSource"
+ :custom-header="true"
+ :class="tableClass"
+ @click-row="clickDatabase"
+ >
+ <template #header>
+ <div role="table-row" class="bb-grid-row bb-grid-header-row group">
<div
- v-if="showTenantIcon && database.project.tenantMode === 'TENANT'"
- class="tooltip-wrapper"
+ v-for="(column, index) in columnList"
+ :key="index"
+ role="table-cell"
+ class="bb-grid-header-cell capitalize"
+ :class="[column.class]"
>
- <span class="tooltip whitespace-nowrap">
- {{ $t("project.mode.tenant") }}
- </span>
- <TenantIcon class="w-4 h-4 text-control" />
- </div>
- <div class="tooltip-wrapper">
- <svg
- v-if="database.project.workflowType == 'UI'"
- class="w-4 h-4"
- fill="none"
- stroke="currentColor"
- viewBox="0 0 24 24"
- xmlns="http://www.w3.org/2000/svg"
- ></svg>
- <template v-else-if="database.project.workflowType == 'VCS'">
- <span v-if="mode === 'ALL_SHORT'" class="tooltip w-40">
- {{ $t("alter-schema.vcs-info") }}
- </span>
- <span v-else class="tooltip whitespace-nowrap">
- {{ $t("database.version-control-enabled") }}
- </span>
-
- <heroicons-outline:collection
- class="w-4 h-4 text-control hover:text-control-hover"
- />
+ <template v-if="showSelectionColumn && index === 0">
+ <slot name="selection-all" :database-list="mixedDatabaseList" />
</template>
+ <template v-else>{{ column.title }}</template>
</div>
</div>
- </BBTableCell>
- <BBTableCell v-if="showEnvironmentColumn" class="w-[10%]">
- <div class="flex items-center">
- {{ environmentName(database.instance.environment) }}
- <ProtectedEnvironmentIcon
- class="ml-1"
- :environment="database.instance.environment"
- />
- </div>
- </BBTableCell>
- <BBTableCell v-if="showInstanceColumn" class="w-[25%]">
- <div class="flex flex-row items-center space-x-1">
- <InstanceEngineIcon :instance="database.instance" />
- <span class="flex-1 whitespace-pre-wrap">
- {{ instanceName(database.instance) }}
- </span>
+ </template>
+
+ <template #item="{ item: database }: { item: Database }">
+ <div v-if="showSelectionColumn" class="bb-grid-cell !px-2">
+ <slot name="selection" :database="database" />
</div>
- </BBTableCell>
- <BBTableCell v-if="showMiscColumn" class="w-[8%]">
- <div class="w-full flex justify-center">
- <NTooltip placement="left">
- <template #trigger>
+ <div class="bb-grid-cell">
+ <div class="flex items-center space-x-2">
+ <button
+ v-if="showSQLEditorLink"
+ class="btn-icon tooltip-wrapper disabled:hover:text-control"
+ :disabled="!allowQuery(database)"
+ @click.stop="gotoSQLEditor(database)"
+ >
+ <heroicons-solid:terminal class="w-5 h-5" />
<div
- class="flex items-center justify-center rounded-full select-none w-5 h-5 overflow-hidden text-white font-medium text-base"
- :class="
- database.syncStatus === 'OK' ? 'bg-success' : 'bg-error'
- "
+ v-if="allowQuery(database)"
+ class="tooltip whitespace-nowrap"
>
- <template v-if="database.syncStatus === 'OK'">
- <heroicons-solid:check class="w-4 h-4" />
- </template>
- <template v-else>
- <span
- class="h-2 w-2 flex items-center justify-center"
- aria-hidden="true"
- >!</span
- >
- </template>
+ {{ $t("sql-editor.self") }}
</div>
- </template>
-
- <span>
- <template v-if="database.syncStatus === 'OK'">
- {{
- $t("database.synced-at", {
- time: humanizeTs(database.lastSuccessfulSyncTs),
- })
- }}
+ </button>
+ <span>{{ database.name }}</span>
+ <BBBadge
+ v-if="isPITRDatabase(database)"
+ text="PITR"
+ :can-remove="false"
+ class="text-xs"
+ />
+ <NTooltip
+ v-if="!showMiscColumn && database.syncStatus != 'OK'"
+ placement="right"
+ >
+ <template #trigger>
+ <heroicons-outline:exclamation-circle
+ class="w-5 h-5 text-error"
+ />
</template>
- <template v-else>
+
+ <div class="whitespace-nowrap">
{{
- $t("database.not-found-last-successful-sync-was", {
- time: humanizeTs(database.lastSuccessfulSyncTs),
- })
+ $t("database.last-sync-status-long", [
+ database.syncStatus,
+ humanizeTs(database.lastSuccessfulSyncTs),
+ ])
}}
- </template>
- </span>
- </NTooltip>
+ </div>
+ </NTooltip>
+ </div>
</div>
- </BBTableCell>
- </template>
-
- <template
- v-if="hasReservedDatabases && !state.showReservedDatabaseList"
- #footer
- >
- <tfoot>
- <tr>
- <td :colspan="columnList.length" class="p-0">
+ <div v-if="showSchemaVersionColumn" class="hidden lg:bb-grid-cell">
+ {{ database.schemaVersion }}
+ </div>
+ <div v-if="showProjectColumn" class="bb-grid-cell">
+ <div class="flex flex-row space-x-2 items-center">
+ <div>{{ projectName(database.project) }}</div>
<div
- class="flex items-center justify-center cursor-pointer hover:bg-gray-200 py-2 text-gray-400 text-sm"
- @click="state.showReservedDatabaseList = true"
+ v-if="showTenantIcon && database.project.tenantMode === 'TENANT'"
+ class="tooltip-wrapper"
>
- {{ $t("database.show-reserved-databases") }}
+ <span class="tooltip whitespace-nowrap">
+ {{ $t("project.mode.tenant") }}
+ </span>
+ <TenantIcon class="w-4 h-4 text-control" />
+ </div>
+ <div class="tooltip-wrapper">
+ <svg
+ v-if="database.project.workflowType == 'UI'"
+ class="w-4 h-4"
+ fill="none"
+ stroke="currentColor"
+ viewBox="0 0 24 24"
+ xmlns="http://www.w3.org/2000/svg"
+ ></svg>
+ <template v-else-if="database.project.workflowType == 'VCS'">
+ <span v-if="mode === 'ALL_SHORT'" class="tooltip w-40">
+ {{ $t("alter-schema.vcs-info") }}
+ </span>
+ <span v-else class="tooltip whitespace-nowrap">
+ {{ $t("database.version-control-enabled") }}
+ </span>
+
+ <heroicons-outline:collection
+ class="w-4 h-4 text-control hover:text-control-hover"
+ />
+ </template>
</div>
- </td>
- </tr>
- </tfoot>
- </template>
- </BBTable>
+ </div>
+ </div>
+ <div v-if="showEnvironmentColumn" class="bb-grid-cell">
+ <div class="flex items-center">
+ {{ environmentName(database.instance.environment) }}
+ <ProtectedEnvironmentIcon
+ class="ml-1"
+ :environment="database.instance.environment"
+ />
+ </div>
+ </div>
+ <div v-if="showInstanceColumn" class="bb-grid-cell">
+ <div class="flex flex-row items-center space-x-1">
+ <InstanceEngineIcon :instance="database.instance" />
+ <span class="flex-1 whitespace-pre-wrap">
+ {{ instanceName(database.instance) }}
+ </span>
+ </div>
+ </div>
+ <div v-if="showMiscColumn" class="bb-grid-cell">
+ <div class="w-full flex justify-center">
+ <NTooltip placement="left">
+ <template #trigger>
+ <div
+ class="flex items-center justify-center rounded-full select-none w-5 h-5 overflow-hidden text-white font-medium text-base"
+ :class="
+ database.syncStatus === 'OK' ? 'bg-success' : 'bg-error'
+ "
+ >
+ <template v-if="database.syncStatus === 'OK'">
+ <heroicons-solid:check class="w-4 h-4" />
+ </template>
+ <template v-else>
+ <span
+ class="h-2 w-2 flex items-center justify-center"
+ aria-hidden="true"
+ >!</span
+ >
+ </template>
+ </div>
+ </template>
+
+ <span>
+ <template v-if="database.syncStatus === 'OK'">
+ {{
+ $t("database.synced-at", {
+ time: humanizeTs(database.lastSuccessfulSyncTs),
+ })
+ }}
+ </template>
+ <template v-else>
+ {{
+ $t("database.not-found-last-successful-sync-was", {
+ time: humanizeTs(database.lastSuccessfulSyncTs),
+ })
+ }}
+ </template>
+ </span>
+ </NTooltip>
+ </div>
+ </div>
+ </template>
+
+ <template #footer>
+ <div
+ v-if="hasReservedDatabases && !state.showReservedDatabaseList"
+ class="flex items-center justify-center cursor-pointer hover:bg-gray-200 py-2 text-gray-400 text-sm"
+ @click="showReservedDatabaseList()"
+ >
+ {{ $t("database.show-reserved-databases") }}
+ </div>
+ </template>
+ </BBGrid>
+ </div>
+
+ <div
+ v-if="showPagination"
+ class="flex justify-end !mt-2"
+ :class="paginationClass"
+ >
+ <NPagination
+ :item-count="table.getCoreRowModel().rows.length"
+ :page="table.getState().pagination.pageIndex + 1"
+ :page-size="table.getState().pagination.pageSize"
+ :show-quick-jumper="true"
+ @update-page="handleChangePage"
+ @update-page-size="(ps) => table.setPageSize(ps)"
+ />
+ </div>
<BBModal
v-if="state.showIncorrectProjectModal"
@@ -225,9 +227,17 @@
</template>
<script lang="ts" setup>
-import { computed, PropType, reactive, ref, watchEffect } from "vue";
+import {
+ computed,
+ nextTick,
+ PropType,
+ reactive,
+ ref,
+ watch,
+ watchEffect,
+} from "vue";
import { useRouter } from "vue-router";
-import { NTooltip } from "naive-ui";
+import { NTooltip, NPagination } from "naive-ui";
import { useI18n } from "vue-i18n";
import cloneDeep from "lodash-es/cloneDeep";
import {
@@ -235,13 +245,21 @@ import {
databaseSlug,
isDatabaseAccessible,
isPITRDatabase,
+ VueClass,
} from "../utils";
import type { Database, Policy } from "../types";
import { DEFAULT_PROJECT_ID, UNKNOWN_ID } from "../types";
-import { BBTableColumn } from "../bbkit/types";
+import { BBGridColumn } from "../bbkit/types";
import InstanceEngineIcon from "./InstanceEngineIcon.vue";
import TenantIcon from "./TenantIcon.vue";
import { useCurrentUser, usePolicyStore } from "@/store";
+import {
+ ColumnDef,
+ getCoreRowModel,
+ getPaginationRowModel,
+ useVueTable,
+} from "@tanstack/vue-table";
+import { getScrollParent } from "@/plugins/demo/utils";
type Mode =
| "ALL"
@@ -262,6 +280,14 @@ const props = defineProps({
default: true,
type: Boolean,
},
+ tableClass: {
+ type: [String, Array, Object] as PropType<VueClass>,
+ default: undefined,
+ },
+ paginationClass: {
+ type: [String, Array, Object] as PropType<VueClass>,
+ default: undefined,
+ },
mode: {
default: "ALL",
type: String as PropType<Mode>,
@@ -286,6 +312,10 @@ const props = defineProps({
required: true,
type: Object as PropType<Database[]>,
},
+ pageSize: {
+ type: Number,
+ default: 20,
+ },
});
const emit = defineEmits(["select-database"]);
@@ -297,6 +327,7 @@ const state = reactive<State>({
showIncorrectProjectModal: false,
showReservedDatabaseList: false,
});
+const wrapper = ref<HTMLElement>();
const sortedDatabaseList = computed(() => {
const list = [...props.databaseList];
@@ -323,12 +354,11 @@ const hasReservedDatabases = computed(
);
const mixedDatabaseList = computed(() => {
- const tableList = [...regularDatabaseList.value];
+ const databaseList = [...regularDatabaseList.value];
if (state.showReservedDatabaseList) {
- tableList.push(...reservedDatabaseList.value);
+ databaseList.push(...reservedDatabaseList.value);
}
-
- return tableList;
+ return databaseList;
});
const policyList = ref<Policy[]>([]);
@@ -345,124 +375,42 @@ const preparePolicyList = () => {
};
const columnListMap = computed(() => {
- return new Map([
+ const NAME = {
+ title: t("common.name"),
+ width: "minmax(auto, 1.5fr)",
+ };
+ const SCHEMA_VERSION = {
+ title: t("common.schema-version"),
+ width: { lg: "minmax(auto, 1fr)" },
+ class: "hidden lg:flex",
+ };
+ const PROJECT = {
+ title: t("common.project"),
+ width: "minmax(auto, 1fr)",
+ };
+ const ENVIRONMENT = {
+ title: t("common.environment"),
+ width: "minmax(auto, 1fr)",
+ };
+ const INSTANCE = {
+ title: t("common.instance"),
+ width: "minmax(auto, 1fr)",
+ };
+ const SYNC_STATUS = {
+ title: t("database.sync-status"),
+ width: "auto",
+ class: "items-center",
+ };
+ return new Map<Mode, BBGridColumn[]>([
[
"ALL",
- [
- {
- title: t("common.name"),
- },
- {
- title: t("common.schema-version"),
- },
- {
- title: t("common.project"),
- },
- {
- title: t("common.environment"),
- },
- {
- title: t("common.instance"),
- },
- {
- title: t("database.sync-status"),
- center: true,
- },
- ],
- ],
- [
- "ALL_SHORT",
- [
- {
- title: t("common.name"),
- },
- {
- title: t("common.schema-version"),
- },
- {
- title: t("common.project"),
- },
- {
- title: t("common.environment"),
- },
- {
- title: t("common.instance"),
- },
- ],
- ],
- [
- "ALL_TINY",
- [
- {
- title: t("common.name"),
- },
- {
- title: t("common.project"),
- },
- {
- title: t("common.environment"),
- },
- {
- title: t("common.instance"),
- },
- ],
- ],
- [
- "INSTANCE",
- [
- {
- title: t("common.name"),
- },
- {
- title: t("common.schema-version"),
- },
- {
- title: t("common.project"),
- },
- {
- title: t("database.sync-status"),
- center: true,
- },
- ],
- ],
- [
- "PROJECT",
- [
- {
- title: t("common.name"),
- },
- {
- title: t("common.schema-version"),
- },
- {
- title: t("common.environment"),
- },
- {
- title: t("common.instance"),
- },
- {
- title: t("database.sync-status"),
- center: true,
- },
- ],
- ],
- [
- "PROJECT_SHORT",
- [
- {
- title: t("common.name"),
- },
- {
- title: t("common.schema-version"),
- },
- {
- title: t("common.environment"),
- },
- {
- title: t("common.instance"),
- },
- ],
+ [NAME, SCHEMA_VERSION, PROJECT, ENVIRONMENT, INSTANCE, SYNC_STATUS],
],
+ ["ALL_SHORT", [NAME, SCHEMA_VERSION, PROJECT, ENVIRONMENT, INSTANCE]],
+ ["ALL_TINY", [NAME, PROJECT, ENVIRONMENT, INSTANCE]],
+ ["INSTANCE", [NAME, SCHEMA_VERSION, PROJECT, SYNC_STATUS]],
+ ["PROJECT", [NAME, SCHEMA_VERSION, ENVIRONMENT, INSTANCE, SYNC_STATUS]],
+ ["PROJECT_SHORT", [NAME, SCHEMA_VERSION, ENVIRONMENT, INSTANCE]],
]);
});
@@ -494,13 +442,64 @@ const showMiscColumn = computed(() => {
});
const columnList = computed(() => {
- const list: BBTableColumn[] = cloneDeep(columnListMap.value.get(props.mode)!);
+ const list = cloneDeep(columnListMap.value.get(props.mode)!);
if (props.showSelectionColumn) {
- list.unshift({ title: "" });
+ list.unshift({
+ title: "",
+ width: "minmax(auto, 2rem)",
+ class: "items-center !px-2",
+ });
}
return list;
});
+const table = useVueTable<Database>({
+ get data() {
+ return mixedDatabaseList.value;
+ },
+ get columns() {
+ return columnList.value.map<ColumnDef<Database>>((col, index) => ({
+ header: col.title,
+ }));
+ },
+ getCoreRowModel: getCoreRowModel(),
+ getPaginationRowModel: getPaginationRowModel(),
+});
+
+const pagedDataSource = computed(() => {
+ return table.getRowModel().rows.map((row) => row.original);
+});
+
+watch(
+ () => props.pageSize,
+ (ps) => {
+ table.setPageSize(ps);
+ },
+ { immediate: true }
+);
+const showPagination = computed(() => {
+ return mixedDatabaseList.value.length > props.pageSize;
+});
+
+const handleChangePage = (page: number) => {
+ table.setPageIndex(page - 1);
+ if (wrapper.value) {
+ const parent = getScrollParent(wrapper.value);
+ parent.scrollTo(0, 0);
+ }
+};
+
+const showReservedDatabaseList = () => {
+ const count = regularDatabaseList.value.length;
+ const pageCount = table.getPageCount();
+ const targetPage =
+ count === pageCount * props.pageSize ? pageCount + 1 : pageCount;
+ state.showReservedDatabaseList = true;
+ nextTick(() => {
+ handleChangePage(targetPage);
+ });
+};
+
const showSQLEditorLink = computed(() => {
if (
props.mode === "ALL_SHORT" ||
@@ -548,10 +547,14 @@ const handleIncorrectProjectModalCancel = () => {
state.warningDatabase = undefined;
};
-const clickDatabase = (section: number, row: number, e: MouseEvent) => {
+const clickDatabase = (
+ database: Database,
+ section: number,
+ row: number,
+ e: MouseEvent
+) => {
if (!props.rowClickable) return;
- const database = mixedDatabaseList.value[row];
if (props.customClick) {
emit("select-database", database);
} else {
diff --git a/frontend/src/components/ProjectDatabasesPanel.vue b/frontend/src/components/ProjectDatabasesPanel.vue
index b9b6471927..dab0d144d5 100644
--- a/frontend/src/components/ProjectDatabasesPanel.vue
+++ b/frontend/src/components/ProjectDatabasesPanel.vue
@@ -14,7 +14,11 @@
</div>
<template v-if="databaseList.length > 0">
- <DatabaseTable mode="PROJECT" :database-list="filteredDatabaseList" />
+ <DatabaseTable
+ mode="PROJECT"
+ table-class="border"
+ :database-list="filteredDatabaseList"
+ />
</template>
<div v-else class="text-center textinfolabel">
<i18n-t keypath="project.overview.no-db-prompt" tag="p">
diff --git a/frontend/src/components/TransferDatabaseForm/TransferMultipleDatabaseForm.vue b/frontend/src/components/TransferDatabaseForm/TransferMultipleDatabaseForm.vue
index 40fff681dc..76d1ff90dc 100644
--- a/frontend/src/components/TransferDatabaseForm/TransferMultipleDatabaseForm.vue
+++ b/frontend/src/components/TransferDatabaseForm/TransferMultipleDatabaseForm.vue
@@ -1,10 +1,11 @@
<template>
- <div class="px-4 space-y-6 w-208">
+ <div class="px-4 space-y-6 w-[60rem]">
<slot name="transfer-source-selector" />
<DatabaseTable
+ class="max-h-[55vh] overflow-y-auto"
+ table-class="border"
:mode="transferSource === 'DEFAULT' ? 'PROJECT_SHORT' : 'ALL_SHORT'"
- :bordered="true"
:custom-click="true"
:database-list="databaseList"
:show-selection-column="true"
@@ -35,6 +36,7 @@
/>
</template>
</DatabaseTable>
+
<!-- Update button group -->
<div class="pt-4 border-t border-block-border flex justify-between">
<div>
diff --git a/frontend/src/store/modules/database.ts b/frontend/src/store/modules/database.ts
index 9a2395821c..00ed38269a 100644
--- a/frontend/src/store/modules/database.ts
+++ b/frontend/src/store/modules/database.ts
@@ -1,6 +1,6 @@
import { defineStore } from "pinia";
import axios from "axios";
-import { computed, unref, watch } from "vue";
+import { computed, unref, watch, markRaw } from "vue";
import {
Backup,
Database,
@@ -140,10 +140,10 @@ function convert(
}
}
- return {
+ return markRaw({
...(databaseWPartial as Omit<Database, "dataSourceList">),
dataSourceList,
- };
+ });
}
const databaseSorter = (a: Database, b: Database): number => {
diff --git a/frontend/src/views/DatabaseDashboard.vue b/frontend/src/views/DatabaseDashboard.vue
index 9ac3203517..8e16ff64ad 100644
--- a/frontend/src/views/DatabaseDashboard.vue
+++ b/frontend/src/views/DatabaseDashboard.vue
@@ -35,7 +35,7 @@
</div>
</div>
- <DatabaseTable :bordered="false" :database-list="filteredList" />
+ <DatabaseTable pagination-class="mb-4" :database-list="filteredList" />
<div
v-if="state.loading"