Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Add restore button to BackupTable
天舟5b53acecf731
diff --git a/frontend/src/components/BackupTable.vue b/frontend/src/components/BackupTable.vueindex d0d1556017..aa61d51939 100644--- a/frontend/src/components/BackupTable.vue+++ b/frontend/src/components/BackupTable.vue@@ -3,9 +3,9 @@:columnList="columnList":dataSource="backupList":showHeader="true"+ :rowClickable="false":leftBordered="true":rightBordered="true"- @click-row="clickBackup"><template v-slot:body="{ rowData: backup }"><BBTableCell :leftPadding="4" class="w-4">@@ -54,18 +54,29 @@</template></span></BBTableCell>- <BBTableCell class="w-16 table-cell">+ <BBTableCell class="w-16">{{ backup.name }}</BBTableCell>- <BBTableCell class="w-48 table-cell">+ <BBTableCell class="w-48">{{ backup.path }}</BBTableCell>- <BBTableCell class="w-16 table-cell">+ <BBTableCell class="w-16">{{ humanizeTs(backup.createdTs) }}</BBTableCell>- <BBTableCell class="w-16 table-cell">+ <BBTableCell class="w-16">{{ backup.creator.name }}</BBTableCell>+ <BBTableCell class="w-4">+ <BBButtonConfirm+ v-if="backup.status == 'DONE'"+ :style="'RESTORE'"+ :requireConfirm="true"+ :okText="'Restore'"+ :confirmTitle="`Are you sure to restore '${backup.name}' to database '${database.name}'?`"+ :confirmDescription="''"+ @confirm="restoreBackup(backup)"+ />+ </BBTableCell></template></BBTable></template>@@ -73,7 +84,7 @@<script lang="ts">import { PropType } from "vue";import { BBTableColumn } from "../bbkit/types";-import { Backup } from "../types";+import { Backup, Database } from "../types";import { bytesToString } from "../utils";import { useStore } from "vuex";@@ -93,12 +104,19 @@ const columnList: BBTableColumn[] = [{title: "Creator",},+ {+ title: "Restore",+ },];export default {name: "BackupTable",components: {},props: {+ database: {+ required: true,+ type: Object as PropType<Database>,+ },backupList: {required: true,type: Object as PropType<Backup[]>,@@ -125,10 +143,9 @@ export default {}};- const clickBackup = (section: number, row: number) => {- const backup = props.backupList[row];+ const restoreBackup = (backup: Backup) => {store.dispatch("backup/restoreFromBackup", {- databaseId: backup.database.id,+ databaseId: props.database.id,backupId: backup.id,});};@@ -137,7 +154,7 @@ export default {columnList,bytesToString,statusIconClass,- clickBackup,+ restoreBackup,};},};diff --git a/frontend/src/components/DatabaseBackupPanel.vue b/frontend/src/components/DatabaseBackupPanel.vueindex 7913d98ca3..17b18e6f47 100644--- a/frontend/src/components/DatabaseBackupPanel.vue+++ b/frontend/src/components/DatabaseBackupPanel.vue@@ -79,7 +79,7 @@Backup now</button></div>- <BackupTable :backupList="backupList" />+ <BackupTable :database="database" :backupList="backupList" /></div><BBModalv-if="state.showCreateBackupModal"