From 0023f6d008e8134581af5cff394270e4691f34f6 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Wed, 9 Feb 2022 17:53:59 +0800 Subject: [PATCH 1/3] fix: trigger reload after inserting data Signed-off-by: Wing-Kam Wong --- .../components/project/spreadsheet/components/moreActions.vue | 1 + .../nc-gui/components/project/spreadsheet/rowsXcDataTable.vue | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/nc-gui/components/project/spreadsheet/components/moreActions.vue b/packages/nc-gui/components/project/spreadsheet/components/moreActions.vue index 84329f6a44..d7dd20868f 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/moreActions.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/moreActions.vue @@ -289,6 +289,7 @@ export default { } this.columnMappingModal = false this.$store.commit('loader/MutClear') + this.$emit('reload') this.$toast.success('Successfully imported table data').goAway(3000) } catch (e) { this.$toast.error(e.message).goAway(3000) diff --git a/packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue b/packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue index 06d697795f..3106c373e5 100644 --- a/packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue +++ b/packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue @@ -110,6 +110,7 @@ :selected-view="selectedView" @showAdditionalFeatOverlay="showAdditionalFeatOverlay($event)" @webhook="showAdditionalFeatOverlay('webhooks')" + @reload="reload" /> From 0de80f114465900444af6801b1b074b73734b3a7 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Wed, 9 Feb 2022 18:29:14 +0800 Subject: [PATCH 2/3] fix: missing validation error after mapping columns Signed-off-by: Wing-Kam Wong --- .../spreadsheet/components/importExport/columnMappingModal.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/nc-gui/components/project/spreadsheet/components/importExport/columnMappingModal.vue b/packages/nc-gui/components/project/spreadsheet/components/importExport/columnMappingModal.vue index 77dae900a3..5f32ac0940 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/importExport/columnMappingModal.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/importExport/columnMappingModal.vue @@ -154,6 +154,7 @@ export default { } this.mappings.push(o) } + this.$nextTick(()=> this.$refs.form.validate()) }, getIcon(uidt) { return getUIDTIcon(uidt) || 'mdi-alpha-v-circle-outline' From 9b4172361f1c3c03ee9a7f3b9a06e12bc234044e Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Wed, 9 Feb 2022 18:57:32 +0800 Subject: [PATCH 3/3] fix: column validation logic Signed-off-by: Wing-Kam Wong --- .../importExport/columnMappingModal.vue | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/packages/nc-gui/components/project/spreadsheet/components/importExport/columnMappingModal.vue b/packages/nc-gui/components/project/spreadsheet/components/importExport/columnMappingModal.vue index 5f32ac0940..740342d0f5 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/importExport/columnMappingModal.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/importExport/columnMappingModal.vue @@ -7,7 +7,11 @@ {{ requiredColumnValidationError }} +
+ {{ noSelectedColumnError }} +
@@ -39,7 +46,7 @@ - +
@@ -117,6 +124,12 @@ export default { return `Following columns are required : ${missingRequiredColumns.map(c => c._cn).join(', ')}` } return false + }, + noSelectedColumnError() { + if ((this.mappings || []).filter(v => v.enabled === true).length == 0) { + return 'At least one column has to be selected' + } + return false } }, mounted() { @@ -129,6 +142,11 @@ export default { return true } + // if it is not selected, then pass validation + if (!row.enabled) { + return true + } + const v = this.meta && this.meta.columns.find(c => c._cn === _cn) if ((this.mappings || []).filter(v => v.destCn === _cn).length > 1) { return 'Duplicate mapping found, please remove one of the mapping' }