Skip to content

Commit

Permalink
fix process renaming in existing row (#1904)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkonie committed Mar 12, 2024
1 parent 40d6d1d commit e9852f8
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions samplesheets/vueapp/src/components/editors/DataCellEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export default Vue.extend({
nameValues: [],
nameUuids: {},
sampleColId: null,
nameColumn: false,
destroyCalled: false // HACK for issue #869
}
},
Expand Down Expand Up @@ -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 &&
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)) {
Expand All @@ -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]
Expand Down

0 comments on commit e9852f8

Please sign in to comment.