From ab3a4c53166dca8ccf27e696863ae342df2b2ee4 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 18 Apr 2022 12:23:17 +0800 Subject: [PATCH] fix: import csv issue Signed-off-by: Wing-Kam Wong --- .../project/spreadsheet/components/moreActions.vue | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/nc-gui/components/project/spreadsheet/components/moreActions.vue b/packages/nc-gui/components/project/spreadsheet/components/moreActions.vue index 630f94eb7c..b8be60b14e 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/moreActions.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/moreActions.vue @@ -286,10 +286,6 @@ export default { }, async importData(columnMappings) { try { - const api = this.$ncApis.get({ - table: this.meta.table_name - }) - const data = this.parsedCsv.data for (let i = 0, progress = 0; i < data.length; i += 500) { const batchData = data.slice(i, i + 500).map(row => columnMappings.reduce((res, col) => { @@ -312,7 +308,12 @@ export default { } return res }, {})) - await api.insertBulk(batchData) + await this.$api.dbTableRow.bulkCreate( + 'noco', + this.projectName, + this.meta.title, + batchData + ) progress += batchData.length this.$store.commit('loader/MutMessage', `Importing data : ${progress}/${data.length}`) this.$store.commit('loader/MutProgress', Math.round((100 * progress / data.length)))