summaryrefslogtreecommitdiff
path: root/opendc-web/opendc-web-ui/src/redux/sagas/topology.js
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-07-07 17:30:15 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2021-07-07 17:39:43 +0200
commit9c8a987556d0fb0cdf0eb67e0c191a8dcc5593b9 (patch)
tree617c184a6d2868aec6efc29f1c8dea1b19a00598 /opendc-web/opendc-web-ui/src/redux/sagas/topology.js
parentd28a2f194a75eb86095485ae4f88be349bcc18b6 (diff)
ui: Fetch scenarios and portfolios using React Query
Diffstat (limited to 'opendc-web/opendc-web-ui/src/redux/sagas/topology.js')
-rw-r--r--opendc-web/opendc-web-ui/src/redux/sagas/topology.js8
1 files changed, 4 insertions, 4 deletions
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 3f41e1d4..efa125c6 100644
--- a/opendc-web/opendc-web-ui/src/redux/sagas/topology.js
+++ b/opendc-web/opendc-web-ui/src/redux/sagas/topology.js
@@ -16,7 +16,7 @@ import {
DEFAULT_RACK_SLOT_CAPACITY,
MAX_NUM_UNITS_PER_MACHINE,
} from '../../components/app/map/MapConstants'
-import { fetchAndStoreTopology, getTopologyAsObject, updateTopologyOnServer } from './objects'
+import { fetchAndStoreTopology, denormalizeTopology, updateTopologyOnServer } from './objects'
import { uuid } from 'uuidv4'
import { addTopology, deleteTopology } from '../../api/topologies'
import { fetchProject } from '../../api/projects'
@@ -26,7 +26,7 @@ export function* fetchAndStoreAllTopologiesOfProject(projectId, setTopology = fa
const auth = yield getContext('auth')
const queryClient = yield getContext('queryClient')
const project = yield call(() =>
- queryClient.fetchQuery(`projects/${projectId}`, () => fetchProject(auth, projectId))
+ queryClient.fetchQuery(['projects', projectId], () => fetchProject(auth, projectId))
)
for (let i in project.topologyIds) {
@@ -47,7 +47,7 @@ export function* onAddTopology(action) {
let topologyToBeCreated
if (duplicateId) {
- topologyToBeCreated = yield getTopologyAsObject(duplicateId, false)
+ topologyToBeCreated = yield denormalizeTopology(duplicateId, false)
topologyToBeCreated = { ...topologyToBeCreated, name }
} else {
topologyToBeCreated = { name: action.name, rooms: [] }
@@ -67,7 +67,7 @@ export function* onDeleteTopology(action) {
const auth = yield getContext('auth')
const queryClient = yield getContext('queryClient')
const project = yield call(() =>
- queryClient.fetchQuery(`projects/${action.projectId}`, () => fetchProject(auth, action.projectId))
+ queryClient.fetchQuery(['projects', action.projectId], () => fetchProject(auth, action.projectId))
)
const topologyIds = project?.topologyIds ?? []