diff --git a/packages/nc-gui/components/dlg/AirtableImport.vue b/packages/nc-gui/components/dlg/AirtableImport.vue index 12cd859e98..d27498af69 100644 --- a/packages/nc-gui/components/dlg/AirtableImport.vue +++ b/packages/nc-gui/components/dlg/AirtableImport.vue @@ -45,8 +45,6 @@ const enableAbort = ref(false) let socket: Socket | null -let socketInterval: NodeJS.Timer - const syncSource = ref({ id: '', type: 'Airtable', @@ -275,10 +273,10 @@ onMounted(async () => { onBeforeUnmount(() => { if (socket) { - socket.removeAllListeners() + socket.off('disconnect') socket.disconnect() + socket.removeAllListeners() } - clearInterval(socketInterval) }) diff --git a/packages/nc-gui/pages/[projectType]/[projectId]/index/index.vue b/packages/nc-gui/pages/[projectType]/[projectId]/index/index.vue index 8e050add53..e2f0c33595 100644 --- a/packages/nc-gui/pages/[projectType]/[projectId]/index/index.vue +++ b/packages/nc-gui/pages/[projectType]/[projectId]/index/index.vue @@ -75,7 +75,7 @@ function onEdit(targetKey: number, action: 'add' | 'remove' | string) {
-
+
{{ $t('general.loading') }} diff --git a/packages/nocodb/src/lib/meta/api/sync/helpers/fetchAT.ts b/packages/nocodb/src/lib/meta/api/sync/helpers/fetchAT.ts index a99947dc09..eca0dacd3c 100644 --- a/packages/nocodb/src/lib/meta/api/sync/helpers/fetchAT.ts +++ b/packages/nocodb/src/lib/meta/api/sync/helpers/fetchAT.ts @@ -36,6 +36,12 @@ async function initialize(shareId) { info.cookie += ck.split(';')[0] + '; '; } return response.data; + }) + .catch(() => { + throw { + message: + 'Invalid Shared Base ID :: Ensure www.airtable.com/ is accessible. Refer https://bit.ly/3x0OdXI for details', + }; }); info.headers = JSON.parse( @@ -64,6 +70,14 @@ async function initialize(shareId) { } catch (e) { console.log(e); info.initialized = false; + if (e.message) { + throw e; + } else { + throw { + message: + 'Error processing Shared Base :: Ensure www.airtable.com/ is accessible. Refer https://bit.ly/3x0OdXI for details', + }; + } } } @@ -94,7 +108,10 @@ async function read() { return response.data; }) .catch(() => { - throw 'Error while fetching'; + throw { + message: + 'Error Reading :: Ensure www.airtable.com/ is accessible. Refer https://bit.ly/3x0OdXI for details', + }; }); return { @@ -103,7 +120,10 @@ async function read() { baseInfo: info.baseInfo, }; } else { - throw 'Please initialize first!'; + throw { + message: + 'Error Initializing :: please try again !!', + }; } } @@ -149,11 +169,17 @@ async function readView(viewId) { return response.data; }) .catch(() => { - throw 'Error while fetching'; + throw { + message: + 'Error Reading View :: Ensure www.airtable.com/ is accessible. Refer https://bit.ly/3x0OdXI for details', + }; }); return { view: resreq.data }; } else { - throw 'Please initialize first!'; + throw { + message: + 'Error Initializing :: please try again !!', + }; } } @@ -192,7 +218,10 @@ async function readTemplate(templateId) { return response.data; }) .catch(() => { - throw 'Error while fetching'; + throw { + message: + 'Error Fetching :: Ensure www.airtable.com/templates/featured/ is accessible.', + }; }); return { template: resreq }; } diff --git a/packages/nocodb/src/lib/meta/api/sync/helpers/job.ts b/packages/nocodb/src/lib/meta/api/sync/helpers/job.ts index 8f607b3bf6..9344c8f606 100644 --- a/packages/nocodb/src/lib/meta/api/sync/helpers/job.ts +++ b/packages/nocodb/src/lib/meta/api/sync/helpers/job.ts @@ -190,6 +190,13 @@ export default async ( const duration = Date.now() - start; rtc.fetchAt.count++; rtc.fetchAt.time += duration; + + if (!ft.baseId) { + throw { + message: + 'Invalid Shared Base ID :: Ensure www.airtable.com/ is accessible. Refer https://bit.ly/3x0OdXI for details', + }; + } const file = ft.schema; baseId = ft.baseId; diff --git a/packages/nocodb/src/lib/meta/api/sync/importApis.ts b/packages/nocodb/src/lib/meta/api/sync/importApis.ts index 5b3d05bcb9..92ab241117 100644 --- a/packages/nocodb/src/lib/meta/api/sync/importApis.ts +++ b/packages/nocodb/src/lib/meta/api/sync/importApis.ts @@ -107,14 +107,17 @@ export default ( baseURL = `http://localhost:${process.env.PORT || 8080}`; } - NocoJobs.jobsMgr.add(AIRTABLE_IMPORT_JOB, { - id: req.params.syncId, - ...(syncSource?.details || {}), - projectId: syncSource.project_id, - baseId: syncSource.base_id, - authToken: token, - baseURL, - }); + setTimeout(() => { + NocoJobs.jobsMgr.add(AIRTABLE_IMPORT_JOB, { + id: req.params.syncId, + ...(syncSource?.details || {}), + projectId: syncSource.project_id, + baseId: syncSource.base_id, + authToken: token, + baseURL, + }); + }, 1000); + jobs[req.params.syncId] = { last_message: { msg: 'Sync started',