File tree Expand file tree Collapse file tree
webapp/components/definition Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -544,16 +544,34 @@ export default class NetPyNECellRules extends React.Component {
544544
545545 getCopyPath ( ) {
546546 const basePath = "netParams.cellParams"
547+ const { value :model } = this . state
548+ const { selectedCellRule, selectedSection, selectedMechanism } = this . state
549+ if ( ! model ) {
550+ return 'undefined'
551+ }
547552 switch ( this . state . page ) {
548- case "main" :
549- return `${ basePath } ["${ this . state . selectedCellRule } "]`
550- case "sections" :
551- return `${ basePath } ["${ this . state . selectedCellRule } "].secs["${ this . state . selectedSection } "]`
552- case "mechanisms" :
553- return `${ basePath } ["${ this . state . selectedCellRule } "].secs["${ this . state . selectedSection } "].mechs["${ this . state . selectedMechanism } "]`
554- default :
555- return "undefined"
553+ case "main" : {
554+ if ( model [ selectedCellRule ] ) {
555+ return `${ basePath } ["${ selectedCellRule } "]`
556+ }
557+ break
558+ }
559+ case "sections" : {
560+ if ( model [ selectedCellRule ] . secs [ selectedSection ] ) {
561+ return `${ basePath } ["${ selectedCellRule } "].secs["${ selectedSection } "]`
562+ }
563+ break
564+ }
565+ case "mechanisms" :{
566+ if ( model [ selectedCellRule ] . secs [ selectedSection ] . mechs [ selectedMechanism ] ) {
567+ return `${ basePath } ["${ selectedCellRule } "].secs["${ selectedSection } "].mechs["${ selectedMechanism } "]`
568+ }
569+ break
570+ }
571+ default : {
572+ }
556573 }
574+ return "undefined"
557575 }
558576
559577 callbackForNewCellTypeCreated ( newCellTypeName ) {
Original file line number Diff line number Diff line change @@ -154,6 +154,11 @@ export default class NetPyNEConnectivityRules extends Component {
154154 return true ;
155155 }
156156
157+ getCopyPath ( ) {
158+ const { value : model , selectedConnectivityRule } = this . state
159+ return model && model [ selectedConnectivityRule ] && `netParams.connParams["${ selectedConnectivityRule } "]`
160+ }
161+
157162 render ( ) {
158163 var actions = [
159164 < Button
@@ -226,7 +231,7 @@ export default class NetPyNEConnectivityRules extends Component {
226231
227232 </ div >
228233 < Divider />
229- < RulePath text = { `netParams.connParams[" ${ this . state . selectedConnectivityRule } "]` } />
234+ < RulePath text = { this . getCopyPath ( ) } />
230235 < Divider />
231236 < Filter
232237 value = { this . state . filterValue }
Original file line number Diff line number Diff line change @@ -154,6 +154,11 @@ export default class NetPyNEPopulations extends React.Component {
154154 return true ;
155155 }
156156
157+ getPath ( ) {
158+ const { value : model , selectedPopulation } = this . state
159+ return model && model [ selectedPopulation ] && `netParams.popParams["${ selectedPopulation } "]`
160+ }
161+
157162 render ( ) {
158163 var actions = [
159164 < Button
@@ -229,7 +234,7 @@ export default class NetPyNEPopulations extends React.Component {
229234
230235 </ div >
231236 < Divider />
232- < RulePath text = { `netParams.popParams[" ${ this . state . selectedPopulation } "]` } />
237+ < RulePath text = { this . getPath ( ) } />
233238 < Divider />
234239 < Filter
235240 value = { this . state . filterPopValue }
Original file line number Diff line number Diff line change @@ -134,6 +134,11 @@ export default class NetPyNEStimulationSources extends Component {
134134 return true ;
135135 }
136136
137+ getPath ( ) {
138+ const { value : model , selectedStimulationSource } = this . state
139+ return model && model [ selectedStimulationSource ] && `netParams.stimSourceParams["${ selectedStimulationSource } "]`
140+ }
141+
137142 render ( ) {
138143 var actions = [
139144 < Button
@@ -202,7 +207,7 @@ export default class NetPyNEStimulationSources extends Component {
202207 </ div >
203208 </ div >
204209 < Divider />
205- < RulePath text = { `netParams.stimSourceParams[" ${ this . state . selectedStimulationSource } "]` } />
210+ < RulePath text = { this . getPath ( ) } />
206211 < Divider />
207212 < Filter
208213 value = { this . state . filterValue }
Original file line number Diff line number Diff line change @@ -62,9 +62,12 @@ export default class NetPyNEStimulationTarget extends React.Component {
6262
6363 async isStimSourceTypeNetStim ( stimSourceName ) {
6464 var isNetStim = false
65+ const { name : stimName } = this . props
6566 if ( stimSourceName === undefined ) {
6667 try {
67- stimSourceName = await Utils . evalPythonMessage ( "netpyne_geppetto.netParams.stimTargetParams['" + this . props . name + "']['source']" )
68+ const NETPYNE_OBJ = "netpyne_geppetto.netParams.stimTargetParams"
69+ const SAFE_QUERY = `${ NETPYNE_OBJ } ['${ stimName } ']['source'] if "${ stimName } " in ${ NETPYNE_OBJ } else ''`
70+ stimSourceName = await Utils . evalPythonMessage ( SAFE_QUERY )
6871 } catch ( error ) {
6972 console . log ( error )
7073 }
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ export default class NetPyNEStimulationTargets extends Component {
4444 var defaultStimulationTargets = { 'stim_target' : { 'source' : '' , 'conds' : { } } } ;
4545 var key = Object . keys ( defaultStimulationTargets ) [ 0 ] ;
4646 var value = defaultStimulationTargets [ key ] ;
47- var model = this . state . value ;
47+ var model = { ... this . state . value } ;
4848 var StimulationTargetId = Utils . getAvailableKey ( model , key ) ;
4949 var newStimulationTarget = Object . assign ( { name : StimulationTargetId } , value ) ;
5050 Utils . execPythonMessage ( 'netpyne_geppetto.netParams.stimTargetParams["' + StimulationTargetId + '"] = ' + JSON . stringify ( value ) ) ;
@@ -133,6 +133,11 @@ export default class NetPyNEStimulationTargets extends Component {
133133 return true ;
134134 }
135135
136+ getPath ( ) {
137+ const { value : model , selectedStimulationTarget } = this . state
138+ return model && model [ selectedStimulationTarget ] && `netParams.stimTargetParams["${ selectedStimulationTarget } "]`
139+ }
140+
136141 render ( ) {
137142 var actions = [
138143 < Button
@@ -198,7 +203,7 @@ export default class NetPyNEStimulationTargets extends Component {
198203
199204 </ div >
200205 < Divider />
201- < RulePath text = { `netParams.stimTargetParams[" ${ this . state . selectedStimulationTarget } "]` } />
206+ < RulePath text = { this . getPath ( ) } />
202207 < Divider />
203208 < Filter
204209 value = { this . state . filterValue }
Original file line number Diff line number Diff line change @@ -133,6 +133,12 @@ export default class NetPyNESynapses extends Component {
133133 return true ;
134134 }
135135
136+
137+ getPath ( ) {
138+ const { value : model , selectedSynapse } = this . state
139+ return model && model [ selectedSynapse ] && `netParams.synMechParams["${ selectedSynapse } "]`
140+ }
141+
136142 render ( ) {
137143 var actions = [
138144 < Button
@@ -198,7 +204,7 @@ export default class NetPyNESynapses extends Component {
198204
199205 </ div >
200206 < Divider />
201- < RulePath text = { `netParams.synMechParams[" ${ this . state . selectedSynapse } "]` } />
207+ < RulePath text = { this . getPath ( ) } />
202208 < Divider />
203209 < Filter
204210 value = { this . state . filterValue }
You can’t perform that action at this time.
0 commit comments