diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-07-16 17:37:01 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-07-16 17:37:01 +0200 |
| commit | f2aeecccc096728d3df955b71e711c8d9c429427 (patch) | |
| tree | 14494ef902f054a38f93af29976be81f8d5dba75 /opendc-web/opendc-web-ui/src/components/app/map/RackSpaceFillContainer.js | |
| parent | e5caf6c6122684e441d1d73e2e0507fdd36c67e0 (diff) | |
refactor(ui): Isolate world coordinate space
This change updates the topology view in the OpenDC frontend to isolate
the world coordinate space. This means that zooming and panning should
not affect the coordinates in world space (but only in camera space). In
turn, this allows us to remove the dependency on Redux for the camera
controls.
Diffstat (limited to 'opendc-web/opendc-web-ui/src/components/app/map/RackSpaceFillContainer.js')
| -rw-r--r-- | opendc-web/opendc-web-ui/src/components/app/map/RackSpaceFillContainer.js | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/opendc-web/opendc-web-ui/src/components/app/map/RackSpaceFillContainer.js b/opendc-web/opendc-web-ui/src/components/app/map/RackSpaceFillContainer.js index 6791120e..7ca5c930 100644 --- a/opendc-web/opendc-web-ui/src/components/app/map/RackSpaceFillContainer.js +++ b/opendc-web/opendc-web-ui/src/components/app/map/RackSpaceFillContainer.js @@ -25,15 +25,9 @@ import PropTypes from 'prop-types' import { useSelector } from 'react-redux' import RackFillBar from '../../../components/app/map/elements/RackFillBar' -const RackSpaceFillContainer = (props) => { - const state = useSelector((state) => { - const machineIds = state.objects.rack[state.objects.tile[props.tileId].rack].machines - return { - type: 'space', - fillFraction: machineIds.filter((id) => id !== null).length / machineIds.length, - } - }) - return <RackFillBar {...props} {...state} /> +function RackSpaceFillContainer({ tileId, ...props }) { + const rack = useSelector((state) => state.objects.rack[state.objects.tile[tileId].rack]) + return <RackFillBar {...props} type="space" fillFraction={rack.machines.length / rack.capacity} /> } RackSpaceFillContainer.propTypes = { |
