diff options
| author | jc0b <j@jc0b.computer> | 2020-07-07 16:55:22 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2020-08-24 19:47:51 +0200 |
| commit | 223e916997eb641a1662110b6de630a4cdfdf479 (patch) | |
| tree | 90ca4364461f676db45f25e03d8f22fc32f9fdd8 /frontend/src/sagas/objects.js | |
| parent | 9ff1e3c6bae253372a468dbdc9b8369ab8dd2c6f (diff) | |
| parent | b810c4413079bf5aeb5374f1cd20e151a83530d0 (diff) | |
Merge branch 'feature/mongodb-migration' of github.com:atlarge-research/opendc-dev into feature/mongodb-migration
Diffstat (limited to 'frontend/src/sagas/objects.js')
| -rw-r--r-- | frontend/src/sagas/objects.js | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/frontend/src/sagas/objects.js b/frontend/src/sagas/objects.js index 1a31c195..8a12bd13 100644 --- a/frontend/src/sagas/objects.js +++ b/frontend/src/sagas/objects.js @@ -1,14 +1,14 @@ import { call, put, select } from 'redux-saga/effects' import { addToStore } from '../actions/objects' import { getAllSchedulers } from '../api/routes/schedulers' -import { getSimulation } from '../api/routes/simulations' +import { getProject } from '../api/routes/projects' import { getAllTraces } from '../api/routes/traces' import { getUser } from '../api/routes/users' import { getTopology, updateTopology } from '../api/routes/topologies' import { uuid } from 'uuidv4' export const OBJECT_SELECTORS = { - simulation: (state) => state.objects.simulation, + project: (state) => state.objects.project, user: (state) => state.objects.user, authorization: (state) => state.objects.authorization, cpu: (state) => state.objects.cpu, @@ -40,7 +40,7 @@ function* fetchAndStoreObjects(objectType, apiCall) { return objects } -export const fetchAndStoreSimulation = (id) => fetchAndStoreObject('simulation', id, call(getSimulation, id)) +export const fetchAndStoreProject = (id) => fetchAndStoreObject('project', id, call(getProject, id)) export const fetchAndStoreUser = (id) => fetchAndStoreObject('user', id, call(getUser, id)) @@ -94,7 +94,7 @@ export const fetchAndStoreTopology = function* (id) { const filledSlots = new Array(fullRack.capacity).fill(null) fullRack.machines.forEach( - (machine) => (filledSlots[machine.position - 1] = machine._id) + (machine) => (filledSlots[machine.position - 1] = machine._id), ) let rack = (({ _id, name, capacity, powerCapacityW }) => ({ _id, @@ -163,21 +163,21 @@ export const updateTopologyOnServer = function* (id) { rack: !tileStore[tileId].rackId ? undefined : { - _id: rackStore[tileStore[tileId].rackId]._id, - name: rackStore[tileStore[tileId].rackId].name, - capacity: rackStore[tileStore[tileId].rackId].capacity, - powerCapacityW: rackStore[tileStore[tileId].rackId].powerCapacityW, - machines: rackStore[tileStore[tileId].rackId].machineIds - .filter((m) => m !== null) - .map((machineId) => ({ - _id: machineId, - position: machineStore[machineId].position, - cpus: machineStore[machineId].cpuIds.map((id) => cpuStore[id]), - gpus: machineStore[machineId].gpuIds.map((id) => gpuStore[id]), - memories: machineStore[machineId].memoryIds.map((id) => memoryStore[id]), - storages: machineStore[machineId].storageIds.map((id) => storageStore[id]), - })), - }, + _id: rackStore[tileStore[tileId].rackId]._id, + name: rackStore[tileStore[tileId].rackId].name, + capacity: rackStore[tileStore[tileId].rackId].capacity, + powerCapacityW: rackStore[tileStore[tileId].rackId].powerCapacityW, + machines: rackStore[tileStore[tileId].rackId].machineIds + .filter((m) => m !== null) + .map((machineId) => ({ + _id: machineId, + position: machineStore[machineId].position, + cpus: machineStore[machineId].cpuIds.map((id) => cpuStore[id]), + gpus: machineStore[machineId].gpuIds.map((id) => gpuStore[id]), + memories: machineStore[machineId].memoryIds.map((id) => memoryStore[id]), + storages: machineStore[machineId].storageIds.map((id) => storageStore[id]), + })), + }, })), })), } |
