Browse Source

fix: better error handling for at import

pull/6742/head
mertmit 1 year ago
parent
commit
dcf3712053
  1. 20
      packages/nc-gui/components/dlg/AirtableImport.vue

20
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 if (listeningForUpdates.value) return
listeningForUpdates.value = true 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) { if (!job) {
listeningForUpdates.value = false listeningForUpdates.value = false
@ -226,12 +226,12 @@ async function loadSyncSrc() {
async function sync() { async function sync() {
try { 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, baseURL,
method: 'POST', method: 'POST',
headers: { 'xc-auth': $state.token.value as string }, headers: { 'xc-auth': $state.token.value as string },
}) })
listenForUpdates() listenForUpdates(jobData.id)
} catch (e: any) { } catch (e: any) {
message.error(await extractSdkResponseErrorMsg(e)) message.error(await extractSdkResponseErrorMsg(e))
} }
@ -251,6 +251,9 @@ async function abort() {
headers: { 'xc-auth': $state.token.value as string }, headers: { 'xc-auth': $state.token.value as string },
}) })
step.value = 1 step.value = 1
progress.value = []
goBack.value = false
enableAbort.value = false
} catch (e: any) { } catch (e: any) {
message.error(await extractSdkResponseErrorMsg(e)) 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) { function migrateSync(src: any) {
if (!src.details?.options) { if (!src.details?.options) {
src.details.options = { src.details.options = {
@ -456,7 +466,7 @@ onMounted(async () => {
<a-button v-if="showGoToDashboardButton" class="mt-4" size="large" @click="dialogShow = false"> <a-button v-if="showGoToDashboardButton" class="mt-4" size="large" @click="dialogShow = false">
{{ $t('labels.goToDashboard') }} {{ $t('labels.goToDashboard') }}
</a-button> </a-button>
<a-button v-else-if="goBack" class="mt-4 uppercase" size="large" danger @click="step = 1">{{ <a-button v-else-if="goBack" class="mt-4 uppercase" size="large" danger @click="cancel()">{{
$t('general.cancel') $t('general.cancel')
}}</a-button> }}</a-button>
<a-button v-else-if="enableAbort" class="mt-4 uppercase" size="large" danger @click="abort()">{{ <a-button v-else-if="enableAbort" class="mt-4 uppercase" size="large" danger @click="abort()">{{

Loading…
Cancel
Save