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) { async parseAndExtractData(type, val, name) {
let templateGenerator try {
switch (type) { let templateGenerator
case 'file': this.templateData = null
templateGenerator = new ExcelTemplateAdapter(name, val, this.parserConfig) this.importData = null
break switch (type) {
case 'url': case 'file':
templateGenerator = new ExcelUrlTemplateAdapter(val, this.$store, this.parserConfig) templateGenerator = new ExcelTemplateAdapter(name, val, this.parserConfig)
break 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) { dropHandler(ev) {

Loading…
Cancel
Save