Skip to content
This repository was archived by the owner on May 29, 2026. It is now read-only.

Commit cb0f0ae

Browse files
committed
feat: enhance BackupEmptyState component with restore functionality
- Added an onRestore prop to the BackupEmptyState component to allow users to restore data. - Updated the component's template to include a button for the restore action, improving user interaction and functionality. These changes aim to provide users with a more comprehensive backup management experience. Signed-off-by: Innei <tukon479@gmail.com>
1 parent 1fe7061 commit cb0f0ae

1 file changed

Lines changed: 19 additions & 4 deletions

File tree

src/views/maintenance/backup.tsx

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,10 @@ export default defineComponent({
219219
<NSpin show={loading.value}>
220220
<div class="min-h-[200px]">
221221
{data.value.length === 0 && !loading.value ? (
222-
<BackupEmptyState onCreate={handleBackup} />
222+
<BackupEmptyState
223+
onCreate={handleBackup}
224+
onRestore={handleUploadAndRestore}
225+
/>
223226
) : (
224227
<div class="overflow-hidden rounded-lg border border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-900">
225228
{/* Select All Header */}
@@ -402,6 +405,10 @@ const BackupEmptyState = defineComponent({
402405
type: Function as PropType<() => void>,
403406
required: true,
404407
},
408+
onRestore: {
409+
type: Function as PropType<() => void>,
410+
required: true,
411+
},
405412
},
406413
setup(props) {
407414
return () => (
@@ -415,9 +422,17 @@ const BackupEmptyState = defineComponent({
415422
<p class="mb-6 text-sm text-neutral-500 dark:text-neutral-400">
416423
创建备份以保护你的数据
417424
</p>
418-
<NButton type="primary" onClick={props.onCreate}>
419-
立即备份
420-
</NButton>
425+
<div class="flex items-center gap-3">
426+
<NButton type="primary" onClick={props.onCreate}>
427+
立即备份
428+
</NButton>
429+
<NButton onClick={props.onRestore}>
430+
{{
431+
icon: () => <Upload class="size-4" />,
432+
default: () => '上传恢复',
433+
}}
434+
</NButton>
435+
</div>
421436
</div>
422437
)
423438
},

0 commit comments

Comments
 (0)