Browse Source

fix(nc-gui): preimport & import loading

pull/4135/head
Wing-Kam Wong 2 years ago
parent
commit
5f262c5d90
  1. 20
      packages/nc-gui/components/dlg/QuickImport.vue

20
packages/nc-gui/components/dlg/QuickImport.vue

@ -41,7 +41,9 @@ const jsonEditorRef = ref()
const templateEditorRef = ref() const templateEditorRef = ref()
const loading = ref(false) const preImportLoading = ref(false)
const importLoading = ref(false)
const templateData = ref() const templateData = ref()
@ -135,7 +137,7 @@ const modalWidth = computed(() => {
}) })
async function handlePreImport() { async function handlePreImport() {
loading.value = true preImportLoading.value = true
isParsingData.value = true isParsingData.value = true
if (activeKey.value === 'uploadTab') { if (activeKey.value === 'uploadTab') {
@ -152,22 +154,20 @@ async function handlePreImport() {
await parseAndExtractData(JSON.stringify(importState.jsonEditor)) await parseAndExtractData(JSON.stringify(importState.jsonEditor))
} }
// TODO(import): fix // TODO(import):
// loading.value = false preImportLoading.value = false
// isParsingData.value = false // isParsingData.value = false
} }
async function handleImport() { async function handleImport() {
try { try {
loading.value = true importLoading.value = true
await templateEditorRef.value.importTemplate() await templateEditorRef.value.importTemplate()
} catch (e: any) { } catch (e: any) {
return message.error(await extractSdkResponseErrorMsg(e)) return message.error(await extractSdkResponseErrorMsg(e))
} finally { } finally {
loading.value = false importLoading.value = false
} }
dialogShow.value = false dialogShow.value = false
} }
@ -472,14 +472,14 @@ const customReqCbk = (customReqArgs: { file: any; onSuccess: () => void }) => {
key="pre-import" key="pre-import"
type="primary" type="primary"
class="nc-btn-import" class="nc-btn-import"
:loading="loading" :loading="preImportLoading"
:disabled="disablePreImportButton" :disabled="disablePreImportButton"
@click="handlePreImport" @click="handlePreImport"
> >
{{ $t('activity.import') }} {{ $t('activity.import') }}
</a-button> </a-button>
<a-button v-else key="import" type="primary" :loading="loading" :disabled="disableImportButton" @click="handleImport"> <a-button v-else key="import" type="primary" :loading="importLoading" :disabled="disableImportButton" @click="handleImport">
{{ $t('activity.import') }} {{ $t('activity.import') }}
</a-button> </a-button>
</template> </template>

Loading…
Cancel
Save