同步异常兜底
This commit is contained in:
1 parent
9cb8552a99
commit
a1b4a63552
20 files changed
+754
-54
No files matched your search
@@ -57,6 +57,11 @@ const fileProgress = computed(() => {
|
||||
}
|
||||
})
|
||||
const isPull = computed(() => direction.value === 'pull')
|
||||
const canAbandon = computed(() =>
|
||||
!props.busy
|
||||
&& Boolean(props.resumableJob)
|
||||
&& (isPull.value || Boolean(token.value.trim()))
|
||||
)
|
||||
const directionSubtitle = computed(() => (
|
||||
isPull.value
|
||||
? t('storage.backup.siteSyncPullSubtitle')
|
||||
@@ -103,6 +108,19 @@ function resumeSync() {
|
||||
submit(true)
|
||||
}
|
||||
|
||||
function abandonSync() {
|
||||
if (!canAbandon.value || !props.resumableJob) return
|
||||
if (!window.confirm(t('storage.backup.siteSyncAbandonConfirm'))) return
|
||||
emit('sync', {
|
||||
targetBaseUrl: targetBaseUrl.value.trim(),
|
||||
token: token.value.trim(),
|
||||
conflictMode: conflictMode.value,
|
||||
direction: direction.value,
|
||||
abandonJobId: props.resumableJob.id
|
||||
})
|
||||
token.value = ''
|
||||
}
|
||||
|
||||
function setConflictMode(mode: 'skip' | 'overwrite') {
|
||||
conflictMode.value = mode
|
||||
}
|
||||
@@ -171,6 +189,17 @@ function setDirection(value: SiteSyncDirection) {
|
||||
class="lg:col-start-3"
|
||||
@click="resumeSync"
|
||||
/>
|
||||
<UButton
|
||||
v-if="resumableJob"
|
||||
:label="t('storage.backup.siteSyncAbandon')"
|
||||
icon="i-lucide-trash-2"
|
||||
color="error"
|
||||
variant="outline"
|
||||
:loading="busy"
|
||||
:disabled="!canAbandon"
|
||||
class="lg:col-start-3"
|
||||
@click="abandonSync"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="mt-3 grid gap-3 sm:grid-cols-2">
|
||||
|
||||
Reference in new issue
Block a user