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

34 lines
816 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(
2021-12-28 16:08:12 +00:00
(all, node) =>
all.concat(node.allocations.filterBy('allocation.isScheduled')),
2020-10-14 07:54:39 +00:00
[]
);
}
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 }
);
}
}