Skip to content

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

feat(frontend): move pitr restore button to backups tab (#1520)

Liu Ji6d315e243d36
diff --git a/frontend/src/components/DatabaseBackupPanel.vue b/frontend/src/components/DatabaseBackupPanel.vue
index 1ddc215a51..fd08255556 100644
--- a/frontend/src/components/DatabaseBackupPanel.vue
+++ b/frontend/src/components/DatabaseBackupPanel.vue
@@ -98,14 +98,23 @@
<div class="text-lg leading-6 font-medium text-main">
{{ $t("common.backups") }}
</div>
- <button
- v-if="allowEdit"
- type="button"
- class="btn-normal whitespace-nowrap items-center"
- @click.prevent="state.showCreateBackupModal = true"
- >
- {{ $t("database.backup-now") }}
- </button>
+
+ <div class="flex-1 flex items-center justify-end">
+ <PITRRestoreButton
+ v-if="allowAdmin"
+ :database="database"
+ :allow-admin="allowAdmin"
+ />
+
+ <button
+ v-if="allowEdit"
+ type="button"
+ class="btn-normal whitespace-nowrap items-center"
+ @click.prevent="state.showCreateBackupModal = true"
+ >
+ {{ $t("database.backup-now") }}
+ </button>
+ </div>
</div>
<BackupTable
:database="database"
diff --git a/frontend/src/components/DatabaseDetail/PITRRestoreButton.vue b/frontend/src/components/DatabaseDetail/PITRRestoreButton.vue
index f4a5623bf4..0f6c805c4b 100644
--- a/frontend/src/components/DatabaseDetail/PITRRestoreButton.vue
+++ b/frontend/src/components/DatabaseDetail/PITRRestoreButton.vue
@@ -1,12 +1,12 @@
<template>
- <div class="relative mr-2">
+ <div class="relative mr-6">
<BBTooltipButton
type="normal"
tooltip-mode="DISABLED-ONLY"
:disabled="!allowAdmin || !pitrAvailable.result"
@click="openDialog"
>
- {{ $t("common.restore") }}
+ {{ $t("database.pitr.restore-to-point-in-time") }}
<template v-if="allowAdmin && !pitrAvailable.result" #tooltip>
{{ pitrAvailable.message }}
</template>
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 732e360c94..d799158da1 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -197,7 +197,8 @@
"clear-search": "Clear search",
"enable": "Enable",
"disable": "Disable",
- "view-doc": "View doc"
+ "view-doc": "View doc",
+ "backup-and-restore": "Backup and restore"
},
"error-page": {
"go-back-home": "Go back home"
@@ -805,6 +806,7 @@
"point-in-time": "Point in time",
"help-info": "Restore the database state to a point in time. {link}.",
"minimum-supported-engine-and-version": "{engine} >= {min_version} required",
+ "restore-to-point-in-time": "Restore to point in time",
"no-earlier-than": "Restore point-in-time cannot be earlier than [{earliest}] (the earliest available backup).",
"no-later-than-now": "Restore point-in-time cannot be later than now."
}
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index a545155dfd..9f41630875 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -197,7 +197,8 @@
"clear-search": "清空搜索",
"enable": "开启",
"disable": "禁用",
- "view-doc": "查看文档"
+ "view-doc": "查看文档",
+ "backup-and-restore": "备份与恢复"
},
"error-page": {
"go-back-home": "回到主页"
@@ -805,6 +806,7 @@
"point-in-time": "时间点",
"help-info": "将数据库的状态恢复到一个时间点。{link}。",
"minimum-supported-engine-and-version": "需要 {engine} >= {min_version}",
+ "restore-to-point-in-time": "恢复到指定时间点",
"no-earlier-than": "恢复的时间点不能早于 [{earliest}] (最早可用的备份)。",
"no-later-than-now": "恢复的时间点不能晚于当前时间。"
}
diff --git a/frontend/src/views/DatabaseDetail.vue b/frontend/src/views/DatabaseDetail.vue
index 74a8ef7f99..04aef68101 100644
--- a/frontend/src/views/DatabaseDetail.vue
+++ b/frontend/src/views/DatabaseDetail.vue
@@ -148,8 +148,6 @@
</div>
</template>
</BBTooltipButton>
-
- <PITRRestoreButton :database="database" :allow-admin="allowAdmin" />
</div>
</div>
</main>
@@ -306,7 +304,6 @@ import {
import { BBTabFilterItem } from "@/bbkit/types";
import { useI18n } from "vue-i18n";
import { GhostDialog } from "@/components/AlterSchemaPrepForm";
-import { PITRRestoreButton } from "@/components/DatabaseDetail";
import {
pushNotification,
useCurrentUser,
@@ -346,7 +343,7 @@ const ghostDialog = ref<InstanceType<typeof GhostDialog>>();
const databaseTabItemList: DatabaseTabItem[] = [
{ name: t("common.overview"), hash: "overview" },
{ name: t("migration-history.self"), hash: "migration-history" },
- { name: t("common.backups"), hash: "backup" },
+ { name: t("common.backup-and-restore"), hash: "backup-and-restore" },
];
const state = reactive<LocalState>({