Skip to content

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

Use icon for backup status column

天舟15d03cdc5cd6
diff --git a/frontend/src/components/BackupTable.vue b/frontend/src/components/BackupTable.vue
index 82d444017f..d0d1556017 100644
--- a/frontend/src/components/BackupTable.vue
+++ b/frontend/src/components/BackupTable.vue
@@ -8,19 +8,62 @@
@click-row="clickBackup"
>
<template v-slot:body="{ rowData: backup }">
- <BBTableCell :leftPadding="4" class="w-8">
+ <BBTableCell :leftPadding="4" class="w-4">
+ <span
+ class="flex items-center justify-center rounded-full select-none"
+ :class="statusIconClass(backup)"
+ >
+ <template v-if="backup.status == 'PENDING_CREATE'">
+ <span
+ class="h-2 w-2 bg-blue-600 hover:bg-blue-700 rounded-full"
+ style="
+ animation: pulse 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
+ "
+ >
+ </span>
+ </template>
+ <template v-else-if="backup.status == 'DONE'">
+ <svg
+ class="w-4 h-4"
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 20 20"
+ fill="currentColor"
+ aria-hidden="true"
+ >
+ <path
+ fill-rule="evenodd"
+ d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
+ clip-rule="evenodd"
+ />
+ </svg>
+ </template>
+ <template v-else-if="backup.status == 'FAILED'">
+ <span
+ class="
+ h-2
+ w-2
+ rounded-full
+ text-center
+ pb-6
+ font-normal
+ text-base
+ "
+ aria-hidden="true"
+ >!</span
+ >
+ </template>
+ </span>
+ </BBTableCell>
+ <BBTableCell class="w-16 table-cell">
{{ backup.name }}
</BBTableCell>
- <BBTableCell class="w-8">
+ <BBTableCell class="w-48 table-cell">
{{ backup.path }}
</BBTableCell>
- <BBTableCell class="w-4">
- {{ backup.status }}
- </BBTableCell>
- <BBTableCell class="w-4">
+ <BBTableCell class="w-16 table-cell">
{{ humanizeTs(backup.createdTs) }}
</BBTableCell>
- <BBTableCell class="w-4">
+ <BBTableCell class="w-16 table-cell">
{{ backup.creator.name }}
</BBTableCell>
</template>
@@ -28,31 +71,29 @@
</template>
<script lang="ts">
-import { computed, PropType } from "vue";
+import { PropType } from "vue";
import { BBTableColumn } from "../bbkit/types";
import { Backup } from "../types";
-import { bytesToString, databaseSlug } from "../utils";
-import { useRouter } from "vue-router";
+import { bytesToString } from "../utils";
import { useStore } from "vuex";
-const columnList: BBTableColumn[] =
- [
- {
- title: "Name",
- },
- {
- title: "Path",
- },
- {
- title: "Status",
- },
- {
- title: "Time",
- },
- {
- title: "Creator",
- },
- ];
+const columnList: BBTableColumn[] = [
+ {
+ title: "Status",
+ },
+ {
+ title: "Name",
+ },
+ {
+ title: "Path",
+ },
+ {
+ title: "Time",
+ },
+ {
+ title: "Creator",
+ },
+];
export default {
name: "BackupTable",
@@ -65,7 +106,24 @@ export default {
},
setup(props, ctx) {
const store = useStore();
- const router = useRouter();
+
+ const statusIconClass = (backup: Backup) => {
+ let iconClass = "w-5 h-5";
+ switch (backup.status) {
+ case "PENDING_CREATE":
+ return (
+ iconClass +
+ " bg-white border-2 border-blue-600 text-blue-600 hover:text-blue-700 hover:border-blue-700"
+ );
+ case "DONE":
+ return iconClass + " bg-success hover:bg-success-hover text-white";
+ case "FAILED":
+ return (
+ iconClass +
+ " bg-error text-white hover:text-white hover:bg-error-hover"
+ );
+ }
+ };
const clickBackup = (section: number, row: number) => {
const backup = props.backupList[row];
@@ -78,6 +136,7 @@ export default {
return {
columnList,
bytesToString,
+ statusIconClass,
clickBackup,
};
},