Browse Source

fix: pass base id to at import modal

pull/6581/head
mertmit 1 year ago
parent
commit
81ddbe92e2
  1. 7
      packages/nc-gui/components/dashboard/TreeView/AddNewTableNode.vue
  2. 7
      packages/nc-gui/components/dashboard/TreeView/BaseOptions.vue
  3. 11
      packages/nc-gui/components/dlg/AirtableImport.vue
  4. 7
      packages/nc-gui/components/project/ImportModal.vue

7
packages/nc-gui/components/dashboard/TreeView/AddNewTableNode.vue

@ -73,8 +73,8 @@ function openQuickImportDialog(type: string, sourceId?: string) {
}
}
function openAirtableImportDialog(sourceId?: string) {
if (!sourceId) return
function openAirtableImportDialog(baseId?: string, sourceId?: string) {
if (!baseId || !sourceId) return
$e('a:actions:import-airtable')
@ -82,6 +82,7 @@ function openAirtableImportDialog(sourceId?: string) {
const { close } = useDialog(resolveComponent('DlgAirtableImport'), {
'modelValue': isOpen,
'baseId': baseId,
'sourceId': sourceId,
'onUpdate:modelValue': closeDialog,
})
@ -160,7 +161,7 @@ function openTableCreateMagicDialog(sourceId?: string) {
<a-menu-item
v-if="isUIAllowed('airtableImport', { roles: baseRole })"
key="quick-import-airtable"
@click="openAirtableImportDialog(base.sources[sourceIndex].id)"
@click="openAirtableImportDialog(base.id, base.sources[sourceIndex].id)"
>
<div class="color-transition nc-base-menu-item group">
<GeneralIcon icon="airtable" class="group-hover:text-accent" />

7
packages/nc-gui/components/dashboard/TreeView/BaseOptions.vue

@ -14,8 +14,8 @@ const baseRole = inject(ProjectRoleInj)
const { $e } = useNuxtApp()
function openAirtableImportDialog(sourceId?: string) {
if (!sourceId) return
function openAirtableImportDialog(baseId?: string, sourceId?: string) {
if (!baseId || !sourceId) return
$e('a:actions:import-airtable')
@ -23,6 +23,7 @@ function openAirtableImportDialog(sourceId?: string) {
const { close } = useDialog(resolveComponent('DlgAirtableImport'), {
'modelValue': isOpen,
'baseId': baseId,
'sourceId': sourceId,
'onUpdate:modelValue': closeDialog,
})
@ -71,7 +72,7 @@ function openQuickImportDialog(type: string) {
v-if="isUIAllowed('airtableImport', { roles: baseRole })"
key="quick-import-airtable"
v-e="['c:import:airtable']"
@click="openAirtableImportDialog(source.id)"
@click="openAirtableImportDialog(source.base_id, source.id)"
>
<GeneralIcon icon="airtable" class="max-w-3.75 group-hover:text-black" />
<div class="ml-0.5">{{ $t('labels.airtable') }}</div>

11
packages/nc-gui/components/dlg/AirtableImport.vue

@ -11,14 +11,13 @@ import {
nextTick,
onMounted,
ref,
storeToRefs,
useBase,
useNuxtApp,
watch,
} from '#imports'
const { modelValue, sourceId } = defineProps<{
const { modelValue, baseId, sourceId } = defineProps<{
modelValue: boolean
baseId: string
sourceId: string
}>()
@ -36,8 +35,6 @@ const { refreshCommandPalette } = useCommandPalette()
const { loadTables } = baseStore
const { base } = storeToRefs(baseStore)
const showGoToDashboardButton = ref(false)
const step = ref(1)
@ -135,7 +132,7 @@ async function createOrUpdate() {
body: payload,
})
} else {
syncSource.value = await $fetch(`/api/v1/meta/bases/${base.value.id}/syncs/${sourceId}`, {
syncSource.value = await $fetch(`/api/v1/meta/bases/${baseId}/syncs/${sourceId}`, {
baseURL,
method: 'POST',
headers: { 'xc-auth': $state.token.value as string },
@ -187,7 +184,7 @@ async function listenForUpdates() {
}
async function loadSyncSrc() {
const data: any = await $fetch(`/api/v1/meta/bases/${base.value.id}/syncs/${sourceId}`, {
const data: any = await $fetch(`/api/v1/meta/bases/${baseId}/syncs/${sourceId}`, {
baseURL,
method: 'GET',
headers: { 'xc-auth': $state.token.value as string },

7
packages/nc-gui/components/project/ImportModal.vue

@ -14,8 +14,8 @@ const visible = useVModel(props, 'visible', emits)
const { $e } = useNuxtApp()
function openAirtableImportDialog(sourceId?: string) {
if (!sourceId) return
function openAirtableImportDialog(baseId?: string, sourceId?: string) {
if (!baseId || !sourceId) return
$e('a:actions:import-airtable')
@ -23,6 +23,7 @@ function openAirtableImportDialog(sourceId?: string) {
const { close } = useDialog(resolveComponent('DlgAirtableImport'), {
'modelValue': isOpen,
'baseId': baseId,
'sourceId': sourceId,
'onUpdate:modelValue': closeDialog,
})
@ -59,7 +60,7 @@ const onClick = (type: 'airtable' | 'csv' | 'excel' | 'json') => {
visible.value = false
if (type === 'airtable') {
openAirtableImportDialog(source.value.id)
openAirtableImportDialog(source.value.base_id, source.value.id)
} else {
openQuickImportDialog(type)
}

Loading…
Cancel
Save