diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2023-03-30 22:58:30 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-30 22:58:30 +0100 |
| commit | 0db9d47d2b3062ca867e0a7aa33ba7205307d062 (patch) | |
| tree | 3d6fc9128dd9ff82434c8ad112a01d023791cba5 /opendc-web/opendc-web-ui/src/redux | |
| parent | 526d6cd6b48b30cf7bbe40478d57bbc67e7027cc (diff) | |
| parent | e7d5c086832a24f3c6b98258b0b8eb1fbbd3336a (diff) | |
merge: Address issues with web UI (#145)
This pull request addresses several issues that have been reported for the OpenDC web UI.
## Implementation Notes :hammer_and_pick:
* Update dependencies for web UI
* Inform user when deleted topology is still used
* Do not offset hover layer after dragging
* Fix access to machines on lower shelves
* Do not allow selection of empty unit
* Fix rack deletion
Fixes #135, #136, #137, #138, #139
Diffstat (limited to 'opendc-web/opendc-web-ui/src/redux')
3 files changed, 7 insertions, 8 deletions
diff --git a/opendc-web/opendc-web-ui/src/redux/actions/topology/room.js b/opendc-web/opendc-web-ui/src/redux/actions/topology/room.js index 350c1d92..14cc126c 100644 --- a/opendc-web/opendc-web-ui/src/redux/actions/topology/room.js +++ b/opendc-web/opendc-web-ui/src/redux/actions/topology/room.js @@ -53,10 +53,10 @@ export function addRackToTile(positionX, positionY) { if (tile !== null) { dispatch({ type: ADD_RACK_TO_TILE, + tileId: tile.id, rack: { id: uuid(), name: 'Rack', - tileId: tile.id, capacity: DEFAULT_RACK_SLOT_CAPACITY, powerCapacityW: DEFAULT_RACK_POWER_CAPACITY, machines: [], 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 |
