Skip to content

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

Change MigrationHistoryTable to use sectionDataSource

天舟7be7b1980844
diff --git a/frontend/src/components/DatabaseOverviewPanel.vue b/frontend/src/components/DatabaseOverviewPanel.vue
index e455553442..8e5cad413e 100644
--- a/frontend/src/components/DatabaseOverviewPanel.vue
+++ b/frontend/src/components/DatabaseOverviewPanel.vue
@@ -67,7 +67,7 @@
</div>
<MigrationHistoryTable
v-if="state.migrationSetupStatus == 'OK'"
- :historyList="migrationHistoryList"
+ :historySectionList="migrationHistorySectionList"
/>
<BBAttention
v-else
@@ -200,8 +200,10 @@ import {
DataSourcePatch,
MigrationSchemaStatus,
InstanceMigration,
+ MigrationHistory,
} from "../types";
import { cloneDeep, isEmpty, isEqual } from "lodash";
+import { BBTableSectionDataSource } from "../bbkit/types";
interface LocalState {
editingDataSource?: DataSource;
@@ -271,11 +273,18 @@ export default {
return "";
});
- const migrationHistoryList = computed(() => {
- return store.getters[
- "instance/migrationHistoryListByInstanceIdAndDatabaseName"
- ](props.database.instance.id, props.database.name);
- });
+ const migrationHistorySectionList = computed(
+ (): BBTableSectionDataSource<MigrationHistory>[] => {
+ return [
+ {
+ title: "",
+ list: store.getters[
+ "instance/migrationHistoryListByInstanceIdAndDatabaseName"
+ ](props.database.instance.id, props.database.name),
+ },
+ ];
+ }
+ );
const isCurrentUserDBAOrOwner = computed((): boolean => {
return isDBAOrOwner(currentUser.value.role);
@@ -362,7 +371,7 @@ export default {
state,
tableList,
attentionTitle,
- migrationHistoryList,
+ migrationHistorySectionList,
hasDataSourceFeature,
allowViewDataSource,
allowChangeDataSource,
diff --git a/frontend/src/components/MigrationHistoryTable.vue b/frontend/src/components/MigrationHistoryTable.vue
index 1c697590fd..d5f8619ee2 100644
--- a/frontend/src/components/MigrationHistoryTable.vue
+++ b/frontend/src/components/MigrationHistoryTable.vue
@@ -1,39 +1,54 @@
<template>
<BBTable
:columnList="COLUMN_LIST"
- :dataSource="historyList"
+ :sectionDataSource="historySectionList"
+ :compactSection="true"
:showHeader="true"
:leftBordered="true"
:rightBordered="true"
:rowClickable="false"
>
+ <template v-slot:header>
+ <BBTableHeaderCell
+ :leftPadding="4"
+ class="w-8"
+ :title="COLUMN_LIST[0].title"
+ />
+ <BBTableHeaderCell class="w-16" :title="COLUMN_LIST[1].title" />
+ <BBTableHeaderCell class="w-16" :title="COLUMN_LIST[2].title" />
+ <BBTableHeaderCell class="w-16" :title="COLUMN_LIST[3].title" />
+ <BBTableHeaderCell class="w-32" :title="COLUMN_LIST[4].title" />
+ <BBTableHeaderCell class="w-16" :title="COLUMN_LIST[5].title" />
+ <BBTableHeaderCell class="w-16" :title="COLUMN_LIST[6].title" />
+ <BBTableHeaderCell class="w-16" :title="COLUMN_LIST[7].title" />
+ </template>
<template v-slot:body="{ rowData: history }">
- <BBTableCell :leftPadding="4" class="w-8 table-cell">
+ <BBTableCell :leftPadding="4">
{{ history.engine }}
</BBTableCell>
- <BBTableCell class="w-16 table-cell">
+ <BBTableCell>
{{ history.version }}
</BBTableCell>
- <BBTableCell class="w-16 table-cell">
+ <BBTableCell>
{{ history.type }}
</BBTableCell>
- <BBTableCell class="w-16 table-cell">
+ <BBTableCell>
<template v-if="history.issueId">
<router-link :to="`/issue/${history.issueId}`" class="normal-link"
>{{ history.issueId }}
</router-link>
</template>
</BBTableCell>
- <BBTableCell class="w-32 table-cell truncate">
+ <BBTableCell>
{{ history.description }}
</BBTableCell>
- <BBTableCell class="w-16 table-cell">
+ <BBTableCell>
{{ secondsToString(history.executionDuration) }}
</BBTableCell>
- <BBTableCell class="w-16 table-cell">
+ <BBTableCell>
{{ humanizeTs(history.createdTs) }}
</BBTableCell>
- <BBTableCell class="w-16 table-cell">
+ <BBTableCell>
{{ history.creator }}
</BBTableCell>
</template>
@@ -44,6 +59,7 @@
import { PropType } from "vue";
import { MigrationHistory } from "../types";
import { secondsToString } from "../utils";
+import { BBTableSectionDataSource } from "../bbkit/types";
const COLUMN_LIST = [
{
@@ -76,9 +92,9 @@ export default {
name: "MigrationHistoryTable",
components: {},
props: {
- historyList: {
+ historySectionList: {
required: true,
- type: Object as PropType<MigrationHistory[]>,
+ type: Object as PropType<BBTableSectionDataSource<MigrationHistory>[]>,
},
},
setup(props, ctx) {