summaryrefslogtreecommitdiff
path: root/opendc-web/opendc-web-ui/src/components/topologies/map/RackSpaceFillContainer.js
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2022-09-20 22:10:01 +0200
committerGitHub <noreply@github.com>2022-09-20 22:10:01 +0200
commitf7ba5cd9bbf1f4d145c3d3d171c2632d44b5f94a (patch)
tree855256f27ded3cf0ec662119dbf26c3b138a8f5b /opendc-web/opendc-web-ui/src/components/topologies/map/RackSpaceFillContainer.js
parent48d43a83f675db8f5f13755081e56b3cde1a7207 (diff)
parent86bc9e74630374853d11bc1c8f7ba5ffafbaa868 (diff)
merge: Improve web interface (#100)
This pull request addresses several issues with the current web interface. ## Implementation Notes :hammer_and_pick: * Update dependencies of web UI where possible * Fix deletion of topology * Fix duplication of topology * Only display selected metrics * Use correct color for login button * Fix z-index of context selector * Move project selector into masthead * Reduce height of application header * Redesign projects page * Use PatternFly Charts for plots * Do not fail on stale Redux state * Fix overflow of topology sidebar * Fix deletion of portfolios * Migrate to composable table ## External Dependencies :four_leaf_clover: * `classnames` has been replaced by `clsx` * PatternFly Charts have replaced the use of `recharts`
Diffstat (limited to 'opendc-web/opendc-web-ui/src/components/topologies/map/RackSpaceFillContainer.js')
-rw-r--r--opendc-web/opendc-web-ui/src/components/topologies/map/RackSpaceFillContainer.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/opendc-web/opendc-web-ui/src/components/topologies/map/RackSpaceFillContainer.js b/opendc-web/opendc-web-ui/src/components/topologies/map/RackSpaceFillContainer.js
index 0c15d54b..2039a9d3 100644
--- a/opendc-web/opendc-web-ui/src/components/topologies/map/RackSpaceFillContainer.js
+++ b/opendc-web/opendc-web-ui/src/components/topologies/map/RackSpaceFillContainer.js
@@ -25,13 +25,18 @@ import PropTypes from 'prop-types'
import { useSelector } from 'react-redux'
import RackFillBar from './elements/RackFillBar'
-function RackSpaceFillContainer({ tileId, ...props }) {
- const rack = useSelector((state) => state.topology.racks[state.topology.tiles[tileId].rack])
+function RackSpaceFillContainer({ rackId, ...props }) {
+ const rack = useSelector((state) => state.topology.racks[rackId])
+
+ if (!rack) {
+ return null
+ }
+
return <RackFillBar {...props} type="space" fillFraction={rack.machines.length / rack.capacity} />
}
RackSpaceFillContainer.propTypes = {
- tileId: PropTypes.string.isRequired,
+ rackId: PropTypes.string.isRequired,
}
export default RackSpaceFillContainer