2020-09-04 07:43:27 +00:00
|
|
|
import Component from '@glimmer/component';
|
|
|
|
|
2020-09-24 01:10:11 +00:00
|
|
|
export default class TopoVizDatacenter extends Component {
|
2020-10-14 07:54:39 +00:00
|
|
|
get scheduledAllocations() {
|
|
|
|
return this.args.datacenter.nodes.reduce(
|
|
|
|
(all, node) => all.concat(node.allocations.filterBy('allocation.isScheduled')),
|
|
|
|
[]
|
|
|
|
);
|
|
|
|
}
|
2020-09-04 07:43:27 +00:00
|
|
|
|
|
|
|
get aggregatedAllocationResources() {
|
2020-09-24 01:10:11 +00:00
|
|
|
return this.scheduledAllocations.reduce(
|
2020-09-04 07:43:27 +00:00
|
|
|
(totals, allocation) => {
|
|
|
|
totals.cpu += allocation.cpu;
|
|
|
|
totals.memory += allocation.memory;
|
|
|
|
return totals;
|
|
|
|
},
|
|
|
|
{ cpu: 0, memory: 0 }
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-10-14 07:54:39 +00:00
|
|
|
get aggregatedNodeResources() {
|
|
|
|
return this.args.datacenter.nodes.reduce(
|
2020-09-04 07:43:27 +00:00
|
|
|
(totals, node) => {
|
|
|
|
totals.cpu += node.cpu;
|
|
|
|
totals.memory += node.memory;
|
|
|
|
return totals;
|
|
|
|
},
|
|
|
|
{ cpu: 0, memory: 0 }
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|