Browse Source

fix: airtable import with app ID

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/6283/head
Raju Udava 1 year ago
parent
commit
f0c5eb4e4e
  1. 9
      packages/nc-gui/components/dlg/AirtableImport.vue
  2. 3
      packages/nocodb/src/modules/jobs/jobs/at-import/at-import.processor.ts
  3. 9
      packages/nocodb/src/modules/jobs/jobs/at-import/helpers/fetchAT.ts

9
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 () => {
<a-input
v-model:value="syncSource.details.syncSourceUrlOrId"
class="nc-input-shared-base"
:placeholder="`${$t('labels.sharedBase')} ID / URL`"
:placeholder="`${$t('labels.sharedBase')} URL`"
size="large"
/>
</a-form-item>

3
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: {

9
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

Loading…
Cancel
Save