Delete measurement
This commit is contained in:
parent
b2fa171d17
commit
c1ff0d57b4
7 changed files with 28 additions and 7 deletions
|
@ -24,5 +24,13 @@ export default Controller.extend(SaveModel, {
|
|||
});
|
||||
},
|
||||
|
||||
deleteMeasurement: function(measurement) {
|
||||
const characteristic = measurement.get('characteristic');
|
||||
if (characteristic.get('isNew')) {
|
||||
characteristic.destroyRecord();
|
||||
}
|
||||
measurement.destroyRecord();
|
||||
},
|
||||
|
||||
},
|
||||
});
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
add-characteristic=(action "addCharacteristic")
|
||||
allCharacteristics=allCharacteristics
|
||||
save-measurement=(action "saveMeasurement")
|
||||
delete-measurement=(action "deleteMeasurement")
|
||||
on-save=(action "save")
|
||||
on-cancel=(action "cancel")
|
||||
}}
|
||||
|
|
|
@ -8,8 +8,12 @@ export default Component.extend({
|
|||
allCharacteristics: null,
|
||||
measurement: null,
|
||||
|
||||
// Actions
|
||||
"save-measurement": null,
|
||||
"delete-measurement": null,
|
||||
|
||||
oldCharacteristicId: function() {
|
||||
let json = this.get('measurement').toJSON();
|
||||
const json = this.get('measurement').toJSON();
|
||||
return json.characteristic;
|
||||
}.property(),
|
||||
|
||||
|
@ -29,12 +33,8 @@ export default Component.extend({
|
|||
},
|
||||
|
||||
delete: function() {
|
||||
let char = this.get('measurement.characteristic');
|
||||
if (char.get('isNew')) {
|
||||
char.destroyRecord();
|
||||
}
|
||||
this.get('measurement').destroyRecord();
|
||||
}
|
||||
this.attrs['delete-measurement'](this.get('measurement'));
|
||||
},
|
||||
|
||||
},
|
||||
});
|
||||
|
|
|
@ -13,6 +13,7 @@ export default Component.extend({
|
|||
// Actions
|
||||
"add-characteristic": null,
|
||||
"save-measurement": null,
|
||||
"delete-measurement": null,
|
||||
|
||||
// Properties
|
||||
sortParams: ['characteristic.characteristicTypeName', 'characteristic.sortOrder', 'characteristic.characteristicName'],
|
||||
|
@ -45,6 +46,10 @@ export default Component.extend({
|
|||
saveMeasurement: function(measurement) {
|
||||
return this.attrs['save-measurement'](measurement);
|
||||
},
|
||||
|
||||
deleteMeasurement: function(measurement) {
|
||||
return this.attrs['delete-measurement'](measurement);
|
||||
},
|
||||
},
|
||||
|
||||
});
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
protected/strains/measurements-table-row
|
||||
measurement=measurement
|
||||
save-measurement=(action "saveMeasurement")
|
||||
delete-measurement=(action "deleteMeasurement")
|
||||
allCharacteristics=allCharacteristics
|
||||
canEdit=canEdit
|
||||
}}
|
||||
|
|
|
@ -17,6 +17,7 @@ export default Component.extend(SetupMetaData, {
|
|||
"on-update": null,
|
||||
"add-characteristic": null,
|
||||
"save-measurement": null,
|
||||
"delete-measurement": null,
|
||||
|
||||
// Property mapping
|
||||
propertiesList: ['strainName', 'typeStrain', 'species', 'isolatedFrom', 'accessionNumbers', 'genbank', 'wholeGenomeSequence', 'notes'],
|
||||
|
@ -65,6 +66,10 @@ export default Component.extend(SetupMetaData, {
|
|||
return this.attrs['save-measurement'](measurement);
|
||||
},
|
||||
|
||||
deleteMeasurement: function(measurement) {
|
||||
return this.attrs['delete-measurement'](measurement);
|
||||
},
|
||||
|
||||
strainNameDidChange: function(value) {
|
||||
this.updateField('strainName', value);
|
||||
},
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
add-characteristic=(action "addCharacteristic")
|
||||
allCharacteristics=allCharacteristics
|
||||
save-measurement=(action "saveMeasurement")
|
||||
delete-measurement=(action "deleteMeasurement")
|
||||
canEdit=strain.canEdit
|
||||
canAdd=metaData.canAdd
|
||||
}}
|
||||
|
|
Reference in a new issue