diff options
Diffstat (limited to 'opendc-web/opendc-web-ui/src/redux/reducers/topology')
| -rw-r--r-- | opendc-web/opendc-web-ui/src/redux/reducers/topology/index.js | 2 | ||||
| -rw-r--r-- | opendc-web/opendc-web-ui/src/redux/reducers/topology/tile.js | 11 |
2 files changed, 6 insertions, 7 deletions
diff --git a/opendc-web/opendc-web-ui/src/redux/reducers/topology/index.js b/opendc-web/opendc-web-ui/src/redux/reducers/topology/index.js index b1c7d29e..2c849387 100644 --- a/opendc-web/opendc-web-ui/src/redux/reducers/topology/index.js +++ b/opendc-web/opendc-web-ui/src/redux/reducers/topology/index.js @@ -35,7 +35,7 @@ function objects(state = {}, action) { storages: STORAGE_UNITS, machines: machine(state.machines, action, state), racks: rack(state.racks, action, state), - tiles: tile(state.tiles, action, state), + tiles: tile(state.tiles, action), rooms: room(state.rooms, action, state), root: topology(state.root, action, state), } 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 |
