mirror of
https://github.com/nasa/openmct.git
synced 2025-05-06 18:48:27 +00:00
[Fixed Position] Show telemetry values
Show telemetry values in cells in fixed position views. WTD-615.
This commit is contained in:
parent
2960d4cdc2
commit
ec211a067a
@ -35,7 +35,7 @@
|
|||||||
{
|
{
|
||||||
"key": "FixedController",
|
"key": "FixedController",
|
||||||
"implementation": "FixedController.js",
|
"implementation": "FixedController.js",
|
||||||
"depends": [ "$scope" ]
|
"depends": [ "$scope", "telemetrySubscriber", "telemetryFormatter" ]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"types": [
|
"types": [
|
||||||
|
@ -17,11 +17,13 @@ define(
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @param {Scope} $scope the controller's Angular scope
|
* @param {Scope} $scope the controller's Angular scope
|
||||||
*/
|
*/
|
||||||
function FixedController($scope) {
|
function FixedController($scope, telemetrySubscriber, telemetryFormatter) {
|
||||||
var gridSize = DEFAULT_GRID_SIZE,
|
var gridSize = DEFAULT_GRID_SIZE,
|
||||||
gridExtent = DEFAULT_GRID_EXTENT,
|
gridExtent = DEFAULT_GRID_EXTENT,
|
||||||
activeDrag,
|
activeDrag,
|
||||||
activeDragId,
|
activeDragId,
|
||||||
|
subscription,
|
||||||
|
values = {},
|
||||||
cellStyles = [],
|
cellStyles = [],
|
||||||
rawPositions = {},
|
rawPositions = {},
|
||||||
positions = {};
|
positions = {};
|
||||||
@ -105,9 +107,43 @@ define(
|
|||||||
ids.forEach(populatePosition);
|
ids.forEach(populatePosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateValue(telemetryObject) {
|
||||||
|
var id = telemetryObject && telemetryObject.getId();
|
||||||
|
if (id) {
|
||||||
|
values[id] = telemetryFormatter.formatRangeValue(
|
||||||
|
subscription.getRangeValue(telemetryObject)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update telemetry values based on new data available
|
||||||
|
function updateValues() {
|
||||||
|
if (subscription) {
|
||||||
|
subscription.getTelemetryObjects().forEach(updateValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Subscribe to telemetry updates for this domain object
|
||||||
|
function subscribe(domainObject) {
|
||||||
|
// Clear any old values
|
||||||
|
values = {};
|
||||||
|
|
||||||
|
// Release existing subscription (if any)
|
||||||
|
if (subscription) {
|
||||||
|
subscription.unsubscribe();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make a new subscription
|
||||||
|
subscription = domainObject &&
|
||||||
|
telemetrySubscriber.subscribe(domainObject, updateValues);
|
||||||
|
}
|
||||||
|
|
||||||
// Position panes when the model field changes
|
// Position panes when the model field changes
|
||||||
$scope.$watch("model", lookupPanels);
|
$scope.$watch("model", lookupPanels);
|
||||||
|
|
||||||
|
// Subscribe to telemetry when an object is available
|
||||||
|
$scope.$watch("domainObject", subscribe);
|
||||||
|
|
||||||
refreshCellStyles();
|
refreshCellStyles();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -120,6 +156,15 @@ define(
|
|||||||
getCellStyles: function () {
|
getCellStyles: function () {
|
||||||
return cellStyles;
|
return cellStyles;
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* Get the current data value for the specified domain object.
|
||||||
|
* @memberof FixedController#
|
||||||
|
* @param {string} id the domain object identifier
|
||||||
|
* @returns {string} the displayable data value
|
||||||
|
*/
|
||||||
|
getValue: function (id) {
|
||||||
|
return values[id];
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* Set the size of the viewable fixed position area.
|
* Set the size of the viewable fixed position area.
|
||||||
* @memberof FixedController#
|
* @memberof FixedController#
|
||||||
|
Loading…
x
Reference in New Issue
Block a user