mirror of
https://github.com/nasa/openmct.git
synced 2025-02-21 09:52:04 +00:00
pr edits
This commit is contained in:
parent
d2b9a7754f
commit
68eb5e6286
@ -53,8 +53,17 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
items: [],
|
||||
hasUnits: false
|
||||
items: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
hasUnits() {
|
||||
let itemsWithUnits = this.items.filter((item) => {
|
||||
let metadata = this.openmct.telemetry.getMetadata(item.domainObject);
|
||||
return this.metadataHasUnits(metadata.valueMetadatas);
|
||||
|
||||
}).length;
|
||||
return itemsWithUnits !== 0;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@ -76,13 +85,13 @@ export default {
|
||||
item.key = this.openmct.objects.makeKeyString(domainObject.identifier);
|
||||
|
||||
this.items.push(item);
|
||||
this.checkForUnits();
|
||||
// this.checkForUnits();
|
||||
},
|
||||
removeItem(identifier) {
|
||||
let index = this.items.findIndex(item => this.openmct.objects.makeKeyString(identifier) === item.key);
|
||||
|
||||
this.items.splice(index, 1);
|
||||
this.checkForUnits();
|
||||
// this.checkForUnits();
|
||||
},
|
||||
reorder(reorderPlan) {
|
||||
let oldItems = this.items.slice();
|
||||
@ -90,20 +99,10 @@ export default {
|
||||
this.$set(this.items, reorderEvent.newIndex, oldItems[reorderEvent.oldIndex]);
|
||||
});
|
||||
},
|
||||
checkForUnits() {
|
||||
let metadatas = [];
|
||||
let hasUnits = false;
|
||||
this.items.forEach((item) => {
|
||||
let metadata = this.openmct.telemetry.getMetadata(item.domainObject);
|
||||
metadatas = metadatas.concat(metadata.valueMetadatas);
|
||||
});
|
||||
for(let metadatum of metadatas) {
|
||||
if(metadatum.unit) {
|
||||
hasUnits = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.hasUnits = hasUnits;
|
||||
metadataHasUnits(valueMetadatas) {
|
||||
return valueMetadatas.filter((metadatum) => {
|
||||
return metadatum.unit;
|
||||
}).length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -142,11 +142,12 @@ export default {
|
||||
array.splice(index, 1);
|
||||
|
||||
this.$set(this.secondaryTelemetryObjects, primary.key, array);
|
||||
this.checkForUnits();
|
||||
if(this.hasUnits) {
|
||||
this.checkForUnits();
|
||||
}
|
||||
}
|
||||
},
|
||||
checkForUnits() {
|
||||
let hasUnits = false;
|
||||
for(let telemetryObject in this.secondaryTelemetryObjects) {
|
||||
if(this.secondaryTelemetryObjects[telemetryObject]) {
|
||||
let objects = this.secondaryTelemetryObjects[telemetryObject];
|
||||
@ -154,13 +155,14 @@ export default {
|
||||
let metadata = this.openmct.telemetry.getMetadata(current.domainObject);
|
||||
for(let metadatum of metadata.valueMetadatas) {
|
||||
if(metadatum.unit) {
|
||||
hasUnits = true;
|
||||
this.hasUnits = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.hasUnits = hasUnits;
|
||||
this.hasUnits = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@
|
||||
ng-style="{ 'background-color': series.get('color').asHexString() }">
|
||||
</span>
|
||||
<span class="is-missing__indicator" title="This item is missing"></span>
|
||||
<span class="plot-series-name">{{ series.get('name') + (series.get('unit') ? ' ' + series.get('unit') : '')}}</span>
|
||||
<span class="plot-series-name">{{ series.get('nameWithUnit') }}</span>
|
||||
</div>
|
||||
<div class="plot-series-value hover-value-enabled value-to-display-{{ legend.get('valueToShowWhenCollapsed') }} {{ series.closest.mctLimitState.cssClass }}"
|
||||
ng-class="{ 'cursor-hover': (legend.get('valueToShowWhenCollapsed').indexOf('nearest') != -1) }"
|
||||
|
@ -101,7 +101,8 @@ define([
|
||||
var range = this.metadata.valuesForHints(['range'])[0];
|
||||
return {
|
||||
name: options.domainObject.name,
|
||||
unit: range.unit || '',
|
||||
unit: range.unit,
|
||||
nameWithUnit: options.domainObject.name + (range.unit ? ' ' + range.unit : ''),
|
||||
xKey: options.collection.plot.xAxis.get('key'),
|
||||
yKey: range.key,
|
||||
markers: true,
|
||||
|
@ -225,43 +225,6 @@ define([
|
||||
|
||||
createUnitColumn(metadatum) {
|
||||
return new TelemetryTableUnitColumn(this.openmct, metadatum);
|
||||
// let unitColumn = {
|
||||
// isUnit: true,
|
||||
// metadatum,
|
||||
// titleValue: metadatum.name + ' Unit',
|
||||
// selectable: false,
|
||||
// formatter: {
|
||||
// format(telemetryDatum) {
|
||||
// return metadatum.unit;
|
||||
// },
|
||||
// parse(telemetryDatum) {
|
||||
// return metadatum.unit;
|
||||
// }
|
||||
// },
|
||||
// getKey() {
|
||||
// return this.metadatum.key + '-unit';
|
||||
// },
|
||||
// getTitle() {
|
||||
// return this.titleValue;
|
||||
// },
|
||||
// getMetadatum() {
|
||||
// return this.metadatum;
|
||||
// },
|
||||
// hasValueForDatum(telemetryDatum) {
|
||||
// return telemetryDatum.hasOwnProperty(this.metadatum.source);
|
||||
// },
|
||||
// getRawValue(telemetryDatum) {
|
||||
// return this.metadatum.unit;
|
||||
// },
|
||||
// getFormattedValue(telemetryDatum) {
|
||||
// return this.formatter.format(telemetryDatum);
|
||||
// },
|
||||
// getParsedValue(telemetryDatum) {
|
||||
// return this.formatter.parse(telemetryDatum);
|
||||
// }
|
||||
// };
|
||||
// return unitColumn;
|
||||
|
||||
}
|
||||
|
||||
subscribeTo(telemetryObject) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user