From dcf3712053b9cc96f1aa2f03055cc0afc888b89d Mon Sep 17 00:00:00 2001 From: mertmit Date: Thu, 19 Oct 2023 19:46:47 +0000 Subject: [PATCH] fix: better error handling for at import --- .../nc-gui/components/dlg/AirtableImport.vue | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/packages/nc-gui/components/dlg/AirtableImport.vue b/packages/nc-gui/components/dlg/AirtableImport.vue index 769f776db2..1358a7438c 100644 --- a/packages/nc-gui/components/dlg/AirtableImport.vue +++ b/packages/nc-gui/components/dlg/AirtableImport.vue @@ -144,12 +144,12 @@ async function createOrUpdate() { } } -async function listenForUpdates() { +async function listenForUpdates(id?: string) { if (listeningForUpdates.value) return listeningForUpdates.value = true - const job = await $api.jobs.status({ syncId: syncSource.value.id }) + const job = id ? { id } : await $api.jobs.status({ syncId: syncSource.value.id }) if (!job) { listeningForUpdates.value = false @@ -226,12 +226,12 @@ async function loadSyncSrc() { async function sync() { try { - await $fetch(`/api/v1/db/meta/syncs/${syncSource.value.id}/trigger`, { + const jobData: any = await $fetch(`/api/v1/db/meta/syncs/${syncSource.value.id}/trigger`, { baseURL, method: 'POST', headers: { 'xc-auth': $state.token.value as string }, }) - listenForUpdates() + listenForUpdates(jobData.id) } catch (e: any) { message.error(await extractSdkResponseErrorMsg(e)) } @@ -251,6 +251,9 @@ async function abort() { headers: { 'xc-auth': $state.token.value as string }, }) step.value = 1 + progress.value = [] + goBack.value = false + enableAbort.value = false } catch (e: any) { message.error(await extractSdkResponseErrorMsg(e)) } @@ -258,6 +261,13 @@ async function abort() { }) } +function cancel() { + step.value = 1 + progress.value = [] + goBack.value = false + enableAbort.value = false +} + function migrateSync(src: any) { if (!src.details?.options) { src.details.options = { @@ -456,7 +466,7 @@ onMounted(async () => { {{ $t('labels.goToDashboard') }} - {{ + {{ $t('general.cancel') }} {{