[Timeline] Include utilization columns

This commit is contained in:
Victor Woeltjen 2016-05-25 10:52:25 -07:00
parent 0cc2ba7595
commit bb4f1ce7cd
2 changed files with 16 additions and 3 deletions

View File

@ -557,7 +557,8 @@ define([
{
"key": "comms",
"name": "Comms",
"units": "Kbps"
"units": "Kbps",
"foo": "Kb"
},
{
"key": "battery",

View File

@ -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') ?