Browse Source

chore(gui-v2): bypass bulk import if data is not found & reset loading

pull/2828/head
Wing-Kam Wong 2 years ago
parent
commit
b9737dca9d
  1. 5
      packages/nc-gui-v2/components/template/Editor.vue

5
packages/nc-gui-v2/components/template/Editor.vue

@ -214,6 +214,7 @@ const importTemplate = async () => {
} catch (errorInfo) {
// TODO: handle error message
console.log('Failed:', errorInfo)
loading.value = false
return
}
@ -267,6 +268,7 @@ const importTemplate = async () => {
// TODO: retrieve error msg from sdk
console.log(e)
toast.error(e.message)
loading.value = false
return
}
@ -280,18 +282,21 @@ const importTemplate = async () => {
(async (tableMeta) => {
const tableName = tableMeta.table_title
const data = importData[tableMeta.ref_table_name]
if (data) {
total += data.length
for (let i = 0; i < data.length; i += 500) {
const batchData = remapColNames(data.slice(i, i + 500), tableMeta.columns)
await $api.dbTableRow.bulkCreate('noco', projectName, tableName, batchData)
progress += batchData.length
}
}
})(v),
),
)
} catch (e: any) {
// TODO: retrieve error msg from sdk
toast.error(e.message)
loading.value = false
return
}
}

Loading…
Cancel
Save