From 32c8af128076c00f1d6b18eee7d4856404cc2a9c Mon Sep 17 00:00:00 2001 From: Anton Date: Wed, 26 Jun 2024 15:24:29 +0200 Subject: [PATCH] Exclude default columns from mapping [SCI-10808] --- .../modals/import/mapping_step_table_row.vue | 19 ++++++++++++++++--- config/locales/en.yml | 9 +++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/app/javascript/vue/repositories/modals/import/mapping_step_table_row.vue b/app/javascript/vue/repositories/modals/import/mapping_step_table_row.vue index 77656f289..8bb160c02 100644 --- a/app/javascript/vue/repositories/modals/import/mapping_step_table_row.vue +++ b/app/javascript/vue/repositories/modals/import/mapping_step_table_row.vue @@ -23,7 +23,7 @@ :clearable="true" :size="'sm'" :class="{ - 'outline-sn-alert-brittlebush outline-1 outline rounded': matchNotFound + 'outline-sn-alert-brittlebush outline-1 outline rounded': computeMatchNotFound }" :placeholder="computeMatchNotFound ? i18n.t('repositories.import_records.steps.step2.table.tableRow.placeholders.matchNotFound') : @@ -51,7 +51,7 @@ - @@ -100,6 +100,16 @@ export default { type: 'Text', name: '' }, + systemColumns: [ + this.i18n.t('repositories.import_records.steps.step2.systemColumns.added_by'), + this.i18n.t('repositories.import_records.steps.step2.systemColumns.created_on'), + this.i18n.t('repositories.import_records.steps.step2.systemColumns.updated_by'), + this.i18n.t('repositories.import_records.steps.step2.systemColumns.updated_on'), + this.i18n.t('repositories.import_records.steps.step2.systemColumns.archived_by'), + this.i18n.t('repositories.import_records.steps.step2.systemColumns.archived_on'), + this.i18n.t('repositories.import_records.steps.step2.systemColumns.parents'), + this.i18n.t('repositories.import_records.steps.step2.systemColumns.children') + ], newColumnTypes: [ ['Text', this.i18n.t('repositories.import_records.steps.step2.table.tableRow.newColumnType.text')], ['List', this.i18n.t('repositories.import_records.steps.step2.table.tableRow.newColumnType.list')] @@ -122,7 +132,7 @@ export default { }, computed: { computeMatchNotFound() { - return this.autoMapping && ((this.selectedColumnType && !this.selectedColumnType.key) || !this.selectedColumnType); + return this.autoMapping && !this.isSystemColumn(this.item) && ((this.selectedColumnType && !this.selectedColumnType.key) || !this.selectedColumnType); }, selected() { return !!this.value?.key; @@ -138,6 +148,9 @@ export default { } }, methods: { + isSystemColumn(column) { + return this.systemColumns.includes(column); + }, autoMap() { Object.entries(this.params.import_data.available_fields).forEach(([key, value]) => { if (this.item === value) { diff --git a/config/locales/en.yml b/config/locales/en.yml index b6dbb15b0..0eb7b465a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2228,6 +2228,15 @@ en: cancelBtnText: 'Cancel' confirmBtnText: 'Confirm' importedIgnoredSection: '%{imported} columns to import. %{ignored} columns ignored.' + systemColumns: + added_by: 'Added by' + created_on: 'Created on' + updated_by: 'Updated by' + updated_on: 'Updated on' + archived_by: 'Archived by' + archived_on: 'Archived on' + parents: 'Parents' + children: 'Children' computedDropdownOptions: name: 'Name' id: 'ID'