mirror of
https://github.com/nasa/openmct.git
synced 2024-12-24 07:16:39 +00:00
renamed methods and variables for clarity
This commit is contained in:
parent
0d478d5dfc
commit
66bb938fc4
@ -32,20 +32,20 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<template
|
<template
|
||||||
v-for="primary in primaryTelemetryObjects"
|
v-for="ladTable in ladTableObjects"
|
||||||
>
|
>
|
||||||
<tr
|
<tr
|
||||||
:key="primary.key"
|
:key="ladTable.key"
|
||||||
class="c-table__group-header js-lad-table-set__table-headers"
|
class="c-table__group-header js-lad-table-set__table-headers"
|
||||||
>
|
>
|
||||||
<td colspan="10">
|
<td colspan="10">
|
||||||
{{ primary.domainObject.name }}
|
{{ ladTable.domainObject.name }}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<lad-row
|
<lad-row
|
||||||
v-for="secondary in secondaryTelemetryObjects[primary.key]"
|
v-for="telemetryObject in ladTelemetryObjects[ladTable.key]"
|
||||||
:key="secondary.key"
|
:key="telemetryObject.key"
|
||||||
:domain-object="secondary.domainObject"
|
:domain-object="telemetryObject.domainObject"
|
||||||
:has-units="hasUnits"
|
:has-units="hasUnits"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
@ -63,16 +63,16 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
primaryTelemetryObjects: [],
|
ladTableObjects: [],
|
||||||
secondaryTelemetryObjects: {},
|
ladTelemetryObjects: {},
|
||||||
compositions: []
|
compositions: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
hasUnits() {
|
hasUnits() {
|
||||||
let ladTables = Object.values(this.secondaryTelemetryObjects);
|
let telemetryObjects = Object.values(this.ladTelemetryObjects);
|
||||||
for(let ladTable of ladTables) {
|
for(let telemtryObjectsByKey of telemetryObjects) {
|
||||||
for(let telemetryObject of ladTable) {
|
for(let telemetryObject of telemtryObjectsByKey) {
|
||||||
let metadata = this.openmct.telemetry.getMetadata(telemetryObject.domainObject);
|
let metadata = this.openmct.telemetry.getMetadata(telemetryObject.domainObject);
|
||||||
for(let metadatum of metadata.valueMetadatas) {
|
for(let metadatum of metadata.valueMetadatas) {
|
||||||
if(metadatum.unit) {
|
if(metadatum.unit) {
|
||||||
@ -86,32 +86,32 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.composition = this.openmct.composition.get(this.domainObject);
|
this.composition = this.openmct.composition.get(this.domainObject);
|
||||||
this.composition.on('add', this.addPrimary);
|
this.composition.on('add', this.addLadTable);
|
||||||
this.composition.on('remove', this.removePrimary);
|
this.composition.on('remove', this.removeLadTable);
|
||||||
this.composition.on('reorder', this.reorderPrimary);
|
this.composition.on('reorder', this.reorderLadTables);
|
||||||
this.composition.load();
|
this.composition.load();
|
||||||
},
|
},
|
||||||
destroyed() {
|
destroyed() {
|
||||||
this.composition.off('add', this.addPrimary);
|
this.composition.off('add', this.addLadTable);
|
||||||
this.composition.off('remove', this.removePrimary);
|
this.composition.off('remove', this.removeLadTable);
|
||||||
this.composition.off('reorder', this.reorderPrimary);
|
this.composition.off('reorder', this.reorderLadTables);
|
||||||
this.compositions.forEach(c => {
|
this.compositions.forEach(c => {
|
||||||
c.composition.off('add', c.addCallback);
|
c.composition.off('add', c.addCallback);
|
||||||
c.composition.off('remove', c.removeCallback);
|
c.composition.off('remove', c.removeCallback);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
addPrimary(domainObject) {
|
addLadTable(domainObject) {
|
||||||
let primary = {};
|
let ladTable = {};
|
||||||
primary.domainObject = domainObject;
|
ladTable.domainObject = domainObject;
|
||||||
primary.key = this.openmct.objects.makeKeyString(domainObject.identifier);
|
ladTable.key = this.openmct.objects.makeKeyString(domainObject.identifier);
|
||||||
|
|
||||||
this.$set(this.secondaryTelemetryObjects, primary.key, []);
|
this.$set(this.ladTelemetryObjects, ladTable.key, []);
|
||||||
this.primaryTelemetryObjects.push(primary);
|
this.ladTableObjects.push(ladTable);
|
||||||
|
|
||||||
let composition = this.openmct.composition.get(primary.domainObject),
|
let composition = this.openmct.composition.get(ladTable.domainObject),
|
||||||
addCallback = this.addSecondary(primary),
|
addCallback = this.addTelemetryObject(ladTable),
|
||||||
removeCallback = this.removeSecondary(primary);
|
removeCallback = this.removeTelemetryObject(ladTable);
|
||||||
|
|
||||||
composition.on('add', addCallback);
|
composition.on('add', addCallback);
|
||||||
composition.on('remove', removeCallback);
|
composition.on('remove', removeCallback);
|
||||||
@ -119,39 +119,39 @@ export default {
|
|||||||
|
|
||||||
this.compositions.push({composition, addCallback, removeCallback});
|
this.compositions.push({composition, addCallback, removeCallback});
|
||||||
},
|
},
|
||||||
removePrimary(identifier) {
|
removeLadTable(identifier) {
|
||||||
let index = this.primaryTelemetryObjects.findIndex(primary => this.openmct.objects.makeKeyString(identifier) === primary.key),
|
let index = this.ladTableObjects.findIndex(ladTable => this.openmct.objects.makeKeyString(identifier) === ladTable.key);
|
||||||
primary = this.primaryTelemetryObjects[index];
|
let ladTable = this.ladTableObjects[index];
|
||||||
|
|
||||||
this.$delete(this.secondaryTelemetryObjects, primary.key);
|
this.$delete(this.ladTelemetryObjects, ladTable.key);
|
||||||
this.primaryTelemetryObjects.splice(index,1);
|
this.ladTableObjects.splice(index,1);
|
||||||
},
|
},
|
||||||
reorderPrimary(reorderPlan) {
|
reorderLadTables(reorderPlan) {
|
||||||
let oldComposition = this.primaryTelemetryObjects.slice();
|
let oldComposition = this.ladTableObjects.slice();
|
||||||
reorderPlan.forEach(reorderEvent => {
|
reorderPlan.forEach(reorderEvent => {
|
||||||
this.$set(this.primaryTelemetryObjects, reorderEvent.newIndex, oldComposition[reorderEvent.oldIndex]);
|
this.$set(this.ladTableObjects, reorderEvent.newIndex, oldComposition[reorderEvent.oldIndex]);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
addSecondary(primary) {
|
addTelemetryObject(ladTable) {
|
||||||
return (domainObject) => {
|
return (domainObject) => {
|
||||||
let secondary = {};
|
let telemetryObject = {};
|
||||||
secondary.key = this.openmct.objects.makeKeyString(domainObject.identifier);
|
telemetryObject.key = this.openmct.objects.makeKeyString(domainObject.identifier);
|
||||||
secondary.domainObject = domainObject;
|
telemetryObject.domainObject = domainObject;
|
||||||
|
|
||||||
let array = this.secondaryTelemetryObjects[primary.key];
|
let array = this.ladTelemetryObjects[ladTable.key];
|
||||||
array.push(secondary);
|
array.push(telemetryObject);
|
||||||
|
|
||||||
this.$set(this.secondaryTelemetryObjects, primary.key, array);
|
this.$set(this.ladTelemetryObjects, ladTable.key, array);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
removeSecondary(primary) {
|
removeTelemetryObject(ladTable) {
|
||||||
return (identifier) => {
|
return (identifier) => {
|
||||||
let array = this.secondaryTelemetryObjects[primary.key],
|
let telemetryObjects = this.ladTelemetryObjects[ladTable.key];
|
||||||
index = array.findIndex(secondary => this.openmct.objects.makeKeyString(identifier) === secondary.key);
|
let index = telemetryObjects.findIndex(telemetryObject => this.openmct.objects.makeKeyString(identifier) === telemetryObject.key);
|
||||||
|
|
||||||
array.splice(index, 1);
|
telemetryObjects.splice(index, 1);
|
||||||
|
|
||||||
this.$set(this.secondaryTelemetryObjects, primary.key, array);
|
this.$set(this.ladTelemetryObjects, ladTable.key, telemetryObjects);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user