diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2023-03-26 22:16:29 +0100 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2023-03-27 20:37:40 +0100 |
| commit | e7d5c086832a24f3c6b98258b0b8eb1fbbd3336a (patch) | |
| tree | 3d6fc9128dd9ff82434c8ad112a01d023791cba5 /opendc-web/opendc-web-ui/src/redux/reducers/topology/tile.js | |
| parent | 42caec326fe5b6f4a0a2fe73e4cf2ba26ecba23d (diff) | |
bug(web): Fix rack deletion
This change fixes #139 which reports that racks cannot be deleted. This
was due to the tileId property being dropped in the backend for racks.
Instead, we use the tileId passed in the action directly.
Diffstat (limited to 'opendc-web/opendc-web-ui/src/redux/reducers/topology/tile.js')
| -rw-r--r-- | opendc-web/opendc-web-ui/src/redux/reducers/topology/tile.js | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/opendc-web/opendc-web-ui/src/redux/reducers/topology/tile.js b/opendc-web/opendc-web-ui/src/redux/reducers/topology/tile.js index 8e5ecd6e..24c0e20c 100644 --- a/opendc-web/opendc-web-ui/src/redux/reducers/topology/tile.js +++ b/opendc-web/opendc-web-ui/src/redux/reducers/topology/tile.js @@ -26,7 +26,7 @@ import { ADD_TILE, DELETE_TILE } from '../../actions/topology/building' import { DELETE_RACK } from '../../actions/topology/rack' import { ADD_RACK_TO_TILE } from '../../actions/topology/room' -function tile(state = {}, action, { racks }) { +function tile(state = {}, action) { switch (action.type) { case STORE_TOPOLOGY: return action.entities.tiles || {} @@ -42,14 +42,13 @@ function tile(state = {}, action, { racks }) { }) case ADD_RACK_TO_TILE: return produce(state, (draft) => { - const { rack } = action - draft[rack.tileId].rack = rack.id + const { rack, tileId } = action + draft[tileId].rack = rack.id }) case DELETE_RACK: return produce(state, (draft) => { - const { rackId } = action - const rack = racks[rackId] - draft[rack.tileId].rack = undefined + const { tileId } = action + draft[tileId].rack = undefined }) default: return state |
