diff --git a/packages/nc-gui/components/dlg/AirtableImport.vue b/packages/nc-gui/components/dlg/AirtableImport.vue index 73cb9905f9..d94329e29d 100644 --- a/packages/nc-gui/components/dlg/AirtableImport.vue +++ b/packages/nc-gui/components/dlg/AirtableImport.vue @@ -57,6 +57,7 @@ const syncSource = ref({ syncDirection: 'Airtable to NocoDB', syncRetryCount: 1, apiKey: '', + appId: '', shareId: '', syncSourceUrlOrId: '', options: { @@ -158,7 +159,8 @@ async function loadSyncSrc() { if (srcs && srcs[0]) { srcs[0].details = srcs[0].details || {} syncSource.value = migrateSync(srcs[0]) - syncSource.value.details.syncSourceUrlOrId = srcs[0].details.shareId + syncSource.value.details.syncSourceUrlOrId = + srcs[0].details.appId && srcs[0].details.appId.length > 0 ? srcs[0].details.syncSourceUrlOrId : srcs[0].details.shareId $jobs.subscribe({ syncId: syncSource.value.id }, onSubscribe, onStatus, onLog) } else { syncSource.value = { @@ -169,6 +171,7 @@ async function loadSyncSrc() { syncDirection: 'Airtable to NocoDB', syncRetryCount: 1, apiKey: '', + appId: '', shareId: '', syncSourceUrlOrId: '', options: { @@ -242,6 +245,8 @@ watch( if (syncSource.value.details) { const m = v && v.match(/(exp|shr).{14}/g) syncSource.value.details.shareId = m ? m[0] : '' + const m2 = v && v.match(/(app).{14}/g) + syncSource.value.details.appId = m2 ? m2[0] : '' } }, ) @@ -296,7 +301,7 @@ onMounted(async () => { 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 e31384f18d..c6c2c2b4e2 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 @@ -231,7 +231,7 @@ export class AtImportProcessor { const template = await FetchAT.readTemplate(sDB.shareId); await FetchAT.initialize(template.template.exploreApplication.shareId); } else { - await FetchAT.initialize(sDB.shareId); + await FetchAT.initialize(sDB.shareId, sDB.appId); } const ft = await FetchAT.read(); const duration = Date.now() - start; @@ -2450,6 +2450,7 @@ export interface AirtableSyncConfig { projectId?: string; baseId?: string; apiKey: string; + appId?: string; shareId: string; user: UserType; options: { diff --git a/packages/nocodb/src/modules/jobs/jobs/at-import/helpers/fetchAT.ts b/packages/nocodb/src/modules/jobs/jobs/at-import/helpers/fetchAT.ts index 1a9a8151bb..cbb7d0c650 100644 --- a/packages/nocodb/src/modules/jobs/jobs/at-import/helpers/fetchAT.ts +++ b/packages/nocodb/src/modules/jobs/jobs/at-import/helpers/fetchAT.ts @@ -4,9 +4,14 @@ const info: any = { initialized: false, }; -async function initialize(shareId) { +async function initialize(shareId, appId?: string) { info.cookie = ''; - const url = `https://airtable.com/${shareId}`; + + if (!appId || appId === '') { + appId = null; + } + + const url = `https://airtable.com/${appId ? `${appId}/` : ''}${shareId}`; try { const hreq = await axios