diff --git a/frontend/src/api/interface/setting.ts b/frontend/src/api/interface/setting.ts index 34adcf7b3..c4c2c6de9 100644 --- a/frontend/src/api/interface/setting.ts +++ b/frontend/src/api/interface/setting.ts @@ -108,6 +108,7 @@ export namespace Setting { id: number; name: string; from: string; + defaultDownload: string; description: string; status: string; message: string; diff --git a/frontend/src/views/setting/backup-account/onedrive/index.vue b/frontend/src/views/setting/backup-account/onedrive/index.vue index d0edd6fd9..375fccba5 100644 --- a/frontend/src/views/setting/backup-account/onedrive/index.vue +++ b/frontend/src/views/setting/backup-account/onedrive/index.vue @@ -117,6 +117,9 @@ const rules = reactive({ driveCode: [{ validator: checkDriveCode, required: true, trigger: 'blur' }], }); function checkDriveCode(rule: any, value: any, callback: any) { + if (!value) { + return callback(new Error(i18n.global.t('setting.codeWarning'))); + } const reg = /^[A-Za-z0-9_.-]+$/; if (!reg.test(value)) { return callback(new Error(i18n.global.t('setting.codeWarning'))); diff --git a/frontend/src/views/setting/snapshot/import/index.vue b/frontend/src/views/setting/snapshot/import/index.vue index e74d780e7..c39921efd 100644 --- a/frontend/src/views/setting/snapshot/import/index.vue +++ b/frontend/src/views/setting/snapshot/import/index.vue @@ -19,7 +19,13 @@ - + @@ -58,6 +64,7 @@ const loading = ref(); const formRef = ref(); const backupOptions = ref(); const fileNames = ref(); +const existNames = ref(); const form = reactive({ from: '', @@ -70,8 +77,13 @@ const rules = reactive({ name: [Rules.requiredSelect], }); -const acceptParams = (): void => { +interface DialogProps { + names: Array; +} + +const acceptParams = (params: DialogProps): void => { form.from = ''; + existNames.value = params.names; form.names = [] as Array; loadBackups(); drawerVisible.value = true; @@ -82,6 +94,15 @@ const handleClose = () => { drawerVisible.value = false; }; +const checkDisable = (val: string) => { + for (const item of existNames.value) { + if (val === item + '.tar.gz') { + return true; + } + } + return false; +}; + const submitImport = async (formEl: FormInstance | undefined) => { loading.value = true; if (!formEl) return; @@ -107,7 +128,7 @@ const loadBackups = async () => { loading.value = false; backupOptions.value = []; for (const item of res.data) { - if (item.type !== 'LOCAL' && item.id !== 0) { + if (item.id !== 0) { backupOptions.value.push({ label: i18n.global.t('setting.' + item.type), value: item.type }); } } diff --git a/frontend/src/views/setting/snapshot/index.vue b/frontend/src/views/setting/snapshot/index.vue index 2cc1781e9..7bf4756a3 100644 --- a/frontend/src/views/setting/snapshot/index.vue +++ b/frontend/src/views/setting/snapshot/index.vue @@ -51,15 +51,18 @@ - - - + + {{ $t('setting.' + item) }} - - {{ $t('setting.' + item) }} - - + + + + - @@ -236,7 +239,11 @@ const onCreate = async () => { }; const onImport = () => { - importRef.value.acceptParams(); + let names = []; + for (const item of data.value) { + names.push(item.name); + } + importRef.value.acceptParams({ names: names }); }; const handleClose = () => { @@ -268,7 +275,12 @@ const submitAddSnapshot = (formEl: FormInstance | undefined) => { }; const onLoadStatus = (row: Setting.SnapshotInfo) => { - snapStatusRef.value.acceptParams({ id: row.id, from: row.from, description: row.description }); + snapStatusRef.value.acceptParams({ + id: row.id, + from: row.from, + defaultDownload: row.defaultDownload, + description: row.description, + }); }; const loadBackups = async () => { diff --git a/frontend/src/views/setting/snapshot/snap_status/index.vue b/frontend/src/views/setting/snapshot/snap_status/index.vue index 51ad3ecb3..9c8313be8 100644 --- a/frontend/src/views/setting/snapshot/snap_status/index.vue +++ b/frontend/src/views/setting/snapshot/snap_status/index.vue @@ -117,6 +117,7 @@ const dialogVisible = ref(false); const loading = ref(); const snapID = ref(); const snapFrom = ref(); +const snapDefaultDownload = ref(); const snapDescription = ref(); let timer: NodeJS.Timer | null = null; @@ -124,6 +125,7 @@ let timer: NodeJS.Timer | null = null; interface DialogProps { id: number; from: string; + defaultDownload: string; description: string; } @@ -131,6 +133,7 @@ const acceptParams = (props: DialogProps): void => { dialogVisible.value = true; snapID.value = props.id; snapFrom.value = props.from; + snapDefaultDownload.value = props.defaultDownload; snapDescription.value = props.description; onWatch(); nextTick(() => { @@ -167,7 +170,13 @@ const onClose = async () => { const onRetry = async () => { loading.value = true; - await snapshotCreate({ id: snapID.value, from: snapFrom.value, description: snapDescription.value }) + await snapshotCreate({ + id: snapID.value, + fromAccounts: [], + from: snapFrom.value, + defaultDownload: snapDefaultDownload.value, + description: snapDescription.value, + }) .then(() => { loading.value = false; loadCurrentStatus(); diff --git a/frontend/src/views/setting/snapshot/status/index.vue b/frontend/src/views/setting/snapshot/status/index.vue index 07dc4c5d7..52a16e955 100644 --- a/frontend/src/views/setting/snapshot/status/index.vue +++ b/frontend/src/views/setting/snapshot/status/index.vue @@ -4,149 +4,143 @@ - - - - - {{ $t('setting.recover') }} - - - - - - - {{ $t('commons.table.statusSuccess') }} - - - {{ $t('setting.recover') }} - - - - {{ snapInfo.lastRecoveredAt }} - - - - - - {{ $t('setting.noRecoverRecord') }} - - - - - {{ $t('setting.recover') }} - - - - - - - - {{ $t('commons.table.statusFailed') }} - - - {{ $t('commons.table.statusSuccess') }} - - - {{ $t('commons.table.statusWaiting') }} - - - {{ $t('setting.recover') }} - - - - {{ snapInfo.lastRecoveredAt }} - - - - - {{ snapInfo.recoverMessage }} - - - - - {{ $t('commons.button.retry') }} - - - - - - - - - {{ $t('setting.rollback') }} - - - - - - - {{ $t('commons.table.statusSuccess') }} - - + + + + {{ $t('setting.recover') }} + + + + {{ $t('setting.recover') }} - - - {{ snapInfo.lastRollbackedAt }} - + + + + + + + + {{ $t('commons.table.statusSuccess') }} + + + {{ $t('setting.recover') }} + + + + {{ snapInfo.lastRecoveredAt }} + + + + + + + {{ $t('commons.table.statusFailed') }} + + + {{ $t('commons.table.statusSuccess') }} + + + {{ $t('commons.table.statusWaiting') }} + + + + + {{ snapInfo.lastRecoveredAt }} + + + + + {{ snapInfo.recoverMessage }} + + + + + {{ $t('commons.button.retry') }} + + + + + + + {{ $t('setting.rollback') }} + + + + + {{ $t('setting.rollback') }} + + + + + + + + {{ $t('commons.table.statusSuccess') }} + + + {{ $t('setting.rollback') }} + + + + {{ snapInfo.lastRollbackedAt }} + + - - - {{ $t('setting.noRollbackRecord') }} + + + {{ $t('commons.table.statusSuccess') }} - - - + + {{ $t('commons.table.statusFailed') }} + + + {{ $t('commons.table.statusWaiting') }} + + {{ $t('setting.rollback') }} - - - - - - {{ $t('commons.table.statusSuccess') }} - - - {{ $t('commons.table.statusFailed') }} - - - {{ $t('commons.table.statusWaiting') }} - - - {{ $t('setting.rollback') }} - - - - {{ snapInfo.lastRollbackedAt }} - - - - - {{ snapInfo.rollbackMessage }} - - - - - {{ $t('commons.button.retry') }} - + {{ snapInfo.lastRollbackedAt }} + + + + {{ snapInfo.rollbackMessage }} + + + + + {{ $t('commons.button.retry') }} + + + - - + + @@ -255,3 +249,25 @@ defineExpose({ acceptParams, }); + +