Commit 8ba47f7212de2e2a584e5fc2cab2e384828362dd
1 parent
098d15a9
Exists in
master
and in
106 other branches
rest actualisation et supprimer double message
Showing
9 changed files
with
137 additions
and
43 deletions
Show diff stats
js/app/models/DerivedParamNode.js
@@ -9,46 +9,70 @@ | @@ -9,46 +9,70 @@ | ||
9 | */ | 9 | */ |
10 | 10 | ||
11 | Ext.define('amdaModel.DerivedParamNode', { | 11 | Ext.define('amdaModel.DerivedParamNode', { |
12 | - | ||
13 | extend: 'amdaModel.InteractiveNode', | 12 | extend: 'amdaModel.InteractiveNode', |
14 | 13 | ||
14 | + requires:[], | ||
15 | + | ||
15 | statics:{ | 16 | statics:{ |
16 | nodeType: 'derivedParam', | 17 | nodeType: 'derivedParam', |
17 | objectName: 'Parameter' | 18 | objectName: 'Parameter' |
18 | }, | 19 | }, |
19 | 20 | ||
20 | - constructor : function(config){ | 21 | + constructor : function(config){ |
21 | this.callParent(arguments); | 22 | this.callParent(arguments); |
22 | this.set('moduleId',myDesktopApp.dynamicModules.param.id); | 23 | this.set('moduleId',myDesktopApp.dynamicModules.param.id); |
23 | this.set('objectDataModel',amdaModel.Parameter.$className); | 24 | this.set('objectDataModel',amdaModel.Parameter.$className); |
24 | this.set('ownerTreeId',amdaUI.ExplorerUI.RESRC_TAB.TREE_ID); | 25 | this.set('ownerTreeId',amdaUI.ExplorerUI.RESRC_TAB.TREE_ID); |
25 | - if (this.get('leaf')) this.set('iconCls', 'icon-scalar'); | 26 | + if (this.get('isParameter')) { |
27 | + console.log(this); | ||
28 | + if( (this.get('dim_1') == 3 && this.get('dim_2') == 1) || (this.get('dim_1') == 1 && this.get('dim_2') == 3)){ | ||
29 | + this.set('iconCls', 'icon-vector'); | ||
30 | + } else if ( (this.get('dim_1') > 1 && this.get('dim_2') >=1)|| (this.get('dim_1') >=1 && this.get('dim_2') >1)) { | ||
31 | + this.set('iconCls','icon-spectra'); | ||
32 | + } else { | ||
33 | + this.set('iconCls', 'icon-unknowntype'); | ||
34 | + } | ||
35 | + } | ||
26 | }, | 36 | }, |
27 | 37 | ||
28 | - localMenuItems : function() { | ||
29 | - var menuItems = | ||
30 | - [{ | 38 | +localMenuItems : function() { |
39 | + var menuItems = | ||
40 | + [{ | ||
31 | fnId : 'leaf-plotParam', | 41 | fnId : 'leaf-plotParam', |
32 | - text : 'Plot Parameter', | ||
33 | - hidden : true | ||
34 | - }, { | ||
35 | - fnId : 'leaf-downParam', | ||
36 | - text : 'Download Parameter', | ||
37 | - hidden : true | ||
38 | - }]; | ||
39 | - return menuItems; | ||
40 | - }, | 42 | + text : 'Plot Parameter', |
43 | + hidden : true | ||
44 | + }, { | ||
45 | + fnId : 'leaf-downParam', | ||
46 | + text : 'Download Parameter', | ||
47 | + hidden : true | ||
48 | + }]; | ||
49 | + return menuItems; | ||
50 | +}, | ||
41 | 51 | ||
42 | - getAllContextMenuItems: function(){ | 52 | +getAllContextMenuItems: function(){ |
43 | 53 | ||
44 | - var menuItems = this.allMenuItems(); | ||
45 | - var locMenuItems = this.localMenuItems(); | 54 | + var menuItems = this.allMenuItems(); |
55 | + var locMenuItems = this.localMenuItems(); | ||
46 | 56 | ||
47 | - return Ext.Array.merge(menuItems,locMenuItems); | ||
48 | - }, | 57 | + return Ext.Array.merge(menuItems,locMenuItems); |
58 | +}, | ||
49 | 59 | ||
50 | - isParameter : function(){ | ||
51 | - return this.get('isParameter'); | ||
52 | - } | 60 | +isParameter : function(){ |
61 | + return this.get('isParameter'); | ||
62 | +}, | ||
63 | + | ||
64 | +specialUpdate : function(res, timeUpdate) { | ||
65 | + if (this.get('isParameter')) { | ||
66 | + console.log(this); | ||
67 | + if( (this.get('dim_1') == 3 && this.get('dim_2') == 1) || (this.get('dim_1') == 1 && this.get('dim_2') == 3)){ | ||
68 | + this.set('iconCls', 'icon-vector'); | ||
69 | + } else if ((this.get('dim_1') > 1 && this.get('dim_2') >= 1)|| (this.get('dim_1') >= 1 && this.get('dim_2') >1)) { | ||
70 | + this.set('iconCls','icon-spectra'); | ||
71 | + } else { | ||
72 | + this.set('iconCls', 'icon-unknowntype'); | ||
73 | + } | ||
74 | + } | ||
75 | + | ||
76 | +} | ||
53 | 77 | ||
54 | }); | 78 | }); |
js/app/models/InteractiveNode.js
@@ -203,7 +203,7 @@ Ext.define('amdaModel.InteractiveNode', { | @@ -203,7 +203,7 @@ Ext.define('amdaModel.InteractiveNode', { | ||
203 | this.set('info',res.info); | 203 | this.set('info',res.info); |
204 | } | 204 | } |
205 | 205 | ||
206 | - // myDataParam special update | 206 | + // myDataParam and Parameter special update |
207 | this.specialUpdate(res, false); | 207 | this.specialUpdate(res, false); |
208 | 208 | ||
209 | // reload object into the view of corresponding Module | 209 | // reload object into the view of corresponding Module |
js/app/models/Parameter.js
@@ -23,7 +23,9 @@ Ext.define('amdaModel.Parameter', { | @@ -23,7 +23,9 @@ Ext.define('amdaModel.Parameter', { | ||
23 | {name: 'units', type: 'string'}, | 23 | {name: 'units', type: 'string'}, |
24 | {name: 'buildchain', type: 'string'}, | 24 | {name: 'buildchain', type: 'string'}, |
25 | {name: 'description', type: 'string'}, | 25 | {name: 'description', type: 'string'}, |
26 | - {name: 'ytitle', type: 'string'} | 26 | + {name: 'ytitle', type: 'string'}, |
27 | + {name: 'dim_1', type: 'number'}, | ||
28 | + {name: 'dim_2', type: 'number'} | ||
27 | ], | 29 | ], |
28 | 30 | ||
29 | /** | 31 | /** |
@@ -49,6 +51,8 @@ Ext.define('amdaModel.Parameter', { | @@ -49,6 +51,8 @@ Ext.define('amdaModel.Parameter', { | ||
49 | if (this.get('units').match(/[a-z,0-9]/gi) != null) { | 51 | if (this.get('units').match(/[a-z,0-9]/gi) != null) { |
50 | myValues.units = this.get('units'); | 52 | myValues.units = this.get('units'); |
51 | } | 53 | } |
54 | + myValues.dim_1 = this.get('dim_1'); | ||
55 | + myValues.dim_2 = this.get('dim_2'); | ||
52 | myValues.nodeType = amdaModel.DerivedParamNode.nodeType; | 56 | myValues.nodeType = amdaModel.DerivedParamNode.nodeType; |
53 | return myValues; | 57 | return myValues; |
54 | } | 58 | } |
js/app/views/ExplorerUI.js
@@ -575,13 +575,13 @@ Ext.define('amdaUI.ExplorerUI', { | @@ -575,13 +575,13 @@ Ext.define('amdaUI.ExplorerUI', { | ||
575 | }); | 575 | }); |
576 | } | 576 | } |
577 | 577 | ||
578 | - if (record.isLeaf() || record.data.isParameter) | 578 | + if (record.isLeaf() || record.data.isParameter) |
579 | switch (record.get('nodeType')) | 579 | switch (record.get('nodeType')) |
580 | { | 580 | { |
581 | case 'myData' : | 581 | case 'myData' : |
582 | case 'myDataParam' : | 582 | case 'myDataParam' : |
583 | case 'derivedParam' : | 583 | case 'derivedParam' : |
584 | - case 'timeTable' : | 584 | + case 'timeTable' : |
585 | case 'sharedtimeTable' : | 585 | case 'sharedtimeTable' : |
586 | case 'sharedcatalog' : | 586 | case 'sharedcatalog' : |
587 | case 'catalog' : | 587 | case 'catalog' : |
js/app/views/ParameterUI.js
@@ -159,6 +159,46 @@ Ext.define('amdaUI.ParameterUI', | @@ -159,6 +159,46 @@ Ext.define('amdaUI.ParameterUI', | ||
159 | } | 159 | } |
160 | }); | 160 | }); |
161 | }, | 161 | }, |
162 | + | ||
163 | + | ||
164 | + | ||
165 | + /** | ||
166 | + * Generate info for parameter desplay | ||
167 | + */ | ||
168 | + generateParamInfo : function($action) | ||
169 | + { | ||
170 | + var me = this; | ||
171 | + var paramModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.param.id); | ||
172 | + | ||
173 | + var obj = { | ||
174 | + paramId : 'ws_'+this.object.get('name') | ||
175 | + }; | ||
176 | + AmdaAction.generateParamInfo(obj, function (result, e) { | ||
177 | + if (!result || !result.success) | ||
178 | + { | ||
179 | + if (result.message) | ||
180 | + myDesktopApp.warningMsg(result.message); | ||
181 | + else | ||
182 | + myDesktopApp.warningMsg('Unknown error during parameter compilation'); | ||
183 | + return; | ||
184 | + } | ||
185 | + | ||
186 | + paramModule.linkedNode.get('object').set('dim_1', parseInt(result.dimensions.dim_1)); | ||
187 | + paramModule.linkedNode.get('object').set('dim_2', parseInt(result.dimensions.dim_2)); | ||
188 | + console.log(me); | ||
189 | + paramModule.linkedNode.update({scope : me, | ||
190 | + failure: function(record, operation) { | ||
191 | + | ||
192 | + }, | ||
193 | + callback: function() { | ||
194 | + console.log(paramModule.linkedNode); | ||
195 | + } | ||
196 | + }); | ||
197 | + console.log(paramModule.linkedNode); | ||
198 | + | ||
199 | + }); | ||
200 | + }, | ||
201 | + | ||
162 | 202 | ||
163 | /** | 203 | /** |
164 | * save method called by Save button | 204 | * save method called by Save button |
@@ -188,13 +228,13 @@ Ext.define('amdaUI.ParameterUI', | @@ -188,13 +228,13 @@ Ext.define('amdaUI.ParameterUI', | ||
188 | this.object = paramobj; | 228 | this.object = paramobj; |
189 | if (toRename) paramModule.linkedNode.toRename = true; | 229 | if (toRename) paramModule.linkedNode.toRename = true; |
190 | } | 230 | } |
191 | - paramModule.linkedNode.create({scope : this, callback : this.compilParam}); | 231 | + paramModule.linkedNode.create({scope : this, callback : this.generateParamInfo}); |
192 | paramModule.linkedNode.set('iconCls', 'icon-scalar'); | 232 | paramModule.linkedNode.set('iconCls', 'icon-scalar'); |
193 | paramModule.linkedNode.set('isParameter', true); | 233 | paramModule.linkedNode.set('isParameter', true); |
194 | } else | 234 | } else |
195 | { | 235 | { |
196 | paramModule.linkedNode.set('contextNode',paramModule.contextNode); | 236 | paramModule.linkedNode.set('contextNode',paramModule.contextNode); |
197 | - paramModule.linkedNode.update({scope : this, callback : this.compilParam}); | 237 | + paramModule.linkedNode.update({scope : this, callback : this.generateParamInfo}); |
198 | } | 238 | } |
199 | } | 239 | } |
200 | }, | 240 | }, |
php/classes/AmdaAction.php
@@ -141,6 +141,8 @@ class AmdaAction | @@ -141,6 +141,8 @@ class AmdaAction | ||
141 | 141 | ||
142 | //TODO MAKE PROPERLY as function of nodetype !!!! | 142 | //TODO MAKE PROPERLY as function of nodetype !!!! |
143 | $info = ''; | 143 | $info = ''; |
144 | + $dim_1 = 1; | ||
145 | + $dim_2 = 1; | ||
144 | $id = $child->getAttribute('xml:id'); | 146 | $id = $child->getAttribute('xml:id'); |
145 | $name = $child->getAttribute('name'); | 147 | $name = $child->getAttribute('name'); |
146 | $help = $child->getAttribute('att'); | 148 | $help = $child->getAttribute('att'); |
@@ -206,6 +208,14 @@ class AmdaAction | @@ -206,6 +208,14 @@ class AmdaAction | ||
206 | break; | 208 | break; |
207 | case 'derivedParam': | 209 | case 'derivedParam': |
208 | $info = $child->getAttribute('buildchain'); | 210 | $info = $child->getAttribute('buildchain'); |
211 | + | ||
212 | + if ($child->hasAttribute('dim_1')) { | ||
213 | + $dim_1 = $child->getAttribute('dim_1'); | ||
214 | + } | ||
215 | + if ($child->hasAttribute('dim_2')) { | ||
216 | + $dim_2 = $child->getAttribute('dim_2'); | ||
217 | + } | ||
218 | + | ||
209 | if ($isLeaf) $isParameter = true; | 219 | if ($isLeaf) $isParameter = true; |
210 | break; | 220 | break; |
211 | 221 | ||
@@ -544,7 +554,7 @@ class AmdaAction | @@ -544,7 +554,7 @@ class AmdaAction | ||
544 | } | 554 | } |
545 | 555 | ||
546 | $childrenToReturn[] = array('text' => $name, 'id' => $id, 'nodeType' => $nodeType, 'info' => $info, | 556 | $childrenToReturn[] = array('text' => $name, 'id' => $id, 'nodeType' => $nodeType, 'info' => $info, |
547 | - 'help' => $help, 'leaf' => $isLeaf, 'isParameter' => $isParameter); | 557 | + 'help' => $help, 'leaf' => $isLeaf, 'isParameter' => $isParameter, 'dim_1' => $dim_1, 'dim_2' => $dim_2); |
548 | } | 558 | } |
549 | } | 559 | } |
550 | // if $childrenToReturn we have to return [] | 560 | // if $childrenToReturn we have to return [] |
@@ -764,7 +774,7 @@ class AmdaAction | @@ -764,7 +774,7 @@ class AmdaAction | ||
764 | if ($obj->nodeType == 'derivedParam' && $this->amdaStat->success) | 774 | if ($obj->nodeType == 'derivedParam' && $this->amdaStat->success) |
765 | $this->amdaStat->addTask($this->user, 'create', null); | 775 | $this->amdaStat->addTask($this->user, 'create', null); |
766 | $objectMgr = new DerivedParamMgr($obj->nodeType); | 776 | $objectMgr = new DerivedParamMgr($obj->nodeType); |
767 | - break; | 777 | + break; |
768 | case 'timeTable' : | 778 | case 'timeTable' : |
769 | $objectMgr = new TimeTableMgr(); | 779 | $objectMgr = new TimeTableMgr(); |
770 | break; | 780 | break; |
@@ -902,12 +912,13 @@ class AmdaAction | @@ -902,12 +912,13 @@ class AmdaAction | ||
902 | // Check user if access to DD Server and / or possible 'space consuming' action | 912 | // Check user if access to DD Server and / or possible 'space consuming' action |
903 | if ( $function == FunctionTypeEnumClass::PARAMS || | 913 | if ( $function == FunctionTypeEnumClass::PARAMS || |
904 | $function == FunctionTypeEnumClass::ACTION || | 914 | $function == FunctionTypeEnumClass::ACTION || |
905 | - $function == FunctionTypeEnumClass::PARAMSGEN ) | 915 | + $function == FunctionTypeEnumClass::PARAMSGEN || |
916 | + $function == FunctionTypeEnumClass::PARAMSINFOGEN ) | ||
906 | { | 917 | { |
907 | $res = $this->checkUser($obj); | 918 | $res = $this->checkUser($obj); |
908 | if (!$res['success']) return $res; | 919 | if (!$res['success']) return $res; |
909 | } | 920 | } |
910 | - | 921 | + |
911 | $requestManager = new RequestManagerClass(); | 922 | $requestManager = new RequestManagerClass(); |
912 | try { | 923 | try { |
913 | $res = $requestManager->runIHMRequest($this->user, !empty($res['userHost']) ? $res['userHost'] : NULL, $function, $obj); | 924 | $res = $requestManager->runIHMRequest($this->user, !empty($res['userHost']) ? $res['userHost'] : NULL, $function, $obj); |
@@ -941,9 +952,22 @@ class AmdaAction | @@ -941,9 +952,22 @@ class AmdaAction | ||
941 | */ | 952 | */ |
942 | public function compilParam($obj) | 953 | public function compilParam($obj) |
943 | { | 954 | { |
955 | +error_log(print_r($obj,TRUE)); | ||
944 | return $this->executeRequest($obj, FunctionTypeEnumClass::PARAMSGEN); | 956 | return $this->executeRequest($obj, FunctionTypeEnumClass::PARAMSGEN); |
945 | } | 957 | } |
946 | 958 | ||
959 | + | ||
960 | +/* | ||
961 | + * Generate parameter info for display (e.g size) | ||
962 | + */ | ||
963 | + public function generateParamInfo($obj) | ||
964 | + { | ||
965 | + return $this->executeRequest($obj, FunctionTypeEnumClass::PARAMSINFOGEN); | ||
966 | + } | ||
967 | + | ||
968 | + | ||
969 | + | ||
970 | + | ||
947 | /* | 971 | /* |
948 | * Delete derived parameter compilation | 972 | * Delete derived parameter compilation |
949 | */ | 973 | */ |
php/classes/DerivedParamMgr.php
@@ -19,7 +19,7 @@ class DerivedParamMgr extends AmdaObjectMgr | @@ -19,7 +19,7 @@ class DerivedParamMgr extends AmdaObjectMgr | ||
19 | $this->contentRootId = 'derivedParam-treeRootNode'; | 19 | $this->contentRootId = 'derivedParam-treeRootNode'; |
20 | $this->contentRootTag = 'paramList'; | 20 | $this->contentRootTag = 'paramList'; |
21 | //node attributes and object XML tags | 21 | //node attributes and object XML tags |
22 | - $this->attributes = array('name' => '', 'buildchain' => '', 'timestep' => ''); | 22 | + $this->attributes = array('name' => '', 'buildchain' => '', 'timestep' => '', 'dim_1' => '1', 'dim_2' => '1'); |
23 | // + tags in object XML | 23 | // + tags in object XML |
24 | $this->optionalAttributes = array('units' => 'undefined','description' => 'undefined', 'ytitle' => 'undefined'); | 24 | $this->optionalAttributes = array('units' => 'undefined','description' => 'undefined', 'ytitle' => 'undefined'); |
25 | $this->objTagName = 'param'; | 25 | $this->objTagName = 'param'; |
@@ -143,7 +143,7 @@ class DerivedParamMgr extends AmdaObjectMgr | @@ -143,7 +143,7 @@ class DerivedParamMgr extends AmdaObjectMgr | ||
143 | $this->createObjectDescription($p); | 143 | $this->createObjectDescription($p); |
144 | $this->addToContent($p, $folder); | 144 | $this->addToContent($p, $folder); |
145 | 145 | ||
146 | - return array('id' => $this->id, 'info' => $p->buildchain); | 146 | + return array('id' => $this->id, 'info' => $p->buildchain, 'dim_1' => $p->dim_1, 'dim_2' => $p->dim_2); |
147 | } | 147 | } |
148 | // myData parameter | 148 | // myData parameter |
149 | else | 149 | else |
php/classes/UserMgr.php
@@ -276,9 +276,9 @@ class UserMgr | @@ -276,9 +276,9 @@ class UserMgr | ||
276 | else { | 276 | else { |
277 | // totally rewrite | 277 | // totally rewrite |
278 | if ($base->hasAttribute('isSimulation')) { | 278 | if ($base->hasAttribute('isSimulation')) { |
279 | - $centerNode = $this->makeSimulationBase($baseId); | 279 | + /*$centerNode = $this->makeSimulationBase($baseId); |
280 | $center = new $baseId(); | 280 | $center = new $baseId(); |
281 | - $centerNode->setAttribute('available', $center->monitor()); | 281 | + $centerNode->setAttribute('available', $center->monitor());*/ |
282 | } | 282 | } |
283 | else { | 283 | else { |
284 | $center = new $baseId(); | 284 | $center = new $baseId(); |
@@ -353,10 +353,10 @@ class UserMgr | @@ -353,10 +353,10 @@ class UserMgr | ||
353 | protected function makeNewBase($baseId) | 353 | protected function makeNewBase($baseId) |
354 | { | 354 | { |
355 | // no data base description ; skip this data base | 355 | // no data base description ; skip this data base |
356 | - if (!@file_exists(RemoteData.$baseId.'/base.xml')) continue; | 356 | + if (!@file_exists(RemoteData.$baseId.'/base.xml')) return; |
357 | 357 | ||
358 | // can't read base.xml ; skip this data base | 358 | // can't read base.xml ; skip this data base |
359 | - if (!@$this->baseExtXml->load(RemoteData.$baseId.'/base.xml')) continue; | 359 | + if (!@$this->baseExtXml->load(RemoteData.$baseId.'/base.xml')) return; |
360 | 360 | ||
361 | $base = $this->paramMgr->basesDom->getElementById($baseId); | 361 | $base = $this->paramMgr->basesDom->getElementById($baseId); |
362 | 362 | ||
@@ -527,7 +527,7 @@ class UserMgr | @@ -527,7 +527,7 @@ class UserMgr | ||
527 | 527 | ||
528 | 528 | ||
529 | public function init() | 529 | public function init() |
530 | - { | 530 | + { |
531 | if ($this->ddLogin() != 0) | 531 | if ($this->ddLogin() != 0) |
532 | die('<h2>You are trying to log in as '.$this->user.'<br/> Please check that you entered a valid password</h2>'); | 532 | die('<h2>You are trying to log in as '.$this->user.'<br/> Please check that you entered a valid password</h2>'); |
533 | 533 | ||
@@ -573,11 +573,12 @@ class UserMgr | @@ -573,11 +573,12 @@ class UserMgr | ||
573 | $this->setPath(); | 573 | $this->setPath(); |
574 | 574 | ||
575 | $this->userGrps = $this->getUserGrps(); | 575 | $this->userGrps = $this->getUserGrps(); |
576 | - | 576 | + |
577 | if (!$this->makeLocalTree()) | 577 | if (!$this->makeLocalTree()) |
578 | die("Login for ".$this->user." failed: Can't make LocalParams.xml");; | 578 | die("Login for ".$this->user." failed: Can't make LocalParams.xml");; |
579 | - | ||
580 | - $ok = $this->makeRemoteTree(); | 579 | + //$ok = $this->makeRemoteTree(); |
580 | + | ||
581 | +//die("BRE"); | ||
581 | 582 | ||
582 | if (!file_exists(USERWSDIR.'Request.xml')) $reqMgr = new RequestMgr(); | 583 | if (!file_exists(USERWSDIR.'Request.xml')) $reqMgr = new RequestMgr(); |
583 | if (!file_exists(USERWSDIR.'Tt.xml')) $ttMgr = new TimeTableMgr(); | 584 | if (!file_exists(USERWSDIR.'Tt.xml')) $ttMgr = new TimeTableMgr(); |
php/config.php
@@ -147,6 +147,7 @@ $API = array( | @@ -147,6 +147,7 @@ $API = array( | ||
147 | 'execute'=>array('len'=>2), | 147 | 'execute'=>array('len'=>2), |
148 | //'formHandler'=>true | 148 | //'formHandler'=>true |
149 | 'compilParam'=>array('len'=>1), | 149 | 'compilParam'=>array('len'=>1), |
150 | + 'generateParamInfo'=>array('len'=>1), | ||
150 | 'compilParamDelete'=>array('len'=>1), | 151 | 'compilParamDelete'=>array('len'=>1), |
151 | 'killPlotRequest'=>array('len'=>0), | 152 | 'killPlotRequest'=>array('len'=>0), |
152 | 'merge'=>array('len'=>1), | 153 | 'merge'=>array('len'=>1), |