mirror of
https://github.com/nasa/openmct.git
synced 2025-02-22 18:12:57 +00:00
Merge branch 'master' into remove-action-tests
This commit is contained in:
commit
9ebb013f22
@ -41,6 +41,7 @@ define([
|
|||||||
{
|
{
|
||||||
key: "sin",
|
key: "sin",
|
||||||
name: "Sine",
|
name: "Sine",
|
||||||
|
unit: "Hz",
|
||||||
formatString: '%0.2f',
|
formatString: '%0.2f',
|
||||||
hints: {
|
hints: {
|
||||||
range: 1
|
range: 1
|
||||||
@ -49,6 +50,7 @@ define([
|
|||||||
{
|
{
|
||||||
key: "cos",
|
key: "cos",
|
||||||
name: "Cosine",
|
name: "Cosine",
|
||||||
|
unit: "deg",
|
||||||
formatString: '%0.2f',
|
formatString: '%0.2f',
|
||||||
hints: {
|
hints: {
|
||||||
range: 2
|
range: 2
|
||||||
|
@ -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();
|
||||||
@ -186,6 +201,9 @@ export default {
|
|||||||
|
|
||||||
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>
|
||||||
@ -54,6 +56,18 @@ export default {
|
|||||||
items: []
|
items: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
hasUnits() {
|
||||||
|
let itemsWithUnits = this.items.filter((item) => {
|
||||||
|
let metadata = this.openmct.telemetry.getMetadata(item.domainObject);
|
||||||
|
|
||||||
|
return this.metadataHasUnits(metadata.valueMetadatas);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
return itemsWithUnits.length !== 0;
|
||||||
|
}
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.composition = this.openmct.composition.get(this.domainObject);
|
this.composition = this.openmct.composition.get(this.domainObject);
|
||||||
this.composition.on('add', this.addItem);
|
this.composition.on('add', this.addItem);
|
||||||
@ -84,6 +98,11 @@ 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]);
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
metadataHasUnits(valueMetadatas) {
|
||||||
|
let metadataWithUnits = valueMetadatas.filter(metadatum => metadatum.unit);
|
||||||
|
|
||||||
|
return metadataWithUnits.length > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -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>
|
||||||
@ -66,6 +68,23 @@ export default {
|
|||||||
compositions: []
|
compositions: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
hasUnits() {
|
||||||
|
let ladTables = Object.values(this.secondaryTelemetryObjects);
|
||||||
|
for (let ladTable of ladTables) {
|
||||||
|
for (let telemetryObject of ladTable) {
|
||||||
|
let metadata = this.openmct.telemetry.getMetadata(telemetryObject.domainObject);
|
||||||
|
for (let metadatum of metadata.valueMetadatas) {
|
||||||
|
if (metadatum.unit) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
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.addPrimary);
|
||||||
@ -109,9 +128,8 @@ export default {
|
|||||||
let index = this.primaryTelemetryObjects.findIndex(primary => this.openmct.objects.makeKeyString(identifier) === primary.key),
|
let index = this.primaryTelemetryObjects.findIndex(primary => this.openmct.objects.makeKeyString(identifier) === primary.key),
|
||||||
primary = this.primaryTelemetryObjects[index];
|
primary = this.primaryTelemetryObjects[index];
|
||||||
|
|
||||||
this.$set(this.secondaryTelemetryObjects, primary.key, undefined);
|
this.$delete(this.secondaryTelemetryObjects, primary.key);
|
||||||
this.primaryTelemetryObjects.splice(index, 1);
|
this.primaryTelemetryObjects.splice(index, 1);
|
||||||
primary = undefined;
|
|
||||||
},
|
},
|
||||||
reorderPrimary(reorderPlan) {
|
reorderPrimary(reorderPlan) {
|
||||||
let oldComposition = this.primaryTelemetryObjects.slice();
|
let oldComposition = this.primaryTelemetryObjects.slice();
|
||||||
|
@ -134,6 +134,14 @@ define(['lodash'], function (_) {
|
|||||||
return `configuration.items[${selectionPath[0].context.index}]`;
|
return `configuration.items[${selectionPath[0].context.index}]`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getAllOfType(selection, specificType) {
|
||||||
|
return selection.filter(selectionPath => {
|
||||||
|
let type = selectionPath[0].context.layoutItem.type;
|
||||||
|
|
||||||
|
return type === specificType;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function getAllTypes(selection) {
|
function getAllTypes(selection) {
|
||||||
return selection.filter(selectionPath => {
|
return selection.filter(selectionPath => {
|
||||||
let type = selectionPath[0].context.layoutItem.type;
|
let type = selectionPath[0].context.layoutItem.type;
|
||||||
@ -510,6 +518,50 @@ define(['lodash'], function (_) {
|
|||||||
return allTelemetry;
|
return allTelemetry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getToggleUnitsButton(selectedParent, selection) {
|
||||||
|
let applicableItems = getAllOfType(selection, 'telemetry-view');
|
||||||
|
applicableItems = unitsOnly(applicableItems);
|
||||||
|
if (!applicableItems.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
control: "toggle-button",
|
||||||
|
domainObject: selectedParent,
|
||||||
|
applicableSelectedItems: applicableItems,
|
||||||
|
property: function (selectionPath) {
|
||||||
|
return getPath(selectionPath) + '.showUnits';
|
||||||
|
},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
value: true,
|
||||||
|
icon: 'icon-eye-open',
|
||||||
|
title: "Show units"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: false,
|
||||||
|
icon: 'icon-eye-disabled',
|
||||||
|
title: "Hide units"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function unitsOnly(items) {
|
||||||
|
let results = items.filter((item) => {
|
||||||
|
let currentItem = item[0];
|
||||||
|
let metadata = this.openmct.telemetry.getMetadata(currentItem.context.item);
|
||||||
|
let hasUnits = metadata
|
||||||
|
.valueMetadatas
|
||||||
|
.filter((metadatum) => metadatum.unit)
|
||||||
|
.length;
|
||||||
|
|
||||||
|
return hasUnits > 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
function getViewSwitcherMenu(selectedParent, selectionPath, selection) {
|
function getViewSwitcherMenu(selectedParent, selectionPath, selection) {
|
||||||
if (selection.length === 1) {
|
if (selection.length === 1) {
|
||||||
let displayLayoutContext = selectionPath[1].context,
|
let displayLayoutContext = selectionPath[1].context,
|
||||||
@ -594,6 +646,7 @@ define(['lodash'], function (_) {
|
|||||||
'text-style': [],
|
'text-style': [],
|
||||||
'position': [],
|
'position': [],
|
||||||
'duplicate': [],
|
'duplicate': [],
|
||||||
|
'unit-toggle': [],
|
||||||
'remove': []
|
'remove': []
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -663,6 +716,13 @@ define(['lodash'], function (_) {
|
|||||||
if (toolbar.viewSwitcher.length === 0) {
|
if (toolbar.viewSwitcher.length === 0) {
|
||||||
toolbar.viewSwitcher = [getViewSwitcherMenu(selectedParent, selectionPath, selectedObjects)];
|
toolbar.viewSwitcher = [getViewSwitcherMenu(selectedParent, selectionPath, selectedObjects)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (toolbar['unit-toggle'].length === 0) {
|
||||||
|
let toggleUnitsButton = getToggleUnitsButton(selectedParent, selectedObjects);
|
||||||
|
if (toggleUnitsButton) {
|
||||||
|
toolbar['unit-toggle'] = [toggleUnitsButton];
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (layoutItem.type === 'text-view') {
|
} else if (layoutItem.type === 'text-view') {
|
||||||
if (toolbar['text-style'].length === 0) {
|
if (toolbar['text-style'].length === 0) {
|
||||||
toolbar['text-style'] = [
|
toolbar['text-style'] = [
|
||||||
|
@ -58,6 +58,12 @@
|
|||||||
>
|
>
|
||||||
<div class="c-telemetry-view__value-text">
|
<div class="c-telemetry-view__value-text">
|
||||||
{{ telemetryValue }}
|
{{ telemetryValue }}
|
||||||
|
<span
|
||||||
|
v-if="unit && item.showUnits"
|
||||||
|
class="c-telemetry-view__value-text__unit"
|
||||||
|
>
|
||||||
|
{{ unit }}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -137,6 +143,12 @@ export default {
|
|||||||
|
|
||||||
return displayMode === 'all' || displayMode === 'value';
|
return displayMode === 'all' || displayMode === 'value';
|
||||||
},
|
},
|
||||||
|
unit() {
|
||||||
|
let value = this.item.value,
|
||||||
|
unit = this.metadata.value(value).unit;
|
||||||
|
|
||||||
|
return unit;
|
||||||
|
},
|
||||||
styleObject() {
|
styleObject() {
|
||||||
return Object.assign({}, {
|
return Object.assign({}, {
|
||||||
fontSize: this.item.size
|
fontSize: this.item.size
|
||||||
@ -257,7 +269,9 @@ export default {
|
|||||||
item: domainObject,
|
item: domainObject,
|
||||||
layoutItem: this.item,
|
layoutItem: this.item,
|
||||||
index: this.index,
|
index: this.index,
|
||||||
updateTelemetryFormat: this.updateTelemetryFormat
|
updateTelemetryFormat: this.updateTelemetryFormat,
|
||||||
|
toggleUnits: this.toggleUnits,
|
||||||
|
showUnits: this.showUnits
|
||||||
};
|
};
|
||||||
this.removeSelectable = this.openmct.selection.selectable(
|
this.removeSelectable = this.openmct.selection.selectable(
|
||||||
this.$el, this.context, this.immediatelySelect || this.initSelect);
|
this.$el, this.context, this.immediatelySelect || this.initSelect);
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
ng-style="{ 'background-color': series.get('color').asHexString() }">
|
ng-style="{ 'background-color': series.get('color').asHexString() }">
|
||||||
</span>
|
</span>
|
||||||
<span class="is-missing__indicator" title="This item is missing"></span>
|
<span class="is-missing__indicator" title="This item is missing"></span>
|
||||||
<span class="plot-series-name">{{ series.get('name') }}</span>
|
<span class="plot-series-name">{{ series.nameWithUnit() }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="plot-series-value hover-value-enabled value-to-display-{{ legend.get('valueToShowWhenCollapsed') }} {{ series.closest.mctLimitState.cssClass }}"
|
<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) }"
|
ng-class="{ 'cursor-hover': (legend.get('valueToShowWhenCollapsed').indexOf('nearest') != -1) }"
|
||||||
@ -79,6 +79,9 @@
|
|||||||
<th ng-if="legend.get('showValueWhenExpanded')">
|
<th ng-if="legend.get('showValueWhenExpanded')">
|
||||||
Value
|
Value
|
||||||
</th>
|
</th>
|
||||||
|
<th ng-if="legend.get('showUnitsWhenExpanded')">
|
||||||
|
Unit
|
||||||
|
</th>
|
||||||
<th ng-if="legend.get('showMinimumWhenExpanded')"
|
<th ng-if="legend.get('showMinimumWhenExpanded')"
|
||||||
class="mobile-hide">
|
class="mobile-hide">
|
||||||
Min
|
Min
|
||||||
@ -114,6 +117,11 @@
|
|||||||
{{ series.formatY(series.closest) }}
|
{{ series.formatY(series.closest) }}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
|
<td ng-if="legend.get('showUnitsWhenExpanded')">
|
||||||
|
<span class="plot-series-value cursor-hover hover-value-enabled">
|
||||||
|
{{ series.get('unit') }}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
<td ng-if="legend.get('showMinimumWhenExpanded')"
|
<td ng-if="legend.get('showMinimumWhenExpanded')"
|
||||||
class="mobile-hide">
|
class="mobile-hide">
|
||||||
<span class="plot-series-value">
|
<span class="plot-series-value">
|
||||||
|
@ -140,6 +140,7 @@
|
|||||||
<span ng-if="config.legend.get('showValueWhenExpanded')">Value</span>
|
<span ng-if="config.legend.get('showValueWhenExpanded')">Value</span>
|
||||||
<span ng-if="config.legend.get('showMinimumWhenExpanded')">Min</span>
|
<span ng-if="config.legend.get('showMinimumWhenExpanded')">Min</span>
|
||||||
<span ng-if="config.legend.get('showMaximumWhenExpanded')">Max</span>
|
<span ng-if="config.legend.get('showMaximumWhenExpanded')">Max</span>
|
||||||
|
<span ng-if="config.legend.get('showUnitsWhenExpanded')">Units</span>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -201,6 +201,7 @@
|
|||||||
<option value="nearestValue">Nearest value</option>
|
<option value="nearestValue">Nearest value</option>
|
||||||
<option value="min">Minimum value</option>
|
<option value="min">Minimum value</option>
|
||||||
<option value="max">Maximum value</option>
|
<option value="max">Maximum value</option>
|
||||||
|
<option value="units">showUnitsWhenExpanded</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
@ -217,6 +218,8 @@
|
|||||||
ng-model="form.showMinimumWhenExpanded"/> Minimum value</li>
|
ng-model="form.showMinimumWhenExpanded"/> Minimum value</li>
|
||||||
<li><input type="checkbox"
|
<li><input type="checkbox"
|
||||||
ng-model="form.showMaximumWhenExpanded"/> Maximum value</li>
|
ng-model="form.showMaximumWhenExpanded"/> Maximum value</li>
|
||||||
|
<li><input type="checkbox"
|
||||||
|
ng-model="form.showUnitsWhenExpanded"/> Units</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -53,7 +53,8 @@ define([
|
|||||||
showTimestampWhenExpanded: true,
|
showTimestampWhenExpanded: true,
|
||||||
showValueWhenExpanded: true,
|
showValueWhenExpanded: true,
|
||||||
showMaximumWhenExpanded: true,
|
showMaximumWhenExpanded: true,
|
||||||
showMinimumWhenExpanded: true
|
showMinimumWhenExpanded: true,
|
||||||
|
showUnitsWhenExpanded: true
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -102,6 +102,7 @@ define([
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
name: options.domainObject.name,
|
name: options.domainObject.name,
|
||||||
|
unit: range.unit,
|
||||||
xKey: options.collection.plot.xAxis.get('key'),
|
xKey: options.collection.plot.xAxis.get('key'),
|
||||||
yKey: range.key,
|
yKey: range.key,
|
||||||
markers: true,
|
markers: true,
|
||||||
@ -439,6 +440,11 @@ define([
|
|||||||
const markerSize = this.get('markerSize');
|
const markerSize = this.get('markerSize');
|
||||||
|
|
||||||
return `${markerShape}: ${markerSize}px`;
|
return `${markerShape}: ${markerSize}px`;
|
||||||
|
},
|
||||||
|
nameWithUnit: function () {
|
||||||
|
let unit = this.get('unit');
|
||||||
|
|
||||||
|
return this.get('name') + (unit ? ' ' + unit : '');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -65,6 +65,11 @@ define([
|
|||||||
modelProp: 'showMinimumWhenExpanded',
|
modelProp: 'showMinimumWhenExpanded',
|
||||||
coerce: Boolean,
|
coerce: Boolean,
|
||||||
objectPath: 'configuration.legend.showMinimumWhenExpanded'
|
objectPath: 'configuration.legend.showMinimumWhenExpanded'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
modelProp: 'showUnitsWhenExpanded',
|
||||||
|
coerce: Boolean,
|
||||||
|
objectPath: 'configuration.legend.showUnitsWhenExpanded'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
@ -27,6 +27,7 @@ define([
|
|||||||
'./collections/FilteredTableRowCollection',
|
'./collections/FilteredTableRowCollection',
|
||||||
'./TelemetryTableRow',
|
'./TelemetryTableRow',
|
||||||
'./TelemetryTableColumn',
|
'./TelemetryTableColumn',
|
||||||
|
'./TelemetryTableUnitColumn',
|
||||||
'./TelemetryTableConfiguration'
|
'./TelemetryTableConfiguration'
|
||||||
], function (
|
], function (
|
||||||
EventEmitter,
|
EventEmitter,
|
||||||
@ -35,6 +36,7 @@ define([
|
|||||||
FilteredTableRowCollection,
|
FilteredTableRowCollection,
|
||||||
TelemetryTableRow,
|
TelemetryTableRow,
|
||||||
TelemetryTableColumn,
|
TelemetryTableColumn,
|
||||||
|
TelemetryTableUnitColumn,
|
||||||
TelemetryTableConfiguration
|
TelemetryTableConfiguration
|
||||||
) {
|
) {
|
||||||
class TelemetryTable extends EventEmitter {
|
class TelemetryTable extends EventEmitter {
|
||||||
@ -210,10 +212,14 @@ define([
|
|||||||
|
|
||||||
addColumnsForObject(telemetryObject) {
|
addColumnsForObject(telemetryObject) {
|
||||||
let metadataValues = this.openmct.telemetry.getMetadata(telemetryObject).values();
|
let metadataValues = this.openmct.telemetry.getMetadata(telemetryObject).values();
|
||||||
|
|
||||||
metadataValues.forEach(metadatum => {
|
metadataValues.forEach(metadatum => {
|
||||||
let column = this.createColumn(metadatum);
|
let column = this.createColumn(metadatum);
|
||||||
this.configuration.addSingleColumnForObject(telemetryObject, column);
|
this.configuration.addSingleColumnForObject(telemetryObject, column);
|
||||||
|
// add units column if available
|
||||||
|
if (metadatum.unit !== undefined) {
|
||||||
|
let unitColumn = this.createUnitColumn(metadatum);
|
||||||
|
this.configuration.addSingleColumnForObject(telemetryObject, unitColumn);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,6 +227,10 @@ define([
|
|||||||
return new TelemetryTableColumn(this.openmct, metadatum);
|
return new TelemetryTableColumn(this.openmct, metadatum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
createUnitColumn(metadatum) {
|
||||||
|
return new TelemetryTableUnitColumn(this.openmct, metadatum);
|
||||||
|
}
|
||||||
|
|
||||||
subscribeTo(telemetryObject) {
|
subscribeTo(telemetryObject) {
|
||||||
let subscribeOptions = this.buildOptionsFromConfiguration(telemetryObject);
|
let subscribeOptions = this.buildOptionsFromConfiguration(telemetryObject);
|
||||||
let keyString = this.openmct.objects.makeKeyString(telemetryObject.identifier);
|
let keyString = this.openmct.objects.makeKeyString(telemetryObject.identifier);
|
||||||
|
@ -70,8 +70,10 @@ define([], function () {
|
|||||||
getCellLimitClasses() {
|
getCellLimitClasses() {
|
||||||
if (!this.cellLimitClasses) {
|
if (!this.cellLimitClasses) {
|
||||||
this.cellLimitClasses = Object.values(this.columns).reduce((alarmStateMap, column) => {
|
this.cellLimitClasses = Object.values(this.columns).reduce((alarmStateMap, column) => {
|
||||||
|
if (!column.isUnit) {
|
||||||
let limitEvaluation = this.limitEvaluator.evaluate(this.datum, column.getMetadatum());
|
let limitEvaluation = this.limitEvaluator.evaluate(this.datum, column.getMetadatum());
|
||||||
alarmStateMap[column.getKey()] = limitEvaluation && limitEvaluation.cssClass;
|
alarmStateMap[column.getKey()] = limitEvaluation && limitEvaluation.cssClass;
|
||||||
|
}
|
||||||
|
|
||||||
return alarmStateMap;
|
return alarmStateMap;
|
||||||
}, {});
|
}, {});
|
||||||
|
60
src/plugins/telemetryTable/TelemetryTableUnitColumn.js
Normal file
60
src/plugins/telemetryTable/TelemetryTableUnitColumn.js
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
define([
|
||||||
|
'./TelemetryTableColumn.js'
|
||||||
|
], function (
|
||||||
|
TelemetryTableColumn
|
||||||
|
) {
|
||||||
|
class TelemetryTableUnitColumn extends TelemetryTableColumn {
|
||||||
|
constructor(openmct, metadatum) {
|
||||||
|
super(openmct, metadatum);
|
||||||
|
this.isUnit = true;
|
||||||
|
this.titleValue += ' Unit';
|
||||||
|
this.formatter = {
|
||||||
|
format: (datum) => {
|
||||||
|
return this.metadatum.unit;
|
||||||
|
},
|
||||||
|
parse: (datum) => {
|
||||||
|
return this.metadatum.unit;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
getKey() {
|
||||||
|
return this.metadatum.key + '-unit';
|
||||||
|
}
|
||||||
|
|
||||||
|
getTitle() {
|
||||||
|
return this.metadatum.name + ' Unit';
|
||||||
|
}
|
||||||
|
|
||||||
|
getRawValue(telemetryDatum) {
|
||||||
|
return this.metadatum.unit;
|
||||||
|
}
|
||||||
|
|
||||||
|
getFormattedValue(telemetryDatum) {
|
||||||
|
return this.formatter.format(telemetryDatum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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'],
|
||||||
@ -131,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();
|
||||||
|
|
||||||
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() {
|
||||||
|
@ -135,7 +135,6 @@ export default {
|
|||||||
value = this.getFormValue(domainObject, toolbarItem);
|
value = this.getFormValue(domainObject, toolbarItem);
|
||||||
} else {
|
} else {
|
||||||
let values = [];
|
let values = [];
|
||||||
|
|
||||||
if (applicableSelectedItems) {
|
if (applicableSelectedItems) {
|
||||||
applicableSelectedItems.forEach(selectionPath => {
|
applicableSelectedItems.forEach(selectionPath => {
|
||||||
values.push(this.getPropertyValue(domainObject, toolbarItem, selectionPath));
|
values.push(this.getPropertyValue(domainObject, toolbarItem, selectionPath));
|
||||||
@ -207,7 +206,6 @@ export default {
|
|||||||
},
|
},
|
||||||
updateObjectValue(value, item) {
|
updateObjectValue(value, item) {
|
||||||
let changedItemId = this.openmct.objects.makeKeyString(item.domainObject.identifier);
|
let changedItemId = this.openmct.objects.makeKeyString(item.domainObject.identifier);
|
||||||
|
|
||||||
this.structure = this.structure.map(toolbarItem => {
|
this.structure = this.structure.map(toolbarItem => {
|
||||||
if (toolbarItem.domainObject) {
|
if (toolbarItem.domainObject) {
|
||||||
let id = this.openmct.objects.makeKeyString(toolbarItem.domainObject.identifier);
|
let id = this.openmct.objects.makeKeyString(toolbarItem.domainObject.identifier);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user