Commit 6ec889c4bd39db2b48ddca48e8194d4045898232
Exists in
master
and in
72 other branches
Merge branch 'develop' into amdadev
Showing
9 changed files
with
105 additions
and
37 deletions
Show diff stats
js/app/models/CatalogNode.js
... | ... | @@ -114,25 +114,5 @@ Ext.define('amdaModel.CatalogNode', { |
114 | 114 | module.setLinkedNode(me); |
115 | 115 | module.createWindow();*/ |
116 | 116 | //}); |
117 | - }, | |
118 | - generateTT: function(node){ | |
119 | - var catObj = Ext.create('amdaModel.TimeTable'); | |
120 | - var timeTabNode = Ext.create('amdaModel.TimeTableNode',{leaf : true}); | |
121 | - catObj.set('relatedCatalogId', node.get('id')); | |
122 | - desc = 'Generated by CDPP/Amda Catalog Module \n'; | |
123 | - if (node.get('description')) | |
124 | - desc = desc + node.get('description'); | |
125 | - catObj.set('description', desc); | |
126 | - timeTabNode.set('object',catObj); | |
127 | - var explorerTree = Ext.getCmp(amdaUI.ExplorerUI.RESRC_TAB.TREE_ID); | |
128 | - var ttRootNode = explorerTree.getRootNode().findChild('id', 'timeTable-treeRootNode', true); | |
129 | - amdaModel.InteractiveNode.preloadNodes(ttRootNode.getRootNode(), | |
130 | - function() | |
131 | - { | |
132 | - // edit newNode into Parameter Module with node as contextNode | |
133 | - timeTabNode.editInModule(); | |
134 | - }); | |
135 | - | |
136 | - | |
137 | - } | |
117 | + } | |
138 | 118 | }); | ... | ... |
js/app/models/InteractiveNode.js
... | ... | @@ -456,6 +456,12 @@ Ext.define('amdaModel.InteractiveNode', { |
456 | 456 | case 'downParam': |
457 | 457 | this.createDownload(this); |
458 | 458 | break; |
459 | + case 'generateCatalog': | |
460 | + this.generateCatalog(this); | |
461 | + break; | |
462 | + case 'generateTT': | |
463 | + this.generateTT(this); | |
464 | + break; | |
459 | 465 | default: |
460 | 466 | break; |
461 | 467 | } // switch end |
... | ... | @@ -761,5 +767,52 @@ Ext.define('amdaModel.InteractiveNode', { |
761 | 767 | myDesktopApp.errorMsg(t.action + "." + t.method + " : No parameter '" |
762 | 768 | + this.get('name') + "' found!"); |
763 | 769 | } |
764 | - } | |
770 | + }, | |
771 | + | |
772 | + generateCatalog: function(node){ | |
773 | + id = node.get('id'); | |
774 | + name = node.get('text'); | |
775 | + Ext.Msg.prompt('Create catalog', 'Enter the number of columns:', function (btn, text) { | |
776 | + if (btn == 'ok') { | |
777 | + var catObj = Ext.create('amdaModel.Catalog'); | |
778 | + var catNode = Ext.create('amdaModel.CatalogNode', {leaf: true}); | |
779 | + catObj.set('relatedTimeTableId', id); | |
780 | + //creatDate = new Date(this.object.get('created')); | |
781 | + //date = Ext.Date.format(creatDate, 'Y-m-d\\TH:i:s'); | |
782 | + descr = 'Generated by CDPP/Amda Time Table Module \n' + 'From Time Table: ' + name; | |
783 | + catObj.set('description', descr ); | |
784 | + var nbParam = parseInt(text); | |
785 | + if ((nbParam <= 0) || (nbParam > 100)) { | |
786 | + nbParam = 1; | |
787 | + } | |
788 | + catObj.set('nbParameters', nbParam); | |
789 | + catNode.set('object', catObj); | |
790 | + var explorerTree = Ext.getCmp(amdaUI.ExplorerUI.RESRC_TAB.TREE_ID); | |
791 | + var catRootNode = explorerTree.getRootNode().findChild('id', 'catalog-treeRootNode', true); | |
792 | + amdaModel.InteractiveNode.preloadNodes(catRootNode.getRootNode(), | |
793 | + function () | |
794 | + { | |
795 | + catNode.editInModule(); | |
796 | + }); | |
797 | + } | |
798 | + }, this); | |
799 | + }, | |
800 | + generateTT: function(node){ | |
801 | + var catObj = Ext.create('amdaModel.TimeTable'); | |
802 | + var timeTabNode = Ext.create('amdaModel.TimeTableNode',{leaf : true}); | |
803 | + catObj.set('relatedCatalogId', node.get('id')); | |
804 | + desc = 'Generated by CDPP/Amda Catalog Module \n'; | |
805 | + if (node.get('description')) | |
806 | + desc = desc + node.get('description'); | |
807 | + catObj.set('description', desc); | |
808 | + timeTabNode.set('object',catObj); | |
809 | + var explorerTree = Ext.getCmp(amdaUI.ExplorerUI.RESRC_TAB.TREE_ID); | |
810 | + var ttRootNode = explorerTree.getRootNode().findChild('id', 'timeTable-treeRootNode', true); | |
811 | + amdaModel.InteractiveNode.preloadNodes(ttRootNode.getRootNode(), | |
812 | + function() | |
813 | + { | |
814 | + timeTabNode.editInModule(); | |
815 | + }); | |
816 | + } | |
817 | + | |
765 | 818 | }); | ... | ... |
js/app/models/TimeTableNode.js
... | ... | @@ -41,6 +41,10 @@ Ext.define('amdaModel.TimeTableNode', { |
41 | 41 | fnId : 'leaf-operations', |
42 | 42 | text : 'Operations', |
43 | 43 | hidden : true |
44 | + },{ | |
45 | + fnId : 'leaf-generateCatalog', | |
46 | + text : 'Generate Catalog', | |
47 | + hidden : true | |
44 | 48 | }]; |
45 | 49 | |
46 | 50 | return menuItems; |
... | ... | @@ -96,6 +100,10 @@ Ext.define('amdaModel.TimeTableNode', { |
96 | 100 | this.ttOperations(); |
97 | 101 | break; |
98 | 102 | |
103 | + case 'generateCatalog': | |
104 | + this.generateCatalog(this); | |
105 | + break; | |
106 | + | |
99 | 107 | // case 'deleteMulti': |
100 | 108 | // this.deleteMulti(); |
101 | 109 | // break; |
... | ... | @@ -111,10 +119,6 @@ Ext.define('amdaModel.TimeTableNode', { |
111 | 119 | case 'visu': |
112 | 120 | this.visu(); |
113 | 121 | break; |
114 | - | |
115 | - case 'generateTT': | |
116 | - this.generateTT(this); | |
117 | - break; | |
118 | 122 | |
119 | 123 | default: |
120 | 124 | break; |
... | ... | @@ -158,5 +162,5 @@ Ext.define('amdaModel.TimeTableNode', { |
158 | 162 | Ext.Array.each(selection,function(item,index,allItems){ |
159 | 163 | item.ttOperations(); |
160 | 164 | }) |
161 | - } | |
165 | + } | |
162 | 166 | }); | ... | ... |
js/app/models/sharedCatalogNode.js
... | ... | @@ -32,7 +32,13 @@ Ext.define('amdaModel.sharedCatalogNode', { |
32 | 32 | fnId : 'leaf-editLeaf', |
33 | 33 | text : 'Edit Catalog', |
34 | 34 | hidden : true |
35 | - }]; | |
35 | + },{ | |
36 | + fnId : 'leaf-generateTT', | |
37 | + text : 'Generate Time Table ', | |
38 | + hidden : true | |
39 | + } | |
40 | + | |
41 | + ]; | |
36 | 42 | |
37 | 43 | return menuItems; |
38 | 44 | }, |
... | ... | @@ -40,5 +46,6 @@ Ext.define('amdaModel.sharedCatalogNode', { |
40 | 46 | getAllContextMenuItems: function(){ |
41 | 47 | |
42 | 48 | return this.localMenuItems(); |
43 | - } | |
49 | + } | |
50 | + | |
44 | 51 | }); | ... | ... |
js/app/models/sharedTimeTableNode.js
... | ... | @@ -31,6 +31,10 @@ Ext.define('amdaModel.sharedTimeTableNode', { |
31 | 31 | fnId : 'leaf-editLeaf', |
32 | 32 | text : 'Edit Time Table', |
33 | 33 | hidden : true |
34 | + },{ | |
35 | + fnId : 'leaf-generateCatalog', | |
36 | + text : 'Generate Catalog', | |
37 | + hidden : true | |
34 | 38 | }]; |
35 | 39 | |
36 | 40 | return menuItems; | ... | ... |
js/app/views/CatalogUI.js
... | ... | @@ -665,6 +665,9 @@ Ext.define('amdaUI.CatalogUI', { |
665 | 665 | AmdaAction.initObjectCache(this.isCatalog, this.object.get('nbParameters'), this.onAfterInit, this); |
666 | 666 | } else if (this.object.get('relatedTimeTableId') != '') { |
667 | 667 | // Generate Catalog from Time Table |
668 | + var pathern = this.object.get('relatedTimeTableId').split('_')[0]; | |
669 | + if (pathern == 'sharedtimeTable') | |
670 | + typeTT='sharedtimeTable'; | |
668 | 671 | AmdaAction.initObjectCacheFromTimeTable(this.object.get('relatedTimeTableId'), typeTT, this.object.get('nbParameters'), this.onAfterInit, this); |
669 | 672 | } else { |
670 | 673 | //From existing TT file |
... | ... | @@ -1095,7 +1098,7 @@ Ext.define('amdaUI.CatalogUI', { |
1095 | 1098 | xtype: 'toolbar', |
1096 | 1099 | dock: 'bottom', |
1097 | 1100 | ui: 'footer', |
1098 | - height: 140, | |
1101 | + height: 120, | |
1099 | 1102 | |
1100 | 1103 | items: [ |
1101 | 1104 | { | ... | ... |
php/classes/AmdaAction.php
... | ... | @@ -197,7 +197,16 @@ class AmdaAction |
197 | 197 | } |
198 | 198 | break; |
199 | 199 | case 'derivedParam': |
200 | - $info = $child->getAttribute('buildchain'); | |
200 | + $info = $child->getAttribute('buildchain').'<br/>'; | |
201 | + | |
202 | + if($child->hasAttribute('units') && $child->getAttribute('units') != 'undefined' && $child->getAttribute('units') != '') | |
203 | + $info .= 'Units: '.$child->getAttribute('units').'<br/>'; | |
204 | + $samplingMode = $child->getAttribute('sampling_mode'); | |
205 | + if($samplingMode == 'timestep'){ | |
206 | + $info .= 'Sampling Time: '.$child->getAttribute('timestep'); | |
207 | + }else if($samplingMode == 'refparam'){ | |
208 | + $info .= 'Reference Parameter: '.$child->getAttribute('reference_param'); | |
209 | + } | |
201 | 210 | |
202 | 211 | if ($child->hasAttribute('dim_1')) { |
203 | 212 | $dim_1 = $child->getAttribute('dim_1'); |
... | ... | @@ -1127,7 +1136,7 @@ class AmdaAction |
1127 | 1136 | { |
1128 | 1137 | $cacheMgr = new CatalogCacheMgr(); |
1129 | 1138 | |
1130 | - return $cacheMgr->initFromTimeTable($id, $nparams); | |
1139 | + return $cacheMgr->initFromTimeTable($id, $nparams, $type); | |
1131 | 1140 | } |
1132 | 1141 | |
1133 | 1142 | public function initObjectCacheFromTmpObject($folderId, $name, $isCatalog = false) | ... | ... |
php/classes/CatalogCacheMgr.php
... | ... | @@ -70,12 +70,12 @@ class CatalogCacheMgr extends TimeTableCacheMgr |
70 | 70 | return $result+ array('parameters' => $info['parameters']); |
71 | 71 | } |
72 | 72 | |
73 | - public function initFromTimeTable($id, $nbParams) | |
73 | + public function initFromTimeTable($id, $nbParams, $type) | |
74 | 74 | { |
75 | 75 | |
76 | 76 | $params = $this->resetCache(array('nparams' => $nbParams)); |
77 | 77 | $ttMgr= new TimeTableMgr(); |
78 | - $intervals_res = $ttMgr->loadIntervalsFromObject($id); | |
78 | + $intervals_res = $ttMgr->loadIntervalsFromObject($id, $type); | |
79 | 79 | |
80 | 80 | if (!$intervals_res['success']) |
81 | 81 | return $intervals_res; | ... | ... |
php/classes/DerivedParamMgr.php
... | ... | @@ -19,9 +19,9 @@ class DerivedParamMgr extends AmdaObjectMgr |
19 | 19 | $this->contentRootId = 'derivedParam-treeRootNode'; |
20 | 20 | $this->contentRootTag = 'paramList'; |
21 | 21 | //node attributes and object XML tags |
22 | - $this->attributes = array('name' => '', 'buildchain' => '', 'timestep' => '', 'dim_1' => '1', 'dim_2' => '1'); | |
22 | + $this->attributes = array('name' => '', 'buildchain' => '', 'timestep' => '', 'dim_1' => '1', 'dim_2' => '1', 'units'=>'undefined', 'sampling_mode'=>'', 'reference_param'=>''); | |
23 | 23 | // + tags in object XML |
24 | - $this->optionalAttributes = array('units' => 'undefined','description' => 'undefined', 'ytitle' => 'undefined'); | |
24 | + $this->optionalAttributes = array('description' => 'undefined', 'ytitle' => 'undefined'); | |
25 | 25 | $this->objTagName = 'param'; |
26 | 26 | $this->id_prefix = 'ws_'; |
27 | 27 | } |
... | ... | @@ -143,8 +143,16 @@ class DerivedParamMgr extends AmdaObjectMgr |
143 | 143 | // switch between myData and Derived |
144 | 144 | $this->createObjectDescription($p); |
145 | 145 | $this->addToContent($p, $folder); |
146 | + $info = $p->buildchain.'<br/>'; | |
147 | + if(isset($p->units) && $p->units != "undefined") | |
148 | + $info .= 'Units: '.$p->units.'<br/>'; | |
149 | + if($p->sampling_mode == 'timestep'){ | |
150 | + $info .= 'Sampling Time: '.$p->timestep; | |
151 | + }else if($p->sampling_mode == 'refparam'){ | |
152 | + $info .= 'Reference Parameter: '.$p->reference_param; | |
153 | + } | |
146 | 154 | |
147 | - return array('id' => $this->id, 'info' => $p->buildchain, 'dim_1' => $p->dim_1, 'dim_2' => $p->dim_2, 'last_update' => $p->last_update); | |
155 | + return array('id' => $this->id, 'info' => $info, 'dim_1' => $p->dim_1, 'dim_2' => $p->dim_2, 'last_update' => $p->last_update); | |
148 | 156 | } |
149 | 157 | // myData parameter |
150 | 158 | else | ... | ... |