Commit 2fa56f95cf2a13d9ff21abf9b081d41e01dad521
1 parent
b78325f1
Exists in
master
and in
91 other branches
Predefined templated params - First step
Showing
6 changed files
with
75 additions
and
13 deletions
Show diff stats
js/app/controllers/InteractiveModule.js
@@ -253,11 +253,29 @@ Ext.define('amdaDesktop.InteractiveModule', { | @@ -253,11 +253,29 @@ Ext.define('amdaDesktop.InteractiveModule', { | ||
253 | * @param {String} objectName The name of sent object | 253 | * @param {String} objectName The name of sent object |
254 | * @param {String} isLeaf boolean true if it's a leaf parameter | 254 | * @param {String} isLeaf boolean true if it's a leaf parameter |
255 | */ | 255 | */ |
256 | - addParam : function(objectName, isLeaf, needsArgs, components) { | 256 | + addParam : function(objectName, isLeaf, needsArgs, components, predefined_args) { |
257 | var uiContent = this.getUiContent(); | 257 | var uiContent = this.getUiContent(); |
258 | - uiContent.addParam(objectName, isLeaf, needsArgs, components); | 258 | + uiContent.addParam(objectName, isLeaf, needsArgs, components, predefined_args); |
259 | }, | 259 | }, |
260 | - | 260 | + |
261 | + parseTemplatedParam: function(templatedParamId, onParamParsed) { | ||
262 | + AmdaAction.parseTemplatedParam(templatedParamId, function(res,e) { | ||
263 | + if (!res || !res.success) { | ||
264 | + if (!res || !res.message) { | ||
265 | + myDesktopApp.errorMsg('Internal Error - Cannot parse the templated parameter'); | ||
266 | + } | ||
267 | + else { | ||
268 | + myDesktopApp.errorMsg('Internal Error - ' + res.message); | ||
269 | + } | ||
270 | + } | ||
271 | + else { | ||
272 | + if (onParamParsed) { | ||
273 | + onParamParsed(res.info); | ||
274 | + } | ||
275 | + } | ||
276 | + }); | ||
277 | + }, | ||
278 | + | ||
261 | saveState : Ext.emptyFn, | 279 | saveState : Ext.emptyFn, |
262 | 280 | ||
263 | getState : function() { | 281 | getState : function() { |
js/app/models/InteractiveNode.js
@@ -18,6 +18,7 @@ Ext.define('amdaModel.InteractiveNode', { | @@ -18,6 +18,7 @@ Ext.define('amdaModel.InteractiveNode', { | ||
18 | {name: 'moduleId', type: 'string', persist: false}, | 18 | {name: 'moduleId', type: 'string', persist: false}, |
19 | {name: 'filtered', type: 'boolean', defaultValue: false, persist: false}, | 19 | {name: 'filtered', type: 'boolean', defaultValue: false, persist: false}, |
20 | {name: 'needsArgs', type:'boolean', defaultValue: false}, | 20 | {name: 'needsArgs', type:'boolean', defaultValue: false}, |
21 | + {name: 'predefinedArgs', type:'boolean', defaultValue: false}, | ||
21 | {name: 'disable', type: 'boolean', defaultValue: false, persist: false} | 22 | {name: 'disable', type: 'boolean', defaultValue: false, persist: false} |
22 | ], | 23 | ], |
23 | 24 |
js/app/models/PlotObjects/PlotPanelObject.js
@@ -298,6 +298,7 @@ Ext.define('amdaPlotObj.PlotPanelObject', { | @@ -298,6 +298,7 @@ Ext.define('amdaPlotObj.PlotPanelObject', { | ||
298 | var isTTCat = (typeof data !== "undefined") && (typeof data.isTTCat !== "undefined") && data.isTTCat; | 298 | var isTTCat = (typeof data !== "undefined") && (typeof data.isTTCat !== "undefined") && data.isTTCat; |
299 | var isVector = (typeof data !== "undefined") && (typeof data.isVector !== "undefined") && data.isVector; | 299 | var isVector = (typeof data !== "undefined") && (typeof data.isVector !== "undefined") && data.isVector; |
300 | var components = (typeof data !== "undefined") && (typeof data.components !== "undefined") && data.components ? data.components : null; | 300 | var components = (typeof data !== "undefined") && (typeof data.components !== "undefined") && data.components ? data.components : null; |
301 | + var template_args = (typeof data !== "undefined") && (typeof data.template_args !== "undefined") && data.template_args ? data.template_args : null; | ||
301 | 302 | ||
302 | this.set('last-param-id', this.get('last-param-id') + 1); | 303 | this.set('last-param-id', this.get('last-param-id') + 1); |
303 | 304 | ||
@@ -308,6 +309,9 @@ Ext.define('amdaPlotObj.PlotPanelObject', { | @@ -308,6 +309,9 @@ Ext.define('amdaPlotObj.PlotPanelObject', { | ||
308 | var recs = this.params().add(obj); | 309 | var recs = this.params().add(obj); |
309 | recs[0].set('paramid', paramId); | 310 | recs[0].set('paramid', paramId); |
310 | recs[0].set('plotonly', isPlotOnly); | 311 | recs[0].set('plotonly', isPlotOnly); |
312 | + if (template_args) { | ||
313 | + recs[0].set('template_args', template_args); | ||
314 | + } | ||
311 | 315 | ||
312 | if (components != null) { | 316 | if (components != null) { |
313 | if (components['index1']) { | 317 | if (components['index1']) { |
js/app/views/DownloadUI.js
@@ -91,7 +91,7 @@ Ext.define('amdaUI.DownloadUI', { | @@ -91,7 +91,7 @@ Ext.define('amdaUI.DownloadUI', { | ||
91 | this.timeSelector.intervalSel.updateDuration(); | 91 | this.timeSelector.intervalSel.updateDuration(); |
92 | }, | 92 | }, |
93 | 93 | ||
94 | - addParam: function (paramId, isLeaf, needArgs, components) | 94 | + addParam: function (paramId, isLeaf, needArgs, components, predefined_args) |
95 | { | 95 | { |
96 | // adding the parameter to the paramGrid | 96 | // adding the parameter to the paramGrid |
97 | var paramObj = amdaModel.RequestParamObject.getEmptyObj(); | 97 | var paramObj = amdaModel.RequestParamObject.getEmptyObj(); |
@@ -109,6 +109,10 @@ Ext.define('amdaUI.DownloadUI', { | @@ -109,6 +109,10 @@ Ext.define('amdaUI.DownloadUI', { | ||
109 | } | 109 | } |
110 | } | 110 | } |
111 | 111 | ||
112 | + if (predefined_args) { | ||
113 | + paramObj.template_args = predefined_args; | ||
114 | + } | ||
115 | + | ||
112 | var r = Ext.create('amdaModel.DownloadParam', paramObj); | 116 | var r = Ext.create('amdaModel.DownloadParam', paramObj); |
113 | var pos = this.paramGrid.store.getCount(); | 117 | var pos = this.paramGrid.store.getCount(); |
114 | this.paramGrid.store.insert(pos, r); | 118 | this.paramGrid.store.insert(pos, r); |
@@ -504,8 +508,17 @@ Ext.define('amdaUI.DownloadUI', { | @@ -504,8 +508,17 @@ Ext.define('amdaUI.DownloadUI', { | ||
504 | return false; | 508 | return false; |
505 | } | 509 | } |
506 | var downModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.download.id); | 510 | var downModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.download.id); |
507 | - if (downModule) | ||
508 | - downModule.addParam(idToSent, data.records[0].get('leaf'), data.records[0].get('needsArgs'), components); | 511 | + if (downModule) { |
512 | + if (data.records[0].get('predefinedArgs')) { | ||
513 | + downModule.parseTemplatedParam(idToSent, function(param_info) { | ||
514 | + downModule.addParam(param_info.paramid, true, true, components, param_info.template_args); | ||
515 | + }); | ||
516 | + } | ||
517 | + else { | ||
518 | + downModule.addParam(idToSent, data.records[0].get('leaf'), data.records[0].get('needsArgs'), components); | ||
519 | + return true; | ||
520 | + } | ||
521 | + } | ||
509 | return true; | 522 | return true; |
510 | } | 523 | } |
511 | }); | 524 | }); |
js/app/views/PlotComponents/PlotTree.js
@@ -643,11 +643,24 @@ Ext.define('amdaPlotComp.PlotTree', { | @@ -643,11 +643,24 @@ Ext.define('amdaPlotComp.PlotTree', { | ||
643 | 643 | ||
644 | //Create param object | 644 | //Create param object |
645 | var me = this; | 645 | var me = this; |
646 | - panelObject.createNewParam(paramId, data, function (newParamObject) { | ||
647 | - //Rebuild params node | ||
648 | - me.buildPanelsNode(newParamObject.getId()); | ||
649 | - //BRE newParamObject | ||
650 | - }); | 646 | + if ((typeof data !== "undefined") && (typeof data.predefinedArgs !== "undefined") && data.predefinedArgs) { |
647 | + var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id); | ||
648 | + plotModule.parseTemplatedParam(paramId, function(param_info) { | ||
649 | + data.template_args = param_info.template_args; | ||
650 | + panelObject.createNewParam(param_info.paramid, data, function (newParamObject) { | ||
651 | + //Rebuild params node | ||
652 | + me.buildPanelsNode(newParamObject.getId()); | ||
653 | + }); | ||
654 | + //downModule.addParam(param_info.paramid, true, true, components, param_info.template_args); | ||
655 | + }); | ||
656 | + } | ||
657 | + else { | ||
658 | + panelObject.createNewParam(paramId, data, function (newParamObject) { | ||
659 | + //Rebuild params node | ||
660 | + me.buildPanelsNode(newParamObject.getId()); | ||
661 | + //BRE newParamObject | ||
662 | + }); | ||
663 | + } | ||
651 | }, | 664 | }, |
652 | 665 | ||
653 | dropRecord: function (record, targetNode, position) | 666 | dropRecord: function (record, targetNode, position) |
@@ -693,7 +706,7 @@ Ext.define('amdaPlotComp.PlotTree', { | @@ -693,7 +706,7 @@ Ext.define('amdaPlotComp.PlotTree', { | ||
693 | if (component_info.index2) | 706 | if (component_info.index2) |
694 | components['index2'] = component_info.index2; | 707 | components['index2'] = component_info.index2; |
695 | } | 708 | } |
696 | - this.dropParamToCreate(targetNode, position, param_id, {'components': components, 'isVector': isVector, 'plotOnly': plot_only}); | 709 | + this.dropParamToCreate(targetNode, position, param_id, {'components': components, 'isVector': isVector, 'plotOnly': plot_only, 'predefinedArgs': record.get('predefinedArgs')}); |
697 | } | 710 | } |
698 | return true; | 711 | return true; |
699 | case 'amdaModel.AliasNode' : | 712 | case 'amdaModel.AliasNode' : |
php/classes/AmdaAction.php
@@ -268,6 +268,9 @@ class AmdaAction | @@ -268,6 +268,9 @@ class AmdaAction | ||
268 | $isParameter = true; | 268 | $isParameter = true; |
269 | if ($child->hasAttribute('TemplatedParameter')) | 269 | if ($child->hasAttribute('TemplatedParameter')) |
270 | $needsArgs = true; | 270 | $needsArgs = true; |
271 | + | ||
272 | + if ($child->hasAttribute('PredefinedTemplatedParameter')) | ||
273 | + $predefinedArgs = true; | ||
271 | 274 | ||
272 | if ($child->parentNode->hasAttribute('dataStart')) { | 275 | if ($child->parentNode->hasAttribute('dataStart')) { |
273 | $globalStart = $child->parentNode->getAttribute('dataStart'); | 276 | $globalStart = $child->parentNode->getAttribute('dataStart'); |
@@ -332,7 +335,7 @@ class AmdaAction | @@ -332,7 +335,7 @@ class AmdaAction | ||
332 | 'id' => $id,'nodeType' => $nodeType, 'info' => $info, "component_info" => $component_info, | 335 | 'id' => $id,'nodeType' => $nodeType, 'info' => $info, "component_info" => $component_info, |
333 | 'globalStart' => $globalStart, 'globalStop' => $globalStop, 'timeRestriction' => $timeRestriction, | 336 | 'globalStart' => $globalStart, 'globalStop' => $globalStop, 'timeRestriction' => $timeRestriction, |
334 | 'leaf' => $isLeaf, 'isParameter' => $isParameter,'isSpectra' => $isSpectra, | 337 | 'leaf' => $isLeaf, 'isParameter' => $isParameter,'isSpectra' => $isSpectra, |
335 | - 'is2dSpectra' => $is2dSpectra,'isStack' => $isStack, 'needsArgs' => $needsArgs, 'help' => $help, 'notyet' => $not_yet); | 338 | + 'is2dSpectra' => $is2dSpectra,'isStack' => $isStack, 'needsArgs' => $needsArgs, 'predefinedArgs' => $predefinedArgs, 'help' => $help, 'notyet' => $not_yet); |
336 | } | 339 | } |
337 | else { | 340 | else { |
338 | if ($child->hasAttribute('rank')) { | 341 | if ($child->hasAttribute('rank')) { |
@@ -1443,6 +1446,7 @@ class AmdaAction | @@ -1443,6 +1446,7 @@ class AmdaAction | ||
1443 | 1446 | ||
1444 | $inputobj = (Object)array( | 1447 | $inputobj = (Object)array( |
1445 | 'paramId' => $obj->paramId, | 1448 | 'paramId' => $obj->paramId, |
1449 | + 'predefinedArgs' => !empty($obj->predefinedArgs), | ||
1446 | 'type' => $type | 1450 | 'type' => $type |
1447 | ); | 1451 | ); |
1448 | return $this->executeRequest($inputobj, FunctionTypeEnumClass::PARAMINFO); | 1452 | return $this->executeRequest($inputobj, FunctionTypeEnumClass::PARAMINFO); |
@@ -1603,5 +1607,14 @@ class AmdaAction | @@ -1603,5 +1607,14 @@ class AmdaAction | ||
1603 | { | 1607 | { |
1604 | return $this->executeRequest($obj->processId, FunctionTypeEnumClass::PROCESSGETREQUEST); | 1608 | return $this->executeRequest($obj->processId, FunctionTypeEnumClass::PROCESSGETREQUEST); |
1605 | } | 1609 | } |
1610 | + | ||
1611 | + public function parseTemplatedParam($paramTemplateId) | ||
1612 | + { | ||
1613 | + $args = (Object)array( | ||
1614 | + 'paramId' => $paramTemplateId, | ||
1615 | + 'type' => 'param_parse_template' | ||
1616 | + ); | ||
1617 | + return $this->executeRequest($args, FunctionTypeEnumClass::PARAMINFO); | ||
1618 | + } | ||
1606 | } | 1619 | } |
1607 | ?> | 1620 | ?> |