Browse Source

refactor: excel import error handling

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/805/head
Pranav C 3 years ago
parent
commit
ba7016726f
  1. 33
      packages/nc-gui/components/import/excelImport.vue

33
packages/nc-gui/components/import/excelImport.vue

@ -248,20 +248,27 @@ export default {
},
async parseAndExtractData(type, val, name) {
let templateGenerator
switch (type) {
case 'file':
templateGenerator = new ExcelTemplateAdapter(name, val, this.parserConfig)
break
case 'url':
templateGenerator = new ExcelUrlTemplateAdapter(val, this.$store, this.parserConfig)
break
try {
let templateGenerator
this.templateData = null
this.importData = null
switch (type) {
case 'file':
templateGenerator = new ExcelTemplateAdapter(name, val, this.parserConfig)
break
case 'url':
templateGenerator = new ExcelUrlTemplateAdapter(val, this.$store, this.parserConfig)
break
}
await templateGenerator.init()
templateGenerator.parse()
this.templateData = templateGenerator.getTemplate()
this.importData = templateGenerator.getData()
this.templateEditorModal = true
} catch (e) {
console.log(e)
this.$toast.error(e.message).goAway(3000)
}
await templateGenerator.init()
templateGenerator.parse()
this.templateData = templateGenerator.getTemplate()
this.importData = templateGenerator.getData()
this.templateEditorModal = true
},
dropHandler(ev) {

Loading…
Cancel
Save