|
|
@ -8,7 +8,7 @@ import MdiFileIcon from '~icons/mdi/file-plus-outline' |
|
|
|
import MdiFileUploadOutlineIcon from '~icons/mdi/file-upload-outline' |
|
|
|
import MdiFileUploadOutlineIcon from '~icons/mdi/file-upload-outline' |
|
|
|
import MdiLinkVariantIcon from '~icons/mdi/link-variant' |
|
|
|
import MdiLinkVariantIcon from '~icons/mdi/link-variant' |
|
|
|
import MdiCodeJSONIcon from '~icons/mdi/code-json' |
|
|
|
import MdiCodeJSONIcon from '~icons/mdi/code-json' |
|
|
|
import { fieldRequiredValidator, importUrlValidator } from '~/utils/validation' |
|
|
|
import { fieldRequiredValidator, importCsvUrlValidator, importExcelUrlValidator, importUrlValidator } from '~/utils/validation' |
|
|
|
import { extractSdkResponseErrorMsg } from '~/utils/errorUtils' |
|
|
|
import { extractSdkResponseErrorMsg } from '~/utils/errorUtils' |
|
|
|
import { ExcelTemplateAdapter, ExcelUrlTemplateAdapter, JSONTemplateAdapter, JSONUrlTemplateAdapter } from '~/utils/parsers' |
|
|
|
import { ExcelTemplateAdapter, ExcelUrlTemplateAdapter, JSONTemplateAdapter, JSONUrlTemplateAdapter } from '~/utils/parsers' |
|
|
|
import { useProject } from '#imports' |
|
|
|
import { useProject } from '#imports' |
|
|
@ -47,7 +47,7 @@ const importState = reactive({ |
|
|
|
|
|
|
|
|
|
|
|
const validators = computed(() => { |
|
|
|
const validators = computed(() => { |
|
|
|
return { |
|
|
|
return { |
|
|
|
url: [fieldRequiredValidator, importUrlValidator], |
|
|
|
url: [fieldRequiredValidator, importUrlValidator, importType === 'csv' ? importCsvUrlValidator : importExcelUrlValidator], |
|
|
|
maxRowsToParse: [fieldRequiredValidator], |
|
|
|
maxRowsToParse: [fieldRequiredValidator], |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
@ -122,7 +122,10 @@ async function parseAndExtractData(val: any, name: string) { |
|
|
|
templateData.value = null |
|
|
|
templateData.value = null |
|
|
|
importData.value = null |
|
|
|
importData.value = null |
|
|
|
const templateGenerator: any = getAdapter(name, val) |
|
|
|
const templateGenerator: any = getAdapter(name, val) |
|
|
|
|
|
|
|
if (!templateGenerator) { |
|
|
|
|
|
|
|
toast.error('Template Generator cannot be found!') |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
await templateGenerator.init() |
|
|
|
await templateGenerator.init() |
|
|
|
templateGenerator.parse() |
|
|
|
templateGenerator.parse() |
|
|
|
templateData.value = templateGenerator.getTemplate() |
|
|
|
templateData.value = templateGenerator.getTemplate() |
|
|
@ -281,4 +284,4 @@ function getAdapter(name: string, val: any) { |
|
|
|
overflow: auto; |
|
|
|
overflow: auto; |
|
|
|
height: 300px; |
|
|
|
height: 300px; |
|
|
|
} |
|
|
|
} |
|
|
|
</style> |
|
|
|
</style> |
|
|
|