From e9852f8c1d3eedb747679b6b6c0deb79f5f7bf98 Mon Sep 17 00:00:00 2001 From: Mikko Nieminen Date: Tue, 12 Mar 2024 16:20:38 +0100 Subject: [PATCH] fix process renaming in existing row (#1904) --- .../src/components/editors/DataCellEditor.vue | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/samplesheets/vueapp/src/components/editors/DataCellEditor.vue b/samplesheets/vueapp/src/components/editors/DataCellEditor.vue index bd09fb49..500323eb 100644 --- a/samplesheets/vueapp/src/components/editors/DataCellEditor.vue +++ b/samplesheets/vueapp/src/components/editors/DataCellEditor.vue @@ -88,6 +88,7 @@ export default Vue.extend({ nameValues: [], nameUuids: {}, sampleColId: null, + nameColumn: false, destroyCalled: false // HACK for issue #869 } }, @@ -138,7 +139,7 @@ export default Vue.extend({ return '' }, getValidState () { - if (this.headerInfo.header_type === 'name') { // Name is a special case + if (this.nameColumn) { // Name is a special case // TODO: Cleanup/simplify // NOTE: Empty value is allowed for DATA materials if ((this.editValue.length === 0 && @@ -233,7 +234,6 @@ export default Vue.extend({ created () { this.app = this.params.app this.gridOptions = this.app.getGridOptionsByUuid(this.params.gridUuid) - // Cancel editing if editingCell is true if (this.app.editingCell) { this.editAllowed = false @@ -248,18 +248,18 @@ export default Vue.extend({ this.isValueArray = true this.editValue = this.editValue.join('; ') } - if (this.value.value) { this.ogEditValue = Object.assign(this.value.value) } else { this.ogEditValue = null } - this.headerInfo = this.params.headerInfo this.renderInfo = this.params.renderInfo this.editConfig = this.params.editConfig this.sampleColId = this.params.sampleColId - + if (['name', 'process_name'].includes(this.headerInfo.header_type)) { + this.nameColumn = true + } // console.log('Edit colId/field: ' + this.params.colDef.field) // DEBUG // Set up unit value @@ -322,7 +322,7 @@ export default Vue.extend({ } // Special setup for the name column - if (['name', 'process_name'].includes(this.headerInfo.header_type)) { + if (this.nameColumn) { if (this.value.newRow) this.containerTitle = 'Enter name of new or existing node' else this.containerTitle = 'Rename node' // If name, get other current values for comparison in validation @@ -370,12 +370,8 @@ export default Vue.extend({ return } - // Check if this is a process name column - let processName = false - if (this.headerInfo.header_type === 'process_name') processName = true - // Confirm renaming node into an existing node and overwriting values - if ((this.headerInfo.header_type === 'name' || processName) && + if ((this.nameColumn) && this.value.newRow && this.ogEditValue && this.nameValues.includes(this.editValue)) { @@ -392,8 +388,7 @@ export default Vue.extend({ } // Proceed with setting values and saving - if ((this.headerInfo.header_type === 'name' || processName) && - (!this.value.uuid || this.value.newRow)) { + if (this.nameColumn && (!this.value.uuid || this.value.newRow)) { // Set UUID if we are referring to an existing node (only if material) if (this.nameValues.includes(this.value.value)) { this.value.uuid = this.nameUuids[this.value.value]