From e735aa8076760665cac2fbbb803ee76c5c38002a Mon Sep 17 00:00:00 2001 From: mertmit Date: Thu, 16 Nov 2023 10:21:40 +0000 Subject: [PATCH 1/2] fix: refresh table list on fail --- packages/nc-gui/components/dlg/AirtableImport.vue | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/nc-gui/components/dlg/AirtableImport.vue b/packages/nc-gui/components/dlg/AirtableImport.vue index 692da11e3e..9b8ec341eb 100644 --- a/packages/nc-gui/components/dlg/AirtableImport.vue +++ b/packages/nc-gui/components/dlg/AirtableImport.vue @@ -90,8 +90,10 @@ const onStatus = async (status: JobStatus, data?: any) => { refreshCommandPalette() // TODO: add tab of the first table } else if (status === JobStatus.FAILED) { + await loadTables() goBack.value = true pushProgress(data.error.message, status) + refreshCommandPalette() } } @@ -115,7 +117,10 @@ const { validateInfos } = useForm(syncSource, validators) const disableImportButton = computed(() => !syncSource.value.details.apiKey || !syncSource.value.details.syncSourceUrlOrId) +const isLoading = ref(false) + async function saveAndSync() { + isLoading.value = true await createOrUpdate() await sync() } @@ -178,6 +183,7 @@ async function listenForUpdates(id?: string) { } } else { listeningForUpdates.value = false + isLoading.value = false } }, ) @@ -494,6 +500,7 @@ onMounted(async () => { v-e="['c:sync-airtable:save-and-sync']" type="primary" class="nc-btn-airtable-import" + :loading="isLoading" :disabled="disableImportButton" @click="saveAndSync" > From d114ca94211ee56ea6faa22f522ebfec73d5cf82 Mon Sep 17 00:00:00 2001 From: mertmit Date: Thu, 16 Nov 2023 10:21:44 +0000 Subject: [PATCH 2/2] fix: delete partially imported tables on error --- .../src/modules/jobs/jobs/at-import/at-import.processor.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/nocodb/src/modules/jobs/jobs/at-import/at-import.processor.ts b/packages/nocodb/src/modules/jobs/jobs/at-import/at-import.processor.ts index b4a96b1ad1..1e7d6a7743 100644 --- a/packages/nocodb/src/modules/jobs/jobs/at-import/at-import.processor.ts +++ b/packages/nocodb/src/modules/jobs/jobs/at-import/at-import.processor.ts @@ -2529,6 +2529,13 @@ export class AtImportProcessor { await generateMigrationStats(aTblSchema); } } catch (e) { + // delete tables that were created + for (const table of ncSchema.tables) { + await this.tablesService.tableDelete({ + tableId: table.id, + user: syncDB.user, + }); + } if (e.message) { this.telemetryService.sendEvent({ evt_type: 'a:airtable-import:error',