Derive allocation Resources property from TaskResources
This commit is contained in:
parent
edd904c1c4
commit
0f2fd905d8
|
@ -18,5 +18,14 @@ export default ApplicationSerializer.extend({
|
|||
|
||||
function serializeAllocation(allocation) {
|
||||
allocation.TaskStates = allocation.TaskStates.reduce(arrToObj('Name'), {});
|
||||
allocation.Resources = allocation.TaskResources.mapBy('Resources').reduce(
|
||||
(hash, resources) => {
|
||||
['CPU', 'DiskMB', 'IOPS', 'MemoryMB'].forEach(key => (hash[key] += resources[key]));
|
||||
hash.Networks = resources.Networks;
|
||||
hash.Ports = resources.Ports;
|
||||
return hash;
|
||||
},
|
||||
{ CPU: 0, DiskMB: 0, IOPS: 0, MemoryMB: 0 }
|
||||
);
|
||||
allocation.TaskResources = allocation.TaskResources.reduce(arrToObj('Name', 'Resources'), {});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue