Commit 5171355656274f654e056dab8d31f36ca50b752c
1 parent
2fa56f95
Exists in
master
and in
91 other branches
Templated parameter with pre-filled arguments (#8503)
Showing
4 changed files
with
21 additions
and
6 deletions
Show diff stats
js/app/models/InteractiveNode.js
... | ... | @@ -540,6 +540,7 @@ Ext.define('amdaModel.InteractiveNode', { |
540 | 540 | paramName = node.get('id'); |
541 | 541 | } |
542 | 542 | var component_info = node.get('component_info'); |
543 | + var predefinedArgs = node.get('predefinedArgs'); | |
543 | 544 | if (component_info && component_info.parentId) { |
544 | 545 | //It's a component |
545 | 546 | paramName = component_info.parentId; |
... | ... | @@ -548,8 +549,16 @@ Ext.define('amdaModel.InteractiveNode', { |
548 | 549 | components['index1'] = component_info.index1; |
549 | 550 | if (component_info.index2) |
550 | 551 | components['index2'] = component_info.index2; |
552 | + predefinedArgs = node.parentNode.get('predefinedArgs'); | |
551 | 553 | } |
552 | - module.addParam(paramName,true,node.get('needsArgs'),components); | |
554 | + if (predefinedArgs) { | |
555 | + module.parseTemplatedParam(paramName, function(param_info) { | |
556 | + module.addParam(param_info.paramid, true, node.get('needsArgs'), components, param_info.template_args); | |
557 | + }); | |
558 | + } | |
559 | + else { | |
560 | + module.addParam(paramName,true,node.get('needsArgs'),components); | |
561 | + } | |
553 | 562 | }); |
554 | 563 | }, |
555 | 564 | ... | ... |
js/app/views/DownloadUI.js
... | ... | @@ -432,6 +432,7 @@ Ext.define('amdaUI.DownloadUI', { |
432 | 432 | return false; |
433 | 433 | var idToSent; |
434 | 434 | var components = null; |
435 | + var predefinedArgs = data.records[0].get('predefinedArgs'); | |
435 | 436 | switch (data.records[0].data.nodeType) |
436 | 437 | { |
437 | 438 | case 'localParam' : |
... | ... | @@ -451,6 +452,7 @@ Ext.define('amdaUI.DownloadUI', { |
451 | 452 | components['index1'] = component_info.index1; |
452 | 453 | if (component_info.index2) |
453 | 454 | components['index2'] = component_info.index2; |
455 | + predefinedArgs = data.records[0].parentNode.get('predefinedArgs'); | |
454 | 456 | } |
455 | 457 | if (data.records[0].get('needsArgs')) |
456 | 458 | { |
... | ... | @@ -509,9 +511,10 @@ Ext.define('amdaUI.DownloadUI', { |
509 | 511 | } |
510 | 512 | var downModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.download.id); |
511 | 513 | if (downModule) { |
512 | - if (data.records[0].get('predefinedArgs')) { | |
514 | + | |
515 | + if (predefinedArgs) { | |
513 | 516 | downModule.parseTemplatedParam(idToSent, function(param_info) { |
514 | - downModule.addParam(param_info.paramid, true, true, components, param_info.template_args); | |
517 | + downModule.addParam(param_info.paramid, data.records[0].get('leaf'), data.records[0].get('needsArgs'), components, param_info.template_args); | |
515 | 518 | }); |
516 | 519 | } |
517 | 520 | else { | ... | ... |
js/app/views/PlotComponents/PlotTree.js
... | ... | @@ -697,6 +697,7 @@ Ext.define('amdaPlotComp.PlotTree', { |
697 | 697 | var param_id = record.get('id'); |
698 | 698 | var plot_only = record.get('notyet'); |
699 | 699 | var components = null; |
700 | + var predefinedArgs = record.get('predefinedArgs'); | |
700 | 701 | if (component_info && component_info.parentId) { |
701 | 702 | //It's a component |
702 | 703 | param_id = component_info.parentId; |
... | ... | @@ -705,8 +706,9 @@ Ext.define('amdaPlotComp.PlotTree', { |
705 | 706 | components['index1'] = component_info.index1; |
706 | 707 | if (component_info.index2) |
707 | 708 | components['index2'] = component_info.index2; |
709 | + predefinedArgs = record.parentNode.get('predefinedArgs'); | |
708 | 710 | } |
709 | - this.dropParamToCreate(targetNode, position, param_id, {'components': components, 'isVector': isVector, 'plotOnly': plot_only, 'predefinedArgs': record.get('predefinedArgs')}); | |
711 | + this.dropParamToCreate(targetNode, position, param_id, {'components': components, 'isVector': isVector, 'plotOnly': plot_only, 'predefinedArgs': predefinedArgs}); | |
710 | 712 | } |
711 | 713 | return true; |
712 | 714 | case 'amdaModel.AliasNode' : | ... | ... |
js/app/views/SearchUI.js
... | ... | @@ -17,7 +17,8 @@ Ext.define('amdaUI.SearchUI', |
17 | 17 | 'amdaUI.CalculatorUI', |
18 | 18 | 'amdaUI.TimeSelectorUI', |
19 | 19 | 'extensions.SelectableTextArea', |
20 | - 'amdaUI.ParamArgumentsPlug' | |
20 | + 'amdaUI.ParamArgumentsPlug', | |
21 | + 'amdaModel.RequestParamObject' | |
21 | 22 | ], |
22 | 23 | |
23 | 24 | constructor: function(config) |
... | ... | @@ -45,7 +46,7 @@ Ext.define('amdaUI.SearchUI', |
45 | 46 | |
46 | 47 | addParam : function(newParamName, isLeaf, needArgs, components) |
47 | 48 | { |
48 | - if (!isLeaf || needArgs || components) | |
49 | + if (needArgs || components) | |
49 | 50 | this.editParameterArgs(newParamName, components); |
50 | 51 | else |
51 | 52 | this.addParamInEditor(newParamName); | ... | ... |