站点同步
This commit is contained in:
1 parent
a64be50b73
commit
9cb8552a99
28 files changed
+1683
-18
No files matched your search
@@ -1,5 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import type { BackupJobItem, SyncDraft } from '~/types/backup'
|
||||
import type {
|
||||
BackupJobItem,
|
||||
SiteSyncRequest,
|
||||
SyncDraft
|
||||
} from '~/types/backup'
|
||||
import type { StorageBackendItem } from '~/types/storage'
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -31,6 +35,7 @@ const {
|
||||
confirmRestore,
|
||||
previewSync,
|
||||
startSync,
|
||||
startSiteSync,
|
||||
retryJob,
|
||||
cancelJob,
|
||||
downloadUrl
|
||||
@@ -45,6 +50,14 @@ const activeJob = computed(() => getActiveJob())
|
||||
const exportBusy = computed(() => activeJob.value?.type === 'full_export')
|
||||
const restoreBusy = computed(() => activeJob.value?.type === 'full_restore')
|
||||
const syncBusy = computed(() => activeJob.value?.type === 'backend_sync')
|
||||
const siteSyncBusy = computed(() => activeJob.value?.type === 'site_sync')
|
||||
const resumableSiteSyncJob = computed(() =>
|
||||
jobs.value.find(job =>
|
||||
job.type === 'site_sync'
|
||||
&& job.status === 'failed'
|
||||
&& job.payload.resumable === true
|
||||
) ?? null
|
||||
)
|
||||
const anyJobBusy = computed(() => Boolean(activeJob.value))
|
||||
|
||||
onMounted(async () => {
|
||||
@@ -94,6 +107,10 @@ async function onSync(body: {
|
||||
await startSync(body)
|
||||
}
|
||||
|
||||
async function onSiteSync(body: SiteSyncRequest) {
|
||||
await startSiteSync(body)
|
||||
}
|
||||
|
||||
function onDownload(jobId: string) {
|
||||
window.open(downloadUrl(jobId), '_blank')
|
||||
}
|
||||
@@ -159,6 +176,14 @@ function onViewJob(job: BackupJobItem) {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<StorageSiteSyncCard
|
||||
:busy="siteSyncBusy"
|
||||
:disabled="anyJobBusy && !siteSyncBusy"
|
||||
:active-job="siteSyncBusy ? activeJob : null"
|
||||
:resumable-job="resumableSiteSyncJob"
|
||||
@sync="onSiteSync"
|
||||
/>
|
||||
|
||||
<StorageBackupJobTable
|
||||
:jobs="jobs"
|
||||
:polling="polling"
|
||||
|
||||
Reference in new issue
Block a user