mirror of
https://github.com/nasa/openmct.git
synced 2024-12-23 23:12:23 +00:00
[Timeline] Include utilization columns
This commit is contained in:
parent
0cc2ba7595
commit
bb4f1ce7cd
@ -557,7 +557,8 @@ define([
|
||||
{
|
||||
"key": "comms",
|
||||
"name": "Comms",
|
||||
"units": "Kbps"
|
||||
"units": "Kbps",
|
||||
"foo": "Kb"
|
||||
},
|
||||
{
|
||||
"key": "battery",
|
||||
|
@ -41,11 +41,23 @@ define([], function () {
|
||||
UtilizationColumn.prototype.value = function (domainObject) {
|
||||
var resource = this.resource;
|
||||
|
||||
function getCost(utilization) {
|
||||
var seconds = (utilization.end - utilization.start) / 1000;
|
||||
return seconds * utilization.value;
|
||||
}
|
||||
|
||||
function getUtilizationValue(utilizations) {
|
||||
utilizations = utilizations.filter(function (utilization) {
|
||||
return key === resource.key;
|
||||
return utilization.key === resource.key;
|
||||
});
|
||||
return utilizations.length === 1 ? utilizations[0].value : "";
|
||||
|
||||
if (utilizations.length === 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return utilizations.map(getCost).reduce(function (a, b) {
|
||||
return a + b;
|
||||
}, 0);
|
||||
}
|
||||
|
||||
return !domainObject.hasCapability('utilization') ?
|
||||
|
Loading…
Reference in New Issue
Block a user