summaryrefslogtreecommitdiff
path: root/opendc-web/opendc-web-ui/src/redux
diff options
context:
space:
mode:
Diffstat (limited to 'opendc-web/opendc-web-ui/src/redux')
-rw-r--r--opendc-web/opendc-web-ui/src/redux/actions/topologies.js8
-rw-r--r--opendc-web/opendc-web-ui/src/redux/sagas/index.js4
-rw-r--r--opendc-web/opendc-web-ui/src/redux/sagas/objects.js4
-rw-r--r--opendc-web/opendc-web-ui/src/redux/sagas/topology.js28
4 files changed, 5 insertions, 39 deletions
diff --git a/opendc-web/opendc-web-ui/src/redux/actions/topologies.js b/opendc-web/opendc-web-ui/src/redux/actions/topologies.js
index abfded7e..e19a7f21 100644
--- a/opendc-web/opendc-web-ui/src/redux/actions/topologies.js
+++ b/opendc-web/opendc-web-ui/src/redux/actions/topologies.js
@@ -1,5 +1,4 @@
export const ADD_TOPOLOGY = 'ADD_TOPOLOGY'
-export const DELETE_TOPOLOGY = 'DELETE_TOPOLOGY'
export function addTopology(projectId, name, duplicateId) {
return {
@@ -9,10 +8,3 @@ export function addTopology(projectId, name, duplicateId) {
duplicateId,
}
}
-
-export function deleteTopology(id) {
- return {
- type: DELETE_TOPOLOGY,
- id,
- }
-}
diff --git a/opendc-web/opendc-web-ui/src/redux/sagas/index.js b/opendc-web/opendc-web-ui/src/redux/sagas/index.js
index 74d9efb6..318f0afb 100644
--- a/opendc-web/opendc-web-ui/src/redux/sagas/index.js
+++ b/opendc-web/opendc-web-ui/src/redux/sagas/index.js
@@ -21,13 +21,12 @@ import {
onDeleteRack,
onDeleteRoom,
onDeleteTile,
- onDeleteTopology,
onDeleteUnit,
onEditRackName,
onEditRoomName,
onStartNewRoomConstruction,
} from './topology'
-import { ADD_TOPOLOGY, DELETE_TOPOLOGY } from '../actions/topologies'
+import { ADD_TOPOLOGY } from '../actions/topologies'
import { onAddPrefab } from './prefabs'
import { ADD_PREFAB } from '../actions/prefabs'
@@ -35,7 +34,6 @@ export default function* rootSaga() {
yield takeEvery(OPEN_PROJECT_SUCCEEDED, onOpenProjectSucceeded)
yield takeEvery(ADD_TOPOLOGY, onAddTopology)
- yield takeEvery(DELETE_TOPOLOGY, onDeleteTopology)
yield takeEvery(START_NEW_ROOM_CONSTRUCTION, onStartNewRoomConstruction)
yield takeEvery(CANCEL_NEW_ROOM_CONSTRUCTION, onCancelNewRoomConstruction)
yield takeEvery(ADD_TILE, onAddTile)
diff --git a/opendc-web/opendc-web-ui/src/redux/sagas/objects.js b/opendc-web/opendc-web-ui/src/redux/sagas/objects.js
index 88f71fe4..99082df0 100644
--- a/opendc-web/opendc-web-ui/src/redux/sagas/objects.js
+++ b/opendc-web/opendc-web-ui/src/redux/sagas/objects.js
@@ -1,6 +1,6 @@
import { call, put, select, getContext } from 'redux-saga/effects'
import { addToStore } from '../actions/objects'
-import { getTopology, updateTopology } from '../../api/topologies'
+import { fetchTopology, updateTopology } from '../../api/topologies'
import { uuid } from 'uuidv4'
export const OBJECT_SELECTORS = {
@@ -32,7 +32,7 @@ export const fetchAndStoreTopology = function* (id) {
let topology = topologyStore[id]
if (!topology) {
- const fullTopology = yield call(getTopology, auth, id)
+ const fullTopology = yield call(fetchTopology, auth, id)
for (let roomIdx in fullTopology.rooms) {
const fullRoom = fullTopology.rooms[roomIdx]
diff --git a/opendc-web/opendc-web-ui/src/redux/sagas/topology.js b/opendc-web/opendc-web-ui/src/redux/sagas/topology.js
index efa125c6..0ed40131 100644
--- a/opendc-web/opendc-web-ui/src/redux/sagas/topology.js
+++ b/opendc-web/opendc-web-ui/src/redux/sagas/topology.js
@@ -18,16 +18,12 @@ import {
} from '../../components/app/map/MapConstants'
import { fetchAndStoreTopology, denormalizeTopology, updateTopologyOnServer } from './objects'
import { uuid } from 'uuidv4'
-import { addTopology, deleteTopology } from '../../api/topologies'
-import { fetchProject } from '../../api/projects'
+import { addTopology } from '../../api/topologies'
export function* fetchAndStoreAllTopologiesOfProject(projectId, setTopology = false) {
try {
- const auth = yield getContext('auth')
const queryClient = yield getContext('queryClient')
- const project = yield call(() =>
- queryClient.fetchQuery(['projects', projectId], () => fetchProject(auth, projectId))
- )
+ const project = yield call(() => queryClient.fetchQuery(['projects', projectId]))
for (let i in project.topologyIds) {
yield fetchAndStoreTopology(project.topologyIds[i])
@@ -62,26 +58,6 @@ export function* onAddTopology(action) {
}
}
-export function* onDeleteTopology(action) {
- try {
- const auth = yield getContext('auth')
- const queryClient = yield getContext('queryClient')
- const project = yield call(() =>
- queryClient.fetchQuery(['projects', action.projectId], () => fetchProject(auth, action.projectId))
- )
- const topologyIds = project?.topologyIds ?? []
-
- const currentTopologyId = yield select((state) => state.currentTopologyId)
- if (currentTopologyId === action.id) {
- yield put(setCurrentTopology(topologyIds.filter((t) => t !== action.id)[0]))
- }
-
- yield call(deleteTopology, auth, action.id)
- } catch (error) {
- console.error(error)
- }
-}
-
export function* onStartNewRoomConstruction() {
try {
const topologyId = yield select((state) => state.currentTopologyId)