Skip to content

Commit d509957

Browse files
author
rodriguez-facundo
committed
Add redux (remove geppetto triggers)
1 parent 300f549 commit d509957

42 files changed

Lines changed: 352 additions & 153 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

webapp/Main.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,22 @@ jQuery(function () {
1616
var PythonConsole = require('geppetto-client/js/components/interface/pythonConsole/PythonConsole');
1717
var theme = require('./Theme').default
1818

19+
const Provider = require("react-redux").Provider;
20+
const configureStore = require('./redux/store').default;
21+
1922
require('./css/netpyne.less');
2023
require('./css/material.less');
2124
require('./css/traceback.less');
2225

26+
const store = configureStore();
27+
2328
function App (data = {}) {
2429
return (
2530
<div>
2631
<MuiThemeProvider theme={theme}>
27-
<NetPyNE {...data}></NetPyNE>
32+
<Provider store={store}>
33+
<NetPyNE {...data}></NetPyNE>
34+
</Provider>
2835
</MuiThemeProvider>
2936

3037
<div id="footer">

webapp/NetPyNE.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import React from 'react';
22
import Toolbar from '@material-ui/core/Toolbar';
33
import Transition from './components/transition/Transition';
4-
import NetPyNEPopulations from './components/definition/populations/NetPyNEPopulations';
4+
import PythonControlledNetPyNEPopulations from './redux/reduxconnect/NetPyNEPopulationsConnection';
55
import NetPyNECellRules from './components/definition/cellRules/NetPyNECellRules';
6-
import NetPyNESynapses from './components/definition/synapses/NetPyNESynapses';
6+
import PythonControlledNetPyNESynapses from './redux/reduxconnect/NetPyNESynapsesConnection';
77
import NetPyNEConnectivityRules from './components/definition/connectivity/NetPyNEConnectivityRules';
8-
import NetPyNEStimulationSources from './components/definition/stimulationSources/NetPyNEStimulationSources';
8+
import PythonControlledNetPyNEStimulationSources from './redux/reduxconnect/NetPyNEStimulationSourcesConnection';
99
import NetPyNEStimulationTargets from './components/definition/stimulationTargets/NetPyNEStimulationTargets';
1010
import NetPyNEPlots from './components/definition/plots/NetPyNEPlots';
1111
import NetPyNESimConfig from './components/definition/configuration/NetPyNESimConfig';
@@ -14,11 +14,11 @@ import NetPyNEToolBar from './components/settings/NetPyNEToolBar';
1414
import NetPyNETabs from './components/settings/NetPyNETabs';
1515

1616
var PythonControlledCapability = require('geppetto-client/js/communication/geppettoJupyter/PythonControlledCapability');
17-
var PythonControlledNetPyNEPopulations = PythonControlledCapability.createPythonControlledComponent(NetPyNEPopulations);
17+
1818
var PythonControlledNetPyNECellRules = PythonControlledCapability.createPythonControlledComponent(NetPyNECellRules);
19-
var PythonControlledNetPyNESynapses = PythonControlledCapability.createPythonControlledComponent(NetPyNESynapses);
19+
2020
var PythonControlledNetPyNEConnectivity = PythonControlledCapability.createPythonControlledComponent(NetPyNEConnectivityRules);
21-
var PythonControlledNetPyNEStimulationSources = PythonControlledCapability.createPythonControlledComponent(NetPyNEStimulationSources);
21+
2222
var PythonControlledNetPyNEStimulationTargets = PythonControlledCapability.createPythonControlledComponent(NetPyNEStimulationTargets);
2323
var PythonControlledNetPyNEPlots = PythonControlledCapability.createPythonControlledComponent(NetPyNEPlots);
2424

@@ -140,7 +140,7 @@ export default class NetPyNE extends React.Component {
140140
return <div></div>
141141
} else {
142142
if (this.state.value == 'define'){
143-
var content = <div>
143+
var content = <div style={{ marginBottom: "50px" }}>
144144
<PythonControlledNetPyNEPopulations model={"netParams.popParams"} />
145145
<PythonControlledNetPyNECellRules model={"netParams.cellParams"} />
146146
<PythonControlledNetPyNESynapses model={"netParams.synMechParams"} />

webapp/components/definition/cellRules/NetPyNECellRule.js

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import TextField from '@material-ui/core/TextField';
55
import Button from '@material-ui/core/Button';
66
import Utils from '../../../Utils';
77
import NetPyNEField from '../../general/NetPyNEField';
8-
import Select from '../../general/Select';
8+
99
import NetPyNECoordsRange from '../../general/NetPyNECoordsRange';
1010
import Dialog from '@material-ui/core/Dialog/Dialog';
1111

@@ -14,8 +14,7 @@ import DialogContent from '@material-ui/core/DialogContent';
1414
import DialogContentText from '@material-ui/core/DialogContentText';
1515
import DialogTitle from '@material-ui/core/DialogTitle';
1616

17-
var PythonControlledCapability = require('geppetto-client/js/communication/geppettoJupyter/PythonControlledCapability');
18-
var PythonMethodControlledSelectField = PythonControlledCapability.createPythonControlledControlWithPythonDataFetch(Select);
17+
import PythonMethodControlledSelectFieldConnection from '../../../redux/reduxconnect/PythonMethodControlledSelectFieldConnection'
1918

2019

2120
export default class NetPyNECellRule extends React.Component {
@@ -29,24 +28,6 @@ export default class NetPyNECellRule extends React.Component {
2928
};
3029
}
3130

32-
componentDidMount (){
33-
GEPPETTO.on('populations_change', () => {
34-
this.forceUpdate();
35-
})
36-
GEPPETTO.on('cellType_change', () => {
37-
this.forceUpdate();
38-
})
39-
GEPPETTO.on('cellModel_change', () => {
40-
this.forceUpdate();
41-
})
42-
}
43-
44-
componentWillUnmount (){
45-
GEPPETTO.off('populations_change')
46-
GEPPETTO.off('cellType_change')
47-
GEPPETTO.off('cellModel_change')
48-
}
49-
5031
handleRenameChange = event => {
5132
var storedValue = this.props.name;
5233
var newValue = Utils.nameValidation(event.target.value);
@@ -130,7 +111,7 @@ export default class NetPyNECellRule extends React.Component {
130111
</div>
131112

132113
<NetPyNEField id={"netParams.cellParams.conds.cellType"} >
133-
<PythonMethodControlledSelectField
114+
<PythonMethodControlledSelectFieldConnection
134115
model={"netParams.cellParams['" + this.state.currentName + "']['conds']['cellType']"}
135116
method={"netpyne_geppetto.getAvailableCellTypes"}
136117
postProcessItems={this.postProcessMenuItems}
@@ -139,7 +120,7 @@ export default class NetPyNECellRule extends React.Component {
139120
</NetPyNEField>
140121

141122
<NetPyNEField id={"netParams.cellParams.conds.cellModel"} >
142-
<PythonMethodControlledSelectField
123+
<PythonMethodControlledSelectFieldConnection
143124
model={"netParams.cellParams['" + this.state.currentName + "']['conds']['cellModel']"}
144125
method={"netpyne_geppetto.getAvailableCellModels"}
145126
postProcessItems={this.postProcessMenuItems}
@@ -148,7 +129,7 @@ export default class NetPyNECellRule extends React.Component {
148129
</NetPyNEField>
149130

150131
<NetPyNEField id={"netParams.cellParams.conds.pop"} >
151-
<PythonMethodControlledSelectField
132+
<PythonMethodControlledSelectFieldConnection
152133
model={"netParams.cellParams['" + this.state.currentName + "']['conds']['pop']"}
153134
method={"netpyne_geppetto.getAvailablePops"}
154135
postProcessItems={this.postProcessMenuItems}

webapp/components/definition/cellRules/NetPyNECellRules.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Card from '@material-ui/core/Card';
66
import CardHeader from '@material-ui/core/CardHeader';
77
import CardContent from '@material-ui/core/CardContent';
88
import Fab from '@material-ui/core/Fab';
9-
import NetPyNECellRule from './NetPyNECellRule';
9+
import NetPyNECellRuleConnection from '../../../redux/reduxconnect/NetPyNECellRuleConnection';
1010
import NetPyNEThumbnail from '../../general/NetPyNEThumbnail';
1111
import NetPyNESection from './sections/NetPyNESection';
1212
import NetPyNESectionThumbnail from './sections/NetPyNESectionThumbnail';
@@ -513,7 +513,7 @@ export default class NetPyNECellRules extends React.Component {
513513
if (page == 'main') {
514514
if ( selectedCellRule !== undefined && model && Object.keys(model).indexOf(selectedCellRule) > -1) {
515515
selection = (
516-
<NetPyNECellRule
516+
<NetPyNECellRuleConnection
517517
name={selectedCellRule}
518518
selectPage={this.selectPage}
519519
model={model[selectedCellRule]}

webapp/components/definition/connectivity/NetPyNEConnectivityRule.js

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import DialogContent from '@material-ui/core/DialogContent';
1818
import DialogContentText from '@material-ui/core/DialogContentText';
1919
import DialogTitle from '@material-ui/core/DialogTitle';
2020

21+
import PythonMethodControlledSelectFieldConnection from '../../../redux/reduxconnect/PythonMethodControlledSelectFieldConnection'
2122
var PythonControlledCapability = require('geppetto-client/js/communication/geppettoJupyter/PythonControlledCapability');
2223
var PythonControlledTextField = PythonControlledCapability.createPythonControlledControl(TextField);
2324
var PythonMethodControlledSelectField = PythonControlledCapability.createPythonControlledControlWithPythonDataFetch(Select);
@@ -36,24 +37,6 @@ export default class NetPyNEConnectivityRule extends React.Component {
3637
};
3738
}
3839

39-
componentDidMount (){
40-
GEPPETTO.on('populations_change', () => {
41-
this.forceUpdate();
42-
})
43-
GEPPETTO.on('cellType_change', () => {
44-
this.forceUpdate();
45-
})
46-
GEPPETTO.on('cellModel_change', () => {
47-
this.forceUpdate();
48-
})
49-
}
50-
51-
componentWillUnmount (){
52-
GEPPETTO.off('populations_change')
53-
GEPPETTO.off('cellType_change')
54-
GEPPETTO.off('cellModel_change')
55-
}
56-
5740
handleRenameChange = event => {
5841
var storedValue = this.props.name;
5942
var newValue = Utils.nameValidation(event.target.value);
@@ -156,7 +139,7 @@ export default class NetPyNEConnectivityRule extends React.Component {
156139
</NetPyNEField>
157140

158141
<NetPyNEField id={"netParams.connParams.synMech"} >
159-
<PythonMethodControlledSelectField
142+
<PythonMethodControlledSelectFieldConnection
160143
model={"netParams.connParams['" + this.props.name + "']['synMech']"}
161144
method={"netpyne_geppetto.getAvailableSynMech"}
162145
postProcessItems={(pythonData, selected) => pythonData.map(name => (
@@ -218,23 +201,23 @@ export default class NetPyNEConnectivityRule extends React.Component {
218201
} else if (this.state.sectionId == "Pre Conditions") {
219202
var content = <div>
220203
<NetPyNEField id={"netParams.connParams.preConds.pop"} >
221-
<PythonMethodControlledSelectField
204+
<PythonMethodControlledSelectFieldConnection
222205
model={"netParams.connParams['" + this.props.name + "']['preConds']['pop']"}
223206
method={"netpyne_geppetto.getAvailablePops"}
224207
postProcessItems={this.postProcessMenuItems}
225208
multiple
226209
/>
227210
</NetPyNEField>
228211
<NetPyNEField id={"netParams.connParams.preConds.cellModel"} >
229-
<PythonMethodControlledSelectField
212+
<PythonMethodControlledSelectFieldConnection
230213
model={"netParams.connParams['" + this.props.name + "']['preConds']['cellModel']"}
231214
method={"netpyne_geppetto.getAvailableCellModels"}
232215
postProcessItems={this.postProcessMenuItems}
233216
multiple
234217
/>
235218
</NetPyNEField>
236219
<NetPyNEField id={"netParams.connParams.preConds.cellType"} >
237-
<PythonMethodControlledSelectField
220+
<PythonMethodControlledSelectFieldConnection
238221
model={"netParams.connParams['" + this.props.name + "']['preConds']['cellType']"}
239222
method={"netpyne_geppetto.getAvailableCellTypes"}
240223
postProcessItems={this.postProcessMenuItems}
@@ -279,23 +262,23 @@ export default class NetPyNEConnectivityRule extends React.Component {
279262
} else if (this.state.sectionId == "Post Conditions") {
280263
var content = <div>
281264
<NetPyNEField id={"netParams.connParams.postConds.pop"} >
282-
<PythonMethodControlledSelectField
265+
<PythonMethodControlledSelectFieldConnection
283266
model={"netParams.connParams['" + this.props.name + "']['postConds']['pop']"}
284267
method={"netpyne_geppetto.getAvailablePops"}
285268
postProcessItems={this.postProcessMenuItems}
286269
multiple
287270
/>
288271
</NetPyNEField>
289272
<NetPyNEField id={"netParams.connParams.postConds.cellModel"} >
290-
<PythonMethodControlledSelectField
273+
<PythonMethodControlledSelectFieldConnection
291274
model={"netParams.connParams['" + this.props.name + "']['postConds']['cellModel']"}
292275
method={"netpyne_geppetto.getAvailableCellModels"}
293276
postProcessItems={this.postProcessMenuItems}
294277
multiple
295278
/>
296279
</NetPyNEField>
297280
<NetPyNEField id={"netParams.connParams.postConds.cellType"} >
298-
<PythonMethodControlledSelectField
281+
<PythonMethodControlledSelectFieldConnection
299282
model={"netParams.connParams['" + this.props.name + "']['postConds']['cellType']"}
300283
method={"netpyne_geppetto.getAvailableCellTypes"}
301284
postProcessItems={this.postProcessMenuItems}

webapp/components/definition/plots/NetPyNEInclude.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,13 @@ export default class NetPyNEInclude extends Component {
2525

2626
componentDidMount () {
2727
this.collectInfo();
28-
GEPPETTO.on('populations_change', () => {
29-
this.collectInfo();
30-
})
31-
GEPPETTO.on("population_update_dimension", () => { // different event to avoid triggers on cellParams, stimSourceParams, etc
32-
this.collectInfo();
33-
})
34-
}
35-
componentWillUnmount (){
36-
GEPPETTO.off('populations_change')
3728
}
3829

30+
componentDidUpdate (prevProps, prevState) {
31+
if (this.props.updates !== prevProps.updates) {
32+
this.collectInfo();
33+
}
34+
}
3935

4036
getDataTemplate = () => ({
4137
gids: [],

webapp/components/definition/plots/NetPyNEPlots.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,6 @@ export default class NetPyNEPlots extends React.Component {
129129
style={{ float: 'left', marginTop: "12px", marginLeft: "18px" }}
130130
handleClick={this.handleNewPlot}
131131
/>
132-
/>
133-
134132
</div>
135133
<div style={{ clear: "both" }}></div>
136134
{plots}

webapp/components/definition/plots/plotTypes/Plot2Dnet.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { Component } from 'react';
22
import Checkbox from '../../../general/Checkbox';
33
import Select from '../../../general/Select';
4-
import NetPyNEInclude from '../NetPyNEInclude';
4+
import NetPyNEIncludeConnection from '../../../../redux/reduxconnect/NetPyNEIncludeConnection';
55
import NetPyNEField from '../../../general/NetPyNEField';
66

77
var PythonControlledCapability = require('geppetto-client/js/communication/geppettoJupyter/PythonControlledCapability');
@@ -18,7 +18,7 @@ export default class Plot2Dnet extends React.Component {
1818
render () {
1919
var tag = "simConfig.analysis['plot2Dnet']"
2020
return <div>
21-
<NetPyNEInclude
21+
<NetPyNEIncludeConnection
2222
id={"simConfig.analysis.plot2Dnet.include"}
2323
model={tag + "['include']"}
2424
defaultOptions={['all', 'allCells', 'allNetStims']}

webapp/components/definition/plots/plotTypes/PlotConn.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { Component } from 'react';
22
import Select from '../../../general/Select';
3-
import NetPyNEInclude from '../NetPyNEInclude';
3+
import NetPyNEIncludeConnection from '../../../../redux/reduxconnect/NetPyNEIncludeConnection';
44
import NetPyNEField from '../../../general/NetPyNEField';
55

66
var PythonControlledCapability = require('geppetto-client/js/communication/geppettoJupyter/PythonControlledCapability');
@@ -16,7 +16,7 @@ export default class plotConn extends React.Component {
1616
render () {
1717
var tag = "simConfig.analysis['plotConn']"
1818
return <div>
19-
<NetPyNEInclude
19+
<NetPyNEIncludeConnection
2020
id={"simConfig.analysis.plotConn.include"}
2121
model={tag + "['include']"}
2222
defaultOptions={['all', 'allCells', 'allNetStims']}

webapp/components/definition/plots/plotTypes/PlotRaster.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Checkbox from '../../../general/Checkbox';
33
import TextField from '@material-ui/core/TextField';
44
import Select from '../../../general/Select';
55
import TimeRange from '../TimeRange'
6-
import NetPyNEInclude from '../NetPyNEInclude';
6+
import NetPyNEIncludeConnection from '../../../../redux/reduxconnect/NetPyNEIncludeConnection';
77
import NetPyNEField from '../../../general/NetPyNEField';
88

99
var PythonControlledCapability = require('geppetto-client/js/communication/geppettoJupyter/PythonControlledCapability');
@@ -26,7 +26,7 @@ export default class PlotRaster extends React.Component {
2626
render () {
2727
var tag = "simConfig.analysis['plotRaster']"
2828
return <div>
29-
<NetPyNEInclude
29+
<NetPyNEIncludeConnection
3030
id={"simConfig.analysis.plotRaster.include"}
3131
model={tag + "['include']"}
3232
defaultOptions={['all', 'allCells', 'allNetStims']}

0 commit comments

Comments
 (0)