From a1d95b3685cffb6a9344d0d1e5505dd391193f16 Mon Sep 17 00:00:00 2001 From: Georgios Andreadis Date: Fri, 15 Sep 2017 12:53:26 +0200 Subject: Implement experiment list and add --- src/sagas/experiments.js | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) (limited to 'src/sagas/experiments.js') diff --git a/src/sagas/experiments.js b/src/sagas/experiments.js index 0ac919f4..2c5395e8 100644 --- a/src/sagas/experiments.js +++ b/src/sagas/experiments.js @@ -2,13 +2,7 @@ import {call, put, select} from "redux-saga/effects"; import {addPropToStoreObject, addToStore} from "../actions/objects"; import {deleteExperiment} from "../api/routes/experiments"; import {addExperiment, getExperimentsOfSimulation} from "../api/routes/simulations"; -import { - fetchAndStoreAllJobs, - fetchAndStoreAllSchedulers, - fetchAndStoreAllTasks, - fetchAndStoreAllTraces, - fetchAndStorePathsOfSimulation -} from "./objects"; +import {fetchAndStoreAllSchedulers, fetchAndStoreAllTraces, fetchAndStorePathsOfSimulation} from "./objects"; export function* onFetchExperimentsOfSimulation() { try { @@ -22,21 +16,18 @@ export function* onFetchExperimentsOfSimulation() { yield put(addPropToStoreObject("simulation", currentSimulationId, {experimentIds: experiments.map(experiment => experiment.id)})); } catch (error) { - console.log(error); + console.error(error); } } function* fetchExperimentSpecifications() { try { const currentSimulationId = yield select(state => state.currentSimulationId); - yield fetchAndStorePathsOfSimulation(currentSimulationId); - yield fetchAndStoreAllTasks(); - yield fetchAndStoreAllJobs(); yield fetchAndStoreAllTraces(); yield fetchAndStoreAllSchedulers(); } catch (error) { - console.log(error); + console.error(error); } } @@ -44,17 +35,20 @@ export function* onAddExperiment(action) { try { const currentSimulationId = yield select(state => state.currentSimulationId); - const experiment = yield call(addExperiment, currentSimulationId, Object.assign({}, action.experiment, { - id: -1, - simulationId: currentSimulationId - })); + const experiment = yield call(addExperiment, + currentSimulationId, + Object.assign({}, action.experiment, { + id: -1, + simulationId: currentSimulationId + }) + ); yield put(addToStore("experiment", experiment)); - const experimentIds = yield select(state => state.objects.simulation[currentSimulationId]); + const experimentIds = (yield select(state => state.objects.simulation[currentSimulationId])).experimentIds; yield put(addPropToStoreObject("simulation", currentSimulationId, {experimentIds: experimentIds.concat([experiment.id])})); } catch (error) { - console.log(error); + console.error(error); } } @@ -68,6 +62,6 @@ export function* onDeleteExperiment(action) { yield put(addPropToStoreObject("simulation", currentSimulationId, {experimentIds: experimentIds.filter(id => id !== action.id)})); } catch (error) { - console.log(error); + console.error(error); } } -- cgit v1.2.3