summaryrefslogtreecommitdiff
path: root/opendc-web/opendc-web-ui/src/components/topologies/map/RackEnergyFillContainer.js
diff options
context:
space:
mode:
Diffstat (limited to 'opendc-web/opendc-web-ui/src/components/topologies/map/RackEnergyFillContainer.js')
-rw-r--r--opendc-web/opendc-web-ui/src/components/topologies/map/RackEnergyFillContainer.js36
1 files changed, 0 insertions, 36 deletions
diff --git a/opendc-web/opendc-web-ui/src/components/topologies/map/RackEnergyFillContainer.js b/opendc-web/opendc-web-ui/src/components/topologies/map/RackEnergyFillContainer.js
deleted file mode 100644
index a1ca7426..00000000
--- a/opendc-web/opendc-web-ui/src/components/topologies/map/RackEnergyFillContainer.js
+++ /dev/null
@@ -1,36 +0,0 @@
-import React from 'react'
-import PropTypes from 'prop-types'
-import { useSelector } from 'react-redux'
-import RackFillBar from './elements/RackFillBar'
-
-function RackSpaceFillContainer({ rackId, ...props }) {
- const fillFraction = useSelector((state) => {
- const rack = state.topology.racks[rackId]
- if (!rack) {
- return 0
- }
-
- const { machines, cpus, gpus, memories, storages } = state.topology
- let energyConsumptionTotal = 0
-
- for (const machineId of rack.machines) {
- if (!machineId) {
- continue
- }
- const machine = machines[machineId]
- machine.cpus.forEach((id) => (energyConsumptionTotal += cpus[id].energyConsumptionW))
- machine.gpus.forEach((id) => (energyConsumptionTotal += gpus[id].energyConsumptionW))
- machine.memories.forEach((id) => (energyConsumptionTotal += memories[id].energyConsumptionW))
- machine.storages.forEach((id) => (energyConsumptionTotal += storages[id].energyConsumptionW))
- }
-
- return Math.min(1, energyConsumptionTotal / rack.powerCapacityW)
- })
- return <RackFillBar {...props} type="energy" fillFraction={fillFraction} />
-}
-
-RackSpaceFillContainer.propTypes = {
- rackId: PropTypes.string.isRequired,
-}
-
-export default RackSpaceFillContainer