Skip to content

Commit 3b93ae1

Browse files
committed
Fix spinner message when creating/inst 3D models
Issue #557, when an 3D models are created/instantiated, the spinner message always displays: "Simulating..." The message now is dependent on the action that triggers the spinner.
1 parent cd42eaa commit 3b93ae1

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

webapp/redux/middleware/middleware.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ export default (store) => (next) => (action) => {
187187
switchLayoutAction(false, reset);
188188
getExperiments()
189189
next(action);
190-
190+
191191
};
192192

193193
const pythonErrorCallback = (error) => {
@@ -213,7 +213,7 @@ export default (store) => (next) => (action) => {
213213
);
214214
}
215215

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

@@ -222,7 +222,7 @@ export default (store) => (next) => (action) => {
222222
.then((params) => {
223223
const flattened = Utils.flatten(params);
224224
const paramKeys = new Set(Object.keys(flattened));
225-
225+
226226
inDesignExp.params?.forEach((param) => {
227227
if (!paramKeys.has(param.mapsTo)) {
228228
pythonErrorCallback(
@@ -236,17 +236,17 @@ export default (store) => (next) => (action) => {
236236
});
237237
if (allParams) {
238238
callback().then((response => {
239-
next(openConfirmationDialog({title: "Experiment started", ...response}));
239+
next(openConfirmationDialog({title: "Experiment started", ...response}));
240240
getExperiments();
241241
})
242242
,pythonErrorCallback);
243243
}
244244
}, pythonErrorCallback);
245245
} else {
246-
next(GeppettoActions.waitData('Simulating the NetPyNE Model', GeppettoActions.layoutActions.SET_WIDGETS));
246+
next(GeppettoActions.waitData(waitingMessage, GeppettoActions.layoutActions.SET_WIDGETS));
247247
callback().then(toNetworkCallback(goToNetworkView), pythonErrorCallback)
248248
}
249-
249+
250250
}
251251

252252
switch (action.type) {
@@ -342,14 +342,14 @@ export default (store) => (next) => (action) => {
342342
case CREATE_NETWORK: {
343343
next(GeppettoActions.waitData('Instantiating the NetPyNE Model', GeppettoActions.layoutActions.SET_WIDGETS));
344344

345-
checkParametersThen(() => instantiateNetwork({}))
345+
checkParametersThen(() => instantiateNetwork({}), false, "Creating the NetPyNE Model")
346346

347347

348348
break;
349349
}
350350
case CREATE_SIMULATE_NETWORK: {
351351

352-
checkParametersThen(() => simulateNetwork({ allTrials: false }))
352+
checkParametersThen(() => simulateNetwork({ allTrials: false }), false, "Creating and simulating the NetPyNE Model")
353353

354354
break;
355355
}
@@ -358,7 +358,7 @@ export default (store) => (next) => (action) => {
358358
next(GeppettoActions.activateWidget(EDIT_WIDGETS.experimentManager.id));
359359
}
360360

361-
checkParametersThen(() => simulateNetwork({ allTrials: action.payload, usePrevInst: (store.getState().general.modelState !== Constants.MODEL_STATE.NOT_INSTANTIATED) }))
361+
checkParametersThen(() => simulateNetwork({ allTrials: action.payload, usePrevInst: (store.getState().general.modelState !== Constants.MODEL_STATE.NOT_INSTANTIATED) }), false, "Simulating the NetPyNE Model")
362362
break;
363363
}
364364
case PYTHON_CALL: {

0 commit comments

Comments
 (0)