Skip to content

Commit 02ae343

Browse files
committed
#135 Base flexlayou scaffolding
1 parent 6ccd6f5 commit 02ae343

24 files changed

Lines changed: 1035 additions & 323 deletions

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ Dockerfile_mini
1818
npm*
1919
.vscode
2020
app.log
21+
utilities/x86_64
22+
.idea

netpyne_ui/geppetto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit bebcc0ddcfd986f4ff00f62d308f3054d314f194

package-lock.json

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/jupyter-geppetto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 840c78f5ff64a291af5af87332f749df1ee84d48

webapp/Main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ jQuery(function () {
5151
GEPPETTO.G.debug(false); // Change this to true to see messages on the Geppetto console while loading
5252
GEPPETTO.Resources.COLORS.DEFAULT = "#6f54aa";
5353
GEPPETTO.trigger(GEPPETTO.Events.Show_spinner, "Initialising NetPyNE");
54+
5455

5556
GEPPETTO.on('jupyter_geppetto_extension_ready', data => {
5657
let project = { id: 1, name: 'Project', experiments: [{ "id": 1, "name": 'Experiment', "status": 'DESIGN' }] }

webapp/NetPyNE.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import PythonControlledNetPyNEStimulationSources from './redux/reduxconnect/NetP
99
import NetPyNEStimulationTargets from './components/definition/stimulationTargets/NetPyNEStimulationTargets';
1010
import NetPyNEPlots from './components/definition/plots/NetPyNEPlots';
1111
import NetPyNESimConfig from './components/definition/configuration/NetPyNESimConfig';
12-
import NetPyNEInstantiated from './components/instantiation/NetPyNEInstantiated';
1312
import NetPyNEToolBar from './components/settings/NetPyNEToolBar';
1413
import NetPyNETabs from './components/settings/NetPyNETabs';
14+
import LayoutManager from './redux/reduxconnect/LayoutManagerContainer';
1515

1616
var PythonControlledCapability = require('geppetto-client/js/communication/geppettoJupyter/PythonControlledCapability');
1717

@@ -30,7 +30,6 @@ export default class NetPyNE extends React.Component {
3030
this.state = {
3131
value: 'define',
3232
prevValue: 'define',
33-
model: null,
3433
tabClicked: false,
3534
freezeInstance: false,
3635
freezeSimulation: false,
@@ -49,8 +48,6 @@ export default class NetPyNE extends React.Component {
4948
window.metadata = nextProps.data.metadata;
5049
window.currentFolder = nextProps.data.currentFolder;
5150
window.isDocker = nextProps.data.isDocker;
52-
53-
this.setState({ model: nextProps.data })
5451
}
5552
}
5653

@@ -136,7 +133,7 @@ export default class NetPyNE extends React.Component {
136133
}
137134

138135
render () {
139-
if (this.state.model == null) {
136+
if (!this.props.data) {
140137
return <div></div>
141138
} else {
142139
if (this.state.value == 'define'){
@@ -147,15 +144,15 @@ export default class NetPyNE extends React.Component {
147144
<PythonControlledNetPyNEConnectivity model={"netParams.connParams"} />
148145
<PythonControlledNetPyNEStimulationSources model={"netParams.stimSourceParams"} />
149146
<PythonControlledNetPyNEStimulationTargets model={"netParams.stimTargetParams"} />
150-
<NetPyNESimConfig model={this.state.model.simConfig} />
147+
<NetPyNESimConfig model={this.props.data.simConfig} />
151148
<PythonControlledNetPyNEPlots model={"simConfig.analysis"} />
152149
</div>
153150
} else {
154-
var content = <NetPyNEInstantiated key={this.state.freezeInstance ? "FIXME" : "PLEASE"} ref={"simulate"} model={this.state.model} page={"simulate"} />
151+
var content = <LayoutManager />
155152
}
156153

157154
return (
158-
<div style={{ height: '100%', width:'100%' }} >
155+
<div style={{ height: '100%', width:'100%', display: 'flex', flexDirection: 'column' }} >
159156
<div style={{ position: 'relative', zIndex: '100' }}>
160157
<Toolbar id="appBar" style={{ backgroundColor: '#543a73', width:'100%', boxShadow: '0 0px 4px 0 rgba(0, 0, 0, 0.2), 0 0px 8px 0 rgba(0, 0, 0, 0.19)', position: 'relative', top: '0px', left: '0px', zIndex: 100 }}>
161158
<div style={{ marginLeft: -12 }} >
@@ -180,7 +177,7 @@ export default class NetPyNE extends React.Component {
180177
fastForwardInstantiation={this.state.fastForwardInstantiation}
181178
fastForwardSimulation={this.state.fastForwardSimulation}
182179
/>
183-
180+
184181
{content}
185182
</div>
186183
)

webapp/Utils.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,4 +185,32 @@ const Utils = {
185185
evalPythonMessage: evalPythonMessage
186186
}
187187

188+
/**
189+
* Deep object comparison
190+
* @param {*} a
191+
* @param {*} b
192+
*/
193+
export function isEqual (a, b) {
194+
if (a === b) {
195+
return true;
196+
}
197+
if (a instanceof Date && b instanceof Date) {
198+
return a.getTime() === b.getTime();
199+
}
200+
if (!a || !b || (typeof a !== 'object' && typeof b !== 'object')) {
201+
return a === b;
202+
}
203+
if (a === null || a === undefined || b === null || b === undefined) {
204+
return false;
205+
}
206+
if (a.prototype !== b.prototype) {
207+
return false;
208+
}
209+
let keys = Object.keys(a);
210+
if (keys.length !== Object.keys(b).length) {
211+
return false;
212+
}
213+
return keys.every(k => isEqual(a[k], b[k]));
214+
}
215+
188216
export default Utils

webapp/components/instantiation/NetPyNEInstantiated.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,10 @@ export default class NetPyNEInstantiated extends React.Component {
178178
this.setState({ bringItToFront: 0 })
179179
this.showWidgets(true)
180180
});
181+
182+
GEPPETTO.on(GEPPETTO.Events.Model_loaded, () => {
183+
this.props.modelLoaded();
184+
});
181185
}
182186

183187
componentWillUnmount (){

0 commit comments

Comments
 (0)