|
| 1 | +import React from "react"; |
| 2 | +import Toolbar from "@material-ui/core/Toolbar"; |
| 3 | +import Transition from "./transition/Transition"; |
| 4 | +import { |
| 5 | + NetPyNESynapses, |
| 6 | + NetPyNEConnectivityRules, |
| 7 | + NetPyNECellRules, |
| 8 | + NetPyNEStimulationSources, |
| 9 | + NetPyNEStimulationTargets, |
| 10 | + NetPyNESimConfig, |
| 11 | + NetPyNEToolBar, |
| 12 | + NetPyNETabs, |
| 13 | + NetPyNEPopulations, |
| 14 | + LayoutManager, |
| 15 | + NetPyNEPlots |
| 16 | +} from "netpyne/components"; |
| 17 | + |
| 18 | +export default class NetPyNE extends React.Component { |
| 19 | + constructor (props) { |
| 20 | + super(props); |
| 21 | + this.widgets = {}; |
| 22 | + |
| 23 | + } |
| 24 | + |
| 25 | + UNSAFE_componentWillReceiveProps (nextProps) { |
| 26 | + if (this.props.data != nextProps.data) { |
| 27 | + console.log("Initialising NetPyNE Tabs"); |
| 28 | + |
| 29 | + window.metadata = nextProps.data.metadata; |
| 30 | + window.currentFolder = nextProps.data.currentFolder; |
| 31 | + window.isDocker = nextProps.data.isDocker; |
| 32 | + } |
| 33 | + } |
| 34 | + |
| 35 | + |
| 36 | + render () { |
| 37 | + if (!this.props.data) { |
| 38 | + return <div></div>; |
| 39 | + } else { |
| 40 | + if (this.props.editMode) { |
| 41 | + var content = ( |
| 42 | + <div style={{ marginBottom: "50px" }}> |
| 43 | + <NetPyNEPopulations model={"netParams.popParams"} /> |
| 44 | + <NetPyNECellRules model={"netParams.cellParams"} /> |
| 45 | + <NetPyNESynapses model={"netParams.synMechParams"} /> |
| 46 | + <NetPyNEConnectivityRules model={"netParams.connParams"} /> |
| 47 | + <NetPyNEStimulationSources model={"netParams.stimSourceParams"} /> |
| 48 | + <NetPyNEStimulationTargets model={"netParams.stimTargetParams"} /> |
| 49 | + <NetPyNESimConfig model={this.props.data.simConfig} /> |
| 50 | + <NetPyNEPlots model={"simConfig.analysis"} /> |
| 51 | + </div> |
| 52 | + ); |
| 53 | + } else { |
| 54 | + var content = <LayoutManager />; |
| 55 | + } |
| 56 | + |
| 57 | + return ( |
| 58 | + <div |
| 59 | + style={{ |
| 60 | + height: "100%", |
| 61 | + width: "100%", |
| 62 | + display: "flex", |
| 63 | + flexDirection: "column" |
| 64 | + }} |
| 65 | + > |
| 66 | + <div style={{ position: "relative", zIndex: "100" }}> |
| 67 | + <Toolbar |
| 68 | + id="appBar" |
| 69 | + style={{ |
| 70 | + backgroundColor: "#543a73", |
| 71 | + width: "100%", |
| 72 | + boxShadow: |
| 73 | + "0 0px 4px 0 rgba(0, 0, 0, 0.2), 0 0px 8px 0 rgba(0, 0, 0, 0.19)", |
| 74 | + position: "relative", |
| 75 | + top: "0px", |
| 76 | + left: "0px", |
| 77 | + zIndex: 100 |
| 78 | + }} |
| 79 | + > |
| 80 | + <div style={{ marginLeft: -12 }}> |
| 81 | + <NetPyNEToolBar /> |
| 82 | + </div> |
| 83 | + <div |
| 84 | + style={{ |
| 85 | + display: "flex", |
| 86 | + flexFlow: "rows", |
| 87 | + width: "100%", |
| 88 | + marginRight: -10 |
| 89 | + }} |
| 90 | + > |
| 91 | + <NetPyNETabs /> |
| 92 | + </div> |
| 93 | + </Toolbar> |
| 94 | + </div> |
| 95 | + |
| 96 | + {/** TODO Reengineer Transition using the middleware to handle simulation and instantiation. The transition should only show content related to what actually we want to do |
| 97 | + <Transition |
| 98 | + tab={this.state.value} |
| 99 | + clickOnTab={this.state.tabClicked} |
| 100 | + handleDeactivateInstanceUpdate={this.handleDeactivateInstanceUpdate} |
| 101 | + handleDeactivateSimulationUpdate={ |
| 102 | + this.handleDeactivateSimulationUpdate |
| 103 | + } |
| 104 | + freezeInstance={this.state.freezeInstance} |
| 105 | + freezeSimulation={this.state.freezeSimulation} |
| 106 | + fastForwardInstantiation={this.state.fastForwardInstantiation} |
| 107 | + fastForwardSimulation={this.state.fastForwardSimulation} |
| 108 | + /> */} |
| 109 | + |
| 110 | + {content} |
| 111 | + </div> |
| 112 | + ); |
| 113 | + } |
| 114 | + } |
| 115 | +} |
0 commit comments