Skip to content

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

feat(frontend): schema version and sync status in database table (#2179)

Liu Ji1d1efc6f1dfd
diff --git a/frontend/src/bbkit/BBTable/BBTable.vue b/frontend/src/bbkit/BBTable/BBTable.vue
index e589b43c15..1cbbfc5cb6 100644
--- a/frontend/src/bbkit/BBTable/BBTable.vue
+++ b/frontend/src/bbkit/BBTable/BBTable.vue
@@ -14,7 +14,10 @@
:key="index"
scope="col"
class="py-2 text-left text-xs font-medium text-gray-500 tracking-wider"
- :class="index == 0 ? 'pl-4' : 'pl-2'"
+ :class="[
+ index == 0 ? 'pl-4' : 'pl-2',
+ column.center && 'text-center pr-2',
+ ]"
>
{{ column.title }}
</th>
diff --git a/frontend/src/bbkit/types.ts b/frontend/src/bbkit/types.ts
index 84ba3512d6..c618c32772 100644
--- a/frontend/src/bbkit/types.ts
+++ b/frontend/src/bbkit/types.ts
@@ -8,6 +8,7 @@ export type BBButtonConfirmStyle =
export type BBTableColumn = {
title: string;
+ center?: boolean;
};
export type BBTableSectionDataSource<T> = {
diff --git a/frontend/src/components/DatabaseTable.vue b/frontend/src/components/DatabaseTable.vue
index 93dfc78d9d..ce77a9da4e 100644
--- a/frontend/src/components/DatabaseTable.vue
+++ b/frontend/src/components/DatabaseTable.vue
@@ -39,7 +39,10 @@
</div>
</div>
</BBTableCell>
- <BBTableCell v-if="showProjectColumn" class="w-[20%]">
+ <BBTableCell 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 class="tooltip-wrapper">
@@ -74,21 +77,49 @@
</div>
</BBTableCell>
<BBTableCell v-if="showMiscColumn" class="w-[8%]">
- <span
- :class="{
- 'text-error': database.syncStatus === 'NOT_FOUND',
- }"
- >
- {{ database.syncStatus }}
- </span>
- </BBTableCell>
- <BBTableCell v-if="showMiscColumn" class="w-[14%]">
- {{ humanizeTs(database.lastSuccessfulSyncTs) }}
+ <NTooltip>
+ <template #trigger>
+ <div class="w-full flex justify-center">
+ <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>
+ </div>
+ </template>
+
+ <span>
+ <template v-if="database.syncStatus === 'OK'">
+ {{
+ $t("database.sync-at", {
+ time: humanizeTs(database.lastSuccessfulSyncTs),
+ })
+ }}
+ </template>
+ <template v-else>
+ {{ $t("database.not-found") }}
+ </template>
+ </span>
+ </NTooltip>
</BBTableCell>
<BBTableCell v-if="showSQLEditorLink" class="w-[8%]">
- <button class="btn-icon" @click.stop="gotoSQLEditor(database)">
- <heroicons-outline:terminal class="w-4 h-4" />
- </button>
+ <div class="w-full flex justify-center">
+ <button class="btn-icon" @click.stop="gotoSQLEditor(database)">
+ <heroicons-outline:terminal class="w-4 h-4" />
+ </button>
+ </div>
</BBTableCell>
</template>
@@ -141,6 +172,7 @@
<script lang="ts" setup>
import { computed, PropType, reactive } from "vue";
import { useRouter } from "vue-router";
+import { NTooltip } from "naive-ui";
import { connectionSlug, databaseSlug, isPITRDatabase } from "../utils";
import type { Database } from "../types";
import { DEFAULT_PROJECT_ID, UNKNOWN_ID } from "../types";
@@ -238,6 +270,9 @@ const columnListMap = computed(() => {
{
title: t("common.name"),
},
+ {
+ title: t("common.schema-version"),
+ },
{
title: t("common.project"),
},
@@ -248,10 +283,8 @@ const columnListMap = computed(() => {
title: t("common.instance"),
},
{
- title: t("db.sync-status"),
- },
- {
- title: t("db.last-successful-sync"),
+ title: t("database.last-sync-status"),
+ center: true,
},
],
],
@@ -261,6 +294,9 @@ const columnListMap = computed(() => {
{
title: t("common.name"),
},
+ {
+ title: t("common.schema-version"),
+ },
{
title: t("common.project"),
},
@@ -279,13 +315,14 @@ const columnListMap = computed(() => {
title: t("common.name"),
},
{
- title: t("common.project"),
+ title: t("common.schema-version"),
},
{
- title: t("db.sync-status"),
+ title: t("common.project"),
},
{
- title: t("db.last-successful-sync"),
+ title: t("database.last-sync-status"),
+ center: true,
},
],
],
@@ -296,16 +333,17 @@ const columnListMap = computed(() => {
title: t("common.name"),
},
{
- title: t("common.environment"),
+ title: t("common.schema-version"),
},
{
- title: t("common.instance"),
+ title: t("common.environment"),
},
{
- title: t("db.sync-status"),
+ title: t("common.instance"),
},
{
- title: t("db.last-successful-sync"),
+ title: t("database.last-sync-status"),
+ center: true,
},
],
],
@@ -315,6 +353,9 @@ const columnListMap = computed(() => {
{
title: t("common.name"),
},
+ {
+ title: t("common.schema-version"),
+ },
{
title: t("common.environment"),
},
@@ -347,7 +388,7 @@ const columnList = computed(() => {
if (showSQLEditorLink.value) {
// Use cloneDeep, otherwise it will alter the one in columnListMap
list = cloneDeep(list);
- list.push({ title: t("sql-editor.self") });
+ list.push({ title: t("sql-editor.self"), center: true });
}
if (props.showSelectionColumn) {
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 2478ba8cbc..54d3951684 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -854,7 +854,9 @@
"retention-period": "Retention period(days)"
}
},
- "backup-policy-violation": "Backup policy violation"
+ "backup-policy-violation": "Backup policy violation",
+ "sync-at": "Sync at {time}",
+ "not-found": "Not found"
},
"repository": {
"branch-observe-file-change": "The branch where Bytebase observes the file change.",
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 8234acf32c..e7a483b294 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -855,7 +855,9 @@
"retention-period": "保留时长(天)"
}
},
- "backup-policy-violation": "违反了备份策略"
+ "backup-policy-violation": "违反了备份策略",
+ "sync-at": "同步于 {time}",
+ "not-found": "未找到"
},
"repository": {
"branch-observe-file-change": "Bytebase 跟踪文件变更的分支。",