final changes from PR comments

This commit is contained in:
Jamie Vigliotta 2020-07-24 10:11:46 -07:00
parent 68eb5e6286
commit 26069dac79
2 changed files with 19 additions and 11 deletions

View File

@ -85,13 +85,11 @@ export default {
item.key = this.openmct.objects.makeKeyString(domainObject.identifier);
this.items.push(item);
// this.checkForUnits();
},
removeItem(identifier) {
let index = this.items.findIndex(item => this.openmct.objects.makeKeyString(identifier) === item.key);
this.items.splice(index, 1);
// this.checkForUnits();
},
reorder(reorderPlan) {
let oldItems = this.items.slice();

View File

@ -65,8 +65,25 @@ export default {
return {
primaryTelemetryObjects: [],
secondaryTelemetryObjects: {},
compositions: [],
hasUnits: false
compositions: []
}
},
computed: {
hasUnits() {
for(let telemetryObject in this.secondaryTelemetryObjects) {
if(this.secondaryTelemetryObjects[telemetryObject]) {
let objects = this.secondaryTelemetryObjects[telemetryObject];
for(let current of objects) {
let metadata = this.openmct.telemetry.getMetadata(current.domainObject);
for(let metadatum of metadata.valueMetadatas) {
if(metadatum.unit) {
return true;
}
}
}
}
}
return false;
}
},
mounted() {
@ -111,7 +128,6 @@ export default {
this.$set(this.secondaryTelemetryObjects, primary.key, undefined);
this.primaryTelemetryObjects.splice(index,1);
primary = undefined;
this.checkForUnits();
},
reorderPrimary(reorderPlan) {
let oldComposition = this.primaryTelemetryObjects.slice();
@ -129,9 +145,6 @@ export default {
array.push(secondary);
this.$set(this.secondaryTelemetryObjects, primary.key, array);
if(!this.hasUnits) {
this.checkForUnits(domainObject);
}
}
},
removeSecondary(primary) {
@ -142,9 +155,6 @@ export default {
array.splice(index, 1);
this.$set(this.secondaryTelemetryObjects, primary.key, array);
if(this.hasUnits) {
this.checkForUnits();
}
}
},
checkForUnits() {