diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-07-19 14:45:25 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-07-19 15:13:21 +0200 |
| commit | 54d07120191eb81de91a49cdebf619cfecce2666 (patch) | |
| tree | e85c5d9eeb638458a6c3abc4de0660ac1a1ff772 /opendc-web/opendc-web-ui/src/components/app/sidebars/topology/building | |
| parent | dc65123da856a09fe346ccd851cb4b78ad07ce5c (diff) | |
refactor(ui): Encode state in topology actions
This change updates the OpenDC frontend to reduce its reliance of global
state during the execution of actions. Actions that modify the topology
now require parameters to be passed via the action constructor instead
of relying on the global interactionLevel state.
Diffstat (limited to 'opendc-web/opendc-web-ui/src/components/app/sidebars/topology/building')
| -rw-r--r-- | opendc-web/opendc-web-ui/src/components/app/sidebars/topology/building/BuildingSidebar.js (renamed from opendc-web/opendc-web-ui/src/components/app/sidebars/topology/building/BuildingSidebarComponent.js) | 4 | ||||
| -rw-r--r-- | opendc-web/opendc-web-ui/src/components/app/sidebars/topology/building/NewRoomConstructionComponent.js | 2 | ||||
| -rw-r--r-- | opendc-web/opendc-web-ui/src/components/app/sidebars/topology/building/NewRoomConstructionContainer.js | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/opendc-web/opendc-web-ui/src/components/app/sidebars/topology/building/BuildingSidebarComponent.js b/opendc-web/opendc-web-ui/src/components/app/sidebars/topology/building/BuildingSidebar.js index 6c2556d3..5fcd46be 100644 --- a/opendc-web/opendc-web-ui/src/components/app/sidebars/topology/building/BuildingSidebarComponent.js +++ b/opendc-web/opendc-web-ui/src/components/app/sidebars/topology/building/BuildingSidebar.js @@ -1,8 +1,8 @@ import React from 'react' import NewRoomConstructionContainer from './NewRoomConstructionContainer' -const BuildingSidebarComponent = () => { +function BuildingSidebar() { return <NewRoomConstructionContainer /> } -export default BuildingSidebarComponent +export default BuildingSidebar diff --git a/opendc-web/opendc-web-ui/src/components/app/sidebars/topology/building/NewRoomConstructionComponent.js b/opendc-web/opendc-web-ui/src/components/app/sidebars/topology/building/NewRoomConstructionComponent.js index 656b2515..9fc85d0c 100644 --- a/opendc-web/opendc-web-ui/src/components/app/sidebars/topology/building/NewRoomConstructionComponent.js +++ b/opendc-web/opendc-web-ui/src/components/app/sidebars/topology/building/NewRoomConstructionComponent.js @@ -4,7 +4,7 @@ import { Button, Toolbar, ToolbarContent, ToolbarGroup, ToolbarItem } from '@pat import PlusIcon from '@patternfly/react-icons/dist/js/icons/plus-icon' import CheckIcon from '@patternfly/react-icons/dist/js/icons/check-icon' -const NewRoomConstructionComponent = ({ onStart, onFinish, onCancel, currentRoomInConstruction }) => { +function NewRoomConstructionComponent({ onStart, onFinish, onCancel, currentRoomInConstruction }) { if (currentRoomInConstruction === '-1') { return ( <Button isBlock icon={<PlusIcon />} onClick={onStart}> diff --git a/opendc-web/opendc-web-ui/src/components/app/sidebars/topology/building/NewRoomConstructionContainer.js b/opendc-web/opendc-web-ui/src/components/app/sidebars/topology/building/NewRoomConstructionContainer.js index 0836263c..5b031a6b 100644 --- a/opendc-web/opendc-web-ui/src/components/app/sidebars/topology/building/NewRoomConstructionContainer.js +++ b/opendc-web/opendc-web-ui/src/components/app/sidebars/topology/building/NewRoomConstructionContainer.js @@ -29,7 +29,7 @@ import { } from '../../../../../redux/actions/topology/building' import NewRoomConstructionComponent from './NewRoomConstructionComponent' -const NewRoomConstructionButton = (props) => { +function NewRoomConstructionButton(props) { const currentRoomInConstruction = useSelector((state) => state.construction.currentRoomInConstruction) const dispatch = useDispatch() |
