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/rack/DeleteRackContainer.js | |
| 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/rack/DeleteRackContainer.js')
| -rw-r--r-- | opendc-web/opendc-web-ui/src/components/app/sidebars/topology/rack/DeleteRackContainer.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/opendc-web/opendc-web-ui/src/components/app/sidebars/topology/rack/DeleteRackContainer.js b/opendc-web/opendc-web-ui/src/components/app/sidebars/topology/rack/DeleteRackContainer.js index 47959f03..f0dc7b6b 100644 --- a/opendc-web/opendc-web-ui/src/components/app/sidebars/topology/rack/DeleteRackContainer.js +++ b/opendc-web/opendc-web-ui/src/components/app/sidebars/topology/rack/DeleteRackContainer.js @@ -20,6 +20,7 @@ * SOFTWARE. */ +import PropTypes from 'prop-types' import React, { useState } from 'react' import { useDispatch } from 'react-redux' import ConfirmationModal from '../../../../../components/modals/ConfirmationModal' @@ -27,12 +28,12 @@ import { deleteRack } from '../../../../../redux/actions/topology/rack' import TrashIcon from '@patternfly/react-icons/dist/js/icons/trash-icon' import { Button } from '@patternfly/react-core' -const DeleteRackContainer = () => { +function DeleteRackContainer({ tileId }) { const dispatch = useDispatch() const [isVisible, setVisible] = useState(false) const callback = (isConfirmed) => { if (isConfirmed) { - dispatch(deleteRack()) + dispatch(deleteRack(tileId)) } setVisible(false) } @@ -51,4 +52,8 @@ const DeleteRackContainer = () => { ) } +DeleteRackContainer.propTypes = { + tileId: PropTypes.string.isRequired, +} + export default DeleteRackContainer |
