Skip to content

Commit 5fbe78f

Browse files
Merge pull request #595 from MetaCell/feature/557
feature/557
2 parents fd62884 + d132d98 commit 5fbe78f

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

webapp/redux/middleware/middleware.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ export default (store) => (next) => (action) => {
212212
);
213213
}
214214

215-
const checkParametersThen = (callback, goToNetworkView = false) => {
215+
const checkParametersThen = (callback, goToNetworkView = false, waitingMessage = '') => {
216216
let allParams = true;
217217
const inDesignExp = store.getState().experiments?.inDesign;
218218

@@ -221,7 +221,7 @@ export default (store) => (next) => (action) => {
221221
.then((params) => {
222222
const flattened = Utils.flatten(params);
223223
const paramKeys = new Set(Object.keys(flattened));
224-
224+
225225
inDesignExp.params?.forEach((param) => {
226226
if (!paramKeys.has(param.mapsTo)) {
227227
pythonErrorCallback(
@@ -235,17 +235,17 @@ export default (store) => (next) => (action) => {
235235
});
236236
if (allParams) {
237237
callback().then((response => {
238-
next(openConfirmationDialog({title: "Experiment started", ...response}));
238+
next(openConfirmationDialog({title: "Experiment started", ...response}));
239239
getExperiments();
240240
})
241241
,pythonErrorCallback);
242242
}
243243
}, pythonErrorCallback);
244244
} else {
245-
next(GeppettoActions.waitData('Simulating the NetPyNE Model', GeppettoActions.layoutActions.SET_WIDGETS));
245+
next(GeppettoActions.waitData(waitingMessage, GeppettoActions.layoutActions.SET_WIDGETS));
246246
callback().then(toNetworkCallback(goToNetworkView), pythonErrorCallback)
247247
}
248-
248+
249249
}
250250

251251
switch (action.type) {
@@ -339,13 +339,12 @@ export default (store) => (next) => (action) => {
339339
break;
340340
}
341341
case CREATE_NETWORK: {
342-
next(GeppettoActions.waitData('Instantiating the NetPyNE Model', GeppettoActions.layoutActions.SET_WIDGETS));
343-
checkParametersThen(() => instantiateNetwork({}))
342+
checkParametersThen(() => instantiateNetwork({}), false, "Instantiating the NetPyNE Model")
343+
344344
break;
345345
}
346346
case CREATE_SIMULATE_NETWORK: {
347-
348-
checkParametersThen(() => simulateNetwork({ allTrials: false }))
347+
checkParametersThen(() => simulateNetwork({ allTrials: false }), false, "Instantiating and simulating the NetPyNE Model")
349348

350349
break;
351350
}
@@ -354,7 +353,7 @@ export default (store) => (next) => (action) => {
354353
next(GeppettoActions.activateWidget(EDIT_WIDGETS.experimentManager.id));
355354
}
356355

357-
checkParametersThen(() => simulateNetwork({ allTrials: action.payload, usePrevInst: (store.getState().general.modelState !== Constants.MODEL_STATE.NOT_INSTANTIATED) }))
356+
checkParametersThen(() => simulateNetwork({ allTrials: action.payload, usePrevInst: (store.getState().general.modelState !== Constants.MODEL_STATE.NOT_INSTANTIATED) }), false, "Simulating the NetPyNE Model")
358357
break;
359358
}
360359
case PYTHON_CALL: {

0 commit comments

Comments
 (0)