open-nomad/ui/app/components/topo-viz/datacenter.js

33 lines
808 B
JavaScript
Raw Normal View History

import Component from '@glimmer/component';
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')),
[]
);
}
get aggregatedAllocationResources() {
return this.scheduledAllocations.reduce(
(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(
(totals, node) => {
totals.cpu += node.cpu;
totals.memory += node.memory;
return totals;
},
{ cpu: 0, memory: 0 }
);
}
}