mirror of
https://github.com/nasa/openmct.git
synced 2025-06-21 08:39:59 +00:00
added unit column hiding in telemetry tables, added units to lad tables and sets
This commit is contained in:
@ -32,6 +32,12 @@
|
|||||||
class="js-third-data"
|
class="js-third-data"
|
||||||
:class="valueClass"
|
:class="valueClass"
|
||||||
>{{ value }}</td>
|
>{{ value }}</td>
|
||||||
|
<td
|
||||||
|
v-if="hasUnits"
|
||||||
|
class="js-units"
|
||||||
|
>
|
||||||
|
{{ unit }}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -48,6 +54,10 @@ export default {
|
|||||||
domainObject: {
|
domainObject: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true
|
required: true
|
||||||
|
},
|
||||||
|
hasUnits: {
|
||||||
|
type: Boolean,
|
||||||
|
requred: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@ -59,7 +69,8 @@ export default {
|
|||||||
timestamp: undefined,
|
timestamp: undefined,
|
||||||
value: '---',
|
value: '---',
|
||||||
valueClass: '',
|
valueClass: '',
|
||||||
currentObjectPath
|
currentObjectPath,
|
||||||
|
unit: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -101,6 +112,10 @@ export default {
|
|||||||
.subscribe(this.domainObject, this.updateValues);
|
.subscribe(this.domainObject, this.updateValues);
|
||||||
|
|
||||||
this.requestHistory();
|
this.requestHistory();
|
||||||
|
|
||||||
|
if(this.hasUnits) {
|
||||||
|
this.setUnit();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
destroyed() {
|
destroyed() {
|
||||||
this.stopWatchingMutation();
|
this.stopWatchingMutation();
|
||||||
@ -185,6 +200,9 @@ export default {
|
|||||||
console.warn(`No formatter for ${this.timestampKey} time system for ${this.domainObject.name}.`);
|
console.warn(`No formatter for ${this.timestampKey} time system for ${this.domainObject.name}.`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
setUnit() {
|
||||||
|
this.unit = this.valueMetadata.unit || '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Timestamp</th>
|
<th>Timestamp</th>
|
||||||
<th>Value</th>
|
<th>Value</th>
|
||||||
|
<th v-if="hasUnits">Unit</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -35,6 +36,7 @@
|
|||||||
v-for="item in items"
|
v-for="item in items"
|
||||||
:key="item.key"
|
:key="item.key"
|
||||||
:domain-object="item.domainObject"
|
:domain-object="item.domainObject"
|
||||||
|
:has-units="hasUnits"
|
||||||
/>
|
/>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -51,7 +53,8 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
items: []
|
items: [],
|
||||||
|
hasUnits: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@ -73,6 +76,9 @@ export default {
|
|||||||
item.key = this.openmct.objects.makeKeyString(domainObject.identifier);
|
item.key = this.openmct.objects.makeKeyString(domainObject.identifier);
|
||||||
|
|
||||||
this.items.push(item);
|
this.items.push(item);
|
||||||
|
if(!this.hasUnits) {
|
||||||
|
this.checkForUnits(domainObject);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
removeItem(identifier) {
|
removeItem(identifier) {
|
||||||
let index = this.items.findIndex(item => this.openmct.objects.makeKeyString(identifier) === item.key);
|
let index = this.items.findIndex(item => this.openmct.objects.makeKeyString(identifier) === item.key);
|
||||||
@ -84,6 +90,15 @@ export default {
|
|||||||
reorderPlan.forEach((reorderEvent) => {
|
reorderPlan.forEach((reorderEvent) => {
|
||||||
this.$set(this.items, reorderEvent.newIndex, oldItems[reorderEvent.oldIndex]);
|
this.$set(this.items, reorderEvent.newIndex, oldItems[reorderEvent.oldIndex]);
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
checkForUnits(domainObject) {
|
||||||
|
let metadata = this.openmct.telemetry.getMetadata(domainObject);
|
||||||
|
metadata.valueMetadatas.forEach((metadatum) => {
|
||||||
|
if(metadatum.unit) {
|
||||||
|
this.hasUnits = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Timestamp</th>
|
<th>Timestamp</th>
|
||||||
<th>Value</th>
|
<th>Value</th>
|
||||||
|
<th v-if="hasUnits">Unit</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -45,6 +46,7 @@
|
|||||||
v-for="secondary in secondaryTelemetryObjects[primary.key]"
|
v-for="secondary in secondaryTelemetryObjects[primary.key]"
|
||||||
:key="secondary.key"
|
:key="secondary.key"
|
||||||
:domain-object="secondary.domainObject"
|
:domain-object="secondary.domainObject"
|
||||||
|
:has-units="hasUnits"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -63,7 +65,8 @@ export default {
|
|||||||
return {
|
return {
|
||||||
primaryTelemetryObjects: [],
|
primaryTelemetryObjects: [],
|
||||||
secondaryTelemetryObjects: {},
|
secondaryTelemetryObjects: {},
|
||||||
compositions: []
|
compositions: [],
|
||||||
|
hasUnits: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@ -108,6 +111,7 @@ export default {
|
|||||||
this.$set(this.secondaryTelemetryObjects, primary.key, undefined);
|
this.$set(this.secondaryTelemetryObjects, primary.key, undefined);
|
||||||
this.primaryTelemetryObjects.splice(index,1);
|
this.primaryTelemetryObjects.splice(index,1);
|
||||||
primary = undefined;
|
primary = undefined;
|
||||||
|
this.checkForUnits();
|
||||||
},
|
},
|
||||||
reorderPrimary(reorderPlan) {
|
reorderPrimary(reorderPlan) {
|
||||||
let oldComposition = this.primaryTelemetryObjects.slice();
|
let oldComposition = this.primaryTelemetryObjects.slice();
|
||||||
@ -125,6 +129,9 @@ export default {
|
|||||||
array.push(secondary);
|
array.push(secondary);
|
||||||
|
|
||||||
this.$set(this.secondaryTelemetryObjects, primary.key, array);
|
this.$set(this.secondaryTelemetryObjects, primary.key, array);
|
||||||
|
if(!this.hasUnits) {
|
||||||
|
this.checkForUnits(domainObject);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
removeSecondary(primary) {
|
removeSecondary(primary) {
|
||||||
@ -135,7 +142,25 @@ export default {
|
|||||||
array.splice(index, 1);
|
array.splice(index, 1);
|
||||||
|
|
||||||
this.$set(this.secondaryTelemetryObjects, primary.key, array);
|
this.$set(this.secondaryTelemetryObjects, primary.key, array);
|
||||||
|
this.checkForUnits();
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
checkForUnits() {
|
||||||
|
let hasUnits = false;
|
||||||
|
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) {
|
||||||
|
hasUnits = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.hasUnits = hasUnits;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -521,7 +521,6 @@ define(['lodash'], function (_) {
|
|||||||
applicableSelectedItems: applicableItems,
|
applicableSelectedItems: applicableItems,
|
||||||
contextMethod: 'toggleUnits',
|
contextMethod: 'toggleUnits',
|
||||||
property: function (selectionPath) {
|
property: function (selectionPath) {
|
||||||
console.log('path', selectionPath, getPath(selectionPath) + '.showUnits');
|
|
||||||
return getPath(selectionPath) + '.showUnits';
|
return getPath(selectionPath) + '.showUnits';
|
||||||
},
|
},
|
||||||
options: [
|
options: [
|
||||||
|
@ -29,12 +29,12 @@ define([
|
|||||||
super(openmct, metadatum);
|
super(openmct, metadatum);
|
||||||
this.isUnit = true;
|
this.isUnit = true;
|
||||||
this.titleValue += ' Unit';
|
this.titleValue += ' Unit';
|
||||||
this.formatter = {
|
this.formatter = {
|
||||||
format(datum) {
|
format: (datum) => {
|
||||||
return metadatum.unit;
|
return this.metadatum.unit;
|
||||||
},
|
},
|
||||||
parse(datum) {
|
parse: (datum) => {
|
||||||
return metadatum.unit;
|
return this.metadatum.unit;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -54,10 +54,6 @@ define([
|
|||||||
getFormattedValue(telemetryDatum) {
|
getFormattedValue(telemetryDatum) {
|
||||||
return this.formatter.format(telemetryDatum);
|
return this.formatter.format(telemetryDatum);
|
||||||
}
|
}
|
||||||
|
|
||||||
getParsedValue(telemetryDatum) {
|
|
||||||
return this.formatter.parse(telemetryDatum);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return TelemetryTableUnitColumn;
|
return TelemetryTableUnitColumn;
|
||||||
|
@ -69,6 +69,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import TelemetryTableColumn from '../TelemetryTableColumn';
|
import TelemetryTableColumn from '../TelemetryTableColumn';
|
||||||
|
import TelemetryTableUnitColumn from '../TelemetryTableUnitColumn';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
inject: ['tableConfiguration', 'openmct'],
|
inject: ['tableConfiguration', 'openmct'],
|
||||||
@ -80,7 +81,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
console.log('table-config mounted');
|
|
||||||
this.unlisteners = [];
|
this.unlisteners = [];
|
||||||
this.openmct.editor.on('isEditing', this.toggleEdit);
|
this.openmct.editor.on('isEditing', this.toggleEdit);
|
||||||
let compositionCollection = this.openmct.composition.get(this.tableConfiguration.domainObject);
|
let compositionCollection = this.openmct.composition.get(this.tableConfiguration.domainObject);
|
||||||
@ -132,10 +132,14 @@ export default {
|
|||||||
},
|
},
|
||||||
addColumnsForObject(telemetryObject) {
|
addColumnsForObject(telemetryObject) {
|
||||||
let metadataValues = this.openmct.telemetry.getMetadata(telemetryObject).values();
|
let metadataValues = this.openmct.telemetry.getMetadata(telemetryObject).values();
|
||||||
console.log(metadataValues);
|
|
||||||
metadataValues.forEach(metadatum => {
|
metadataValues.forEach(metadatum => {
|
||||||
let column = new TelemetryTableColumn(this.openmct, metadatum);
|
let column = new TelemetryTableColumn(this.openmct, metadatum);
|
||||||
this.tableConfiguration.addSingleColumnForObject(telemetryObject, column);
|
this.tableConfiguration.addSingleColumnForObject(telemetryObject, column);
|
||||||
|
// if units are available, need to add columns to be hidden
|
||||||
|
if(metadatum.unit !== undefined) {
|
||||||
|
let unitColumn = new TelemetryTableUnitColumn(this.openmct, metadatum);
|
||||||
|
this.tableConfiguration.addSingleColumnForObject(telemetryObject, unitColumn);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
toggleHeaderVisibility() {
|
toggleHeaderVisibility() {
|
||||||
|
Reference in New Issue
Block a user