Commit 5171355656274f654e056dab8d31f36ca50b752c
1 parent
2fa56f95
Exists in
master
and in
92 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,6 +540,7 @@ Ext.define('amdaModel.InteractiveNode', { | ||
540 | paramName = node.get('id'); | 540 | paramName = node.get('id'); |
541 | } | 541 | } |
542 | var component_info = node.get('component_info'); | 542 | var component_info = node.get('component_info'); |
543 | + var predefinedArgs = node.get('predefinedArgs'); | ||
543 | if (component_info && component_info.parentId) { | 544 | if (component_info && component_info.parentId) { |
544 | //It's a component | 545 | //It's a component |
545 | paramName = component_info.parentId; | 546 | paramName = component_info.parentId; |
@@ -548,8 +549,16 @@ Ext.define('amdaModel.InteractiveNode', { | @@ -548,8 +549,16 @@ Ext.define('amdaModel.InteractiveNode', { | ||
548 | components['index1'] = component_info.index1; | 549 | components['index1'] = component_info.index1; |
549 | if (component_info.index2) | 550 | if (component_info.index2) |
550 | components['index2'] = component_info.index2; | 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,6 +432,7 @@ Ext.define('amdaUI.DownloadUI', { | ||
432 | return false; | 432 | return false; |
433 | var idToSent; | 433 | var idToSent; |
434 | var components = null; | 434 | var components = null; |
435 | + var predefinedArgs = data.records[0].get('predefinedArgs'); | ||
435 | switch (data.records[0].data.nodeType) | 436 | switch (data.records[0].data.nodeType) |
436 | { | 437 | { |
437 | case 'localParam' : | 438 | case 'localParam' : |
@@ -451,6 +452,7 @@ Ext.define('amdaUI.DownloadUI', { | @@ -451,6 +452,7 @@ Ext.define('amdaUI.DownloadUI', { | ||
451 | components['index1'] = component_info.index1; | 452 | components['index1'] = component_info.index1; |
452 | if (component_info.index2) | 453 | if (component_info.index2) |
453 | components['index2'] = component_info.index2; | 454 | components['index2'] = component_info.index2; |
455 | + predefinedArgs = data.records[0].parentNode.get('predefinedArgs'); | ||
454 | } | 456 | } |
455 | if (data.records[0].get('needsArgs')) | 457 | if (data.records[0].get('needsArgs')) |
456 | { | 458 | { |
@@ -509,9 +511,10 @@ Ext.define('amdaUI.DownloadUI', { | @@ -509,9 +511,10 @@ Ext.define('amdaUI.DownloadUI', { | ||
509 | } | 511 | } |
510 | var downModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.download.id); | 512 | var downModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.download.id); |
511 | if (downModule) { | 513 | if (downModule) { |
512 | - if (data.records[0].get('predefinedArgs')) { | 514 | + |
515 | + if (predefinedArgs) { | ||
513 | downModule.parseTemplatedParam(idToSent, function(param_info) { | 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 | else { | 520 | else { |
js/app/views/PlotComponents/PlotTree.js
@@ -697,6 +697,7 @@ Ext.define('amdaPlotComp.PlotTree', { | @@ -697,6 +697,7 @@ Ext.define('amdaPlotComp.PlotTree', { | ||
697 | var param_id = record.get('id'); | 697 | var param_id = record.get('id'); |
698 | var plot_only = record.get('notyet'); | 698 | var plot_only = record.get('notyet'); |
699 | var components = null; | 699 | var components = null; |
700 | + var predefinedArgs = record.get('predefinedArgs'); | ||
700 | if (component_info && component_info.parentId) { | 701 | if (component_info && component_info.parentId) { |
701 | //It's a component | 702 | //It's a component |
702 | param_id = component_info.parentId; | 703 | param_id = component_info.parentId; |
@@ -705,8 +706,9 @@ Ext.define('amdaPlotComp.PlotTree', { | @@ -705,8 +706,9 @@ Ext.define('amdaPlotComp.PlotTree', { | ||
705 | components['index1'] = component_info.index1; | 706 | components['index1'] = component_info.index1; |
706 | if (component_info.index2) | 707 | if (component_info.index2) |
707 | components['index2'] = component_info.index2; | 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 | return true; | 713 | return true; |
712 | case 'amdaModel.AliasNode' : | 714 | case 'amdaModel.AliasNode' : |
js/app/views/SearchUI.js
@@ -17,7 +17,8 @@ Ext.define('amdaUI.SearchUI', | @@ -17,7 +17,8 @@ Ext.define('amdaUI.SearchUI', | ||
17 | 'amdaUI.CalculatorUI', | 17 | 'amdaUI.CalculatorUI', |
18 | 'amdaUI.TimeSelectorUI', | 18 | 'amdaUI.TimeSelectorUI', |
19 | 'extensions.SelectableTextArea', | 19 | 'extensions.SelectableTextArea', |
20 | - 'amdaUI.ParamArgumentsPlug' | 20 | + 'amdaUI.ParamArgumentsPlug', |
21 | + 'amdaModel.RequestParamObject' | ||
21 | ], | 22 | ], |
22 | 23 | ||
23 | constructor: function(config) | 24 | constructor: function(config) |
@@ -45,7 +46,7 @@ Ext.define('amdaUI.SearchUI', | @@ -45,7 +46,7 @@ Ext.define('amdaUI.SearchUI', | ||
45 | 46 | ||
46 | addParam : function(newParamName, isLeaf, needArgs, components) | 47 | addParam : function(newParamName, isLeaf, needArgs, components) |
47 | { | 48 | { |
48 | - if (!isLeaf || needArgs || components) | 49 | + if (needArgs || components) |
49 | this.editParameterArgs(newParamName, components); | 50 | this.editParameterArgs(newParamName, components); |
50 | else | 51 | else |
51 | this.addParamInEditor(newParamName); | 52 | this.addParamInEditor(newParamName); |