Commit 92927f6dbebcd2aed5b9fab9f8f643f06670428a
Exists in
master
and in
95 other branches
Merge branch 'master' of https://gitlab.irap.omp.eu/CDPP/AMDA_IHM
Showing
17 changed files
with
537 additions
and
244 deletions
Show diff stats
... | ... | @@ -0,0 +1,8 @@ |
1 | +<h2>Catalogue statistical information</h2> | |
2 | +When hitting the <b>"Apply"</b> button the following data on the edited catalogue are computed from the list of intervals :</br></br> | |
3 | +<ul> | |
4 | +<li>The <b>minimum</b> and <b>maximum</b> durations with corresponding intervals (following the '--' signs)</li></br> | |
5 | +<li>The <b>mean</b>, <b>the standard deviation (St. dev)</b> and the <b>median</b> of interval durations</li><br/> | |
6 | +<li>The <b>density</b> of the catalogue in the global time span : this is the ratio of the sum of all interval durations over the global time span, i.e. the duration of the interval starting with the min 'Start' and finishing with the max 'Stop'.</li> | |
7 | +</ul> | |
8 | +The <b>density</b> is an indication of the occurrence frequency of the event described in a catalogue. | |
... | ... |
help/statisticalHelp renamed to help/statisticalHelptimeTableUi
js/app/models/Catalog.js
... | ... | @@ -14,7 +14,8 @@ Ext.define('amdaModel.Catalog', { |
14 | 14 | extend: 'amdaModel.TimeTable', |
15 | 15 | |
16 | 16 | fields : [ |
17 | - { name: 'parameters' } | |
17 | + { name: 'parameters' }, | |
18 | + { name: 'nbParameters', type: 'int', defaultValue: 1} | |
18 | 19 | ], |
19 | 20 | |
20 | 21 | getJsonValues : function (hasId) { |
... | ... | @@ -46,4 +47,4 @@ Ext.define('amdaModel.Catalog', { |
46 | 47 | |
47 | 48 | |
48 | 49 | |
49 | -}); | |
50 | 50 | \ No newline at end of file |
51 | +}); | |
... | ... |
js/app/models/CatalogNode.js
... | ... | @@ -39,7 +39,12 @@ Ext.define('amdaModel.CatalogNode', { |
39 | 39 | fnId : 'leaf-visu', |
40 | 40 | text : 'Visualize '+ this.self.objectName, |
41 | 41 | hidden : true |
42 | - }]; | |
42 | + },{ | |
43 | + fnId : 'leaf-generateTT', | |
44 | + text : 'Generate Time Table ', | |
45 | + hidden : true | |
46 | + } | |
47 | + ]; | |
43 | 48 | |
44 | 49 | return menuItems; |
45 | 50 | }, |
... | ... | @@ -73,5 +78,25 @@ Ext.define('amdaModel.CatalogNode', { |
73 | 78 | module.setLinkedNode(me); |
74 | 79 | module.createWindow(); |
75 | 80 | }); |
76 | - } | |
81 | + }, | |
82 | + generateTT: function(node){ | |
83 | + var catObj = Ext.create('amdaModel.TimeTable'); | |
84 | + var timeTabNode = Ext.create('amdaModel.TimeTableNode',{leaf : true}); | |
85 | + catObj.set('relatedCatalogId', node.get('id')); | |
86 | + desc = 'Generated by CDPP/Amda Catalog Module \n'; | |
87 | + if (node.get('description')) | |
88 | + desc = desc + node.get('description'); | |
89 | + catObj.set('description', desc); | |
90 | + timeTabNode.set('object',catObj); | |
91 | + var explorerTree = Ext.getCmp(amdaUI.ExplorerUI.RESRC_TAB.TREE_ID); | |
92 | + var ttRootNode = explorerTree.getRootNode().findChild('id', 'timeTable-treeRootNode', true); | |
93 | + amdaModel.InteractiveNode.preloadNodes(ttRootNode.getRootNode(), | |
94 | + function() | |
95 | + { | |
96 | + // edit newNode into Parameter Module with node as contextNode | |
97 | + timeTabNode.editInModule(); | |
98 | + }); | |
99 | + | |
100 | + | |
101 | + } | |
77 | 102 | }); |
... | ... |
js/app/models/InteractiveNode.js
... | ... | @@ -778,6 +778,7 @@ Ext.define('amdaModel.InteractiveNode', { |
778 | 778 | this.set('object',paramObj); |
779 | 779 | // Edition of parameter into parameter Module |
780 | 780 | this.editInModule(null, this.onReady); |
781 | + this.onReady = null; | |
781 | 782 | } |
782 | 783 | else { |
783 | 784 | // EXCEPTION : parameter not found !? |
... | ... |
js/app/models/TimeTable.js
... | ... | @@ -121,15 +121,16 @@ Ext.define('amdaModel.TimeTable', { |
121 | 121 | extend: 'amdaModel.AmdaObject', |
122 | 122 | |
123 | 123 | fields : [ |
124 | - {name: 'fromPlugin', type: 'boolean', defaultValue: false}, | |
124 | + {name: 'fromPlugin', type: 'boolean', defaultValue: false}, | |
125 | 125 | {name: 'created', type: 'date'}, |
126 | 126 | {name: 'description', type: 'string'}, |
127 | 127 | {name: 'history', type: 'string'}, |
128 | 128 | {name: 'nbIntervals', type: 'int'}, |
129 | 129 | {name: 'objName', type: 'string', defaultValue: ""}, |
130 | 130 | {name: 'objFormat', type: 'string', defaultValue: ""}, |
131 | - {name: 'folderId', type: 'string', defaultValue: ""}, | |
132 | - {name: 'cacheToken', type: 'string', defaultValue: ""} | |
131 | + {name: 'folderId', type: 'string', defaultValue: ""}, | |
132 | + {name: 'cacheToken', type: 'string', defaultValue: ""}, | |
133 | + {name: 'relatedCatalogId', type: 'string', defaultValue: ""} | |
133 | 134 | ], |
134 | 135 | |
135 | 136 | /*commit: function(){ |
... | ... |
js/app/models/TimeTableNode.js
js/app/views/CatalogUI.js
... | ... | @@ -12,7 +12,8 @@ Ext.define('amdaUI.CatalogUI', { |
12 | 12 | alias: 'widget.panelCatalog', |
13 | 13 | |
14 | 14 | requires: [ |
15 | - 'Ext.grid.plugin.BufferedRenderer' | |
15 | + 'Ext.grid.plugin.BufferedRenderer', | |
16 | + 'amdaUI.StatisticalPlug' | |
16 | 17 | ], |
17 | 18 | |
18 | 19 | isCatalog : true, |
... | ... | @@ -46,8 +47,11 @@ Ext.define('amdaUI.CatalogUI', { |
46 | 47 | // show this column |
47 | 48 | item.show(); |
48 | 49 | } |
49 | - }); | |
50 | - | |
50 | + }); | |
51 | + // fire the refresh event (to statistical plugin) | |
52 | + this.fireEvent("refresh"); | |
53 | + // global event | |
54 | + myDesktopApp.EventManager.fireEvent("refresh"); | |
51 | 55 | }, |
52 | 56 | |
53 | 57 | /** |
... | ... | @@ -59,7 +63,8 @@ Ext.define('amdaUI.CatalogUI', { |
59 | 63 | params[index] = item; |
60 | 64 | }, this); |
61 | 65 | |
62 | - this.object.set('parameters', params); | |
66 | + this.object.set('parameters', params); | |
67 | + this.object.set('nbParameters', params.length); | |
63 | 68 | }, |
64 | 69 | |
65 | 70 | /** |
... | ... | @@ -88,12 +93,50 @@ Ext.define('amdaUI.CatalogUI', { |
88 | 93 | // return the update status |
89 | 94 | return updateStatus; |
90 | 95 | }, |
96 | + | |
97 | + addInterval : function(start, stop) { | |
98 | + var row = this.TTGrid.getStore().getTotalCount(); | |
99 | + var me = this; | |
100 | + this.TTGrid.getSelectionModel().deselectAll(); | |
101 | + AmdaAction.addTTCacheInterval({'start' : start, 'stop' : stop, 'index' : row, 'isCatalog' : true},function (result, e) { | |
102 | + this.status = result.status; | |
103 | + if (!this.TTGrid.getStore().loading) { | |
104 | + this.TTGrid.getStore().reload({ | |
105 | + callback : function(records, options, success) { | |
106 | + me.TTGrid.getView().bufferedRenderer.scrollTo(row, false, function() { | |
107 | + me.TTGrid.getView().select(row); | |
108 | + }, me); | |
109 | + } | |
110 | + }); | |
111 | + } | |
112 | + }, this); | |
113 | + }, | |
91 | 114 | |
92 | 115 | updateCount : function() { |
93 | 116 | this.object.set('nbIntervals',this.TTGrid.getStore().getTotalCount()); |
94 | 117 | this.formPanel.getForm().findField('nbIntervals').setValue(this.object.get('nbIntervals')); |
95 | 118 | }, |
96 | - | |
119 | + generateTT : function(catId){ | |
120 | + var catObj = Ext.create('amdaModel.TimeTable'); | |
121 | + var timeTabNode = Ext.create('amdaModel.TimeTableNode',{leaf : true}); | |
122 | + catObj.set('relatedCatalogId', catId) | |
123 | + creatDate=new Date(this.object.get('created')); | |
124 | + date=Ext.Date.format(creatDate,'Y-m-d\\TH:i:s'); | |
125 | + descr='Generated by CDPP/Amda Catalog Module \n'+ 'From Catalog: '+this.object.get('name')+'\nOn: '+date+'\n'; | |
126 | + catObj.set('description', descr+this.object.get('description')); | |
127 | + timeTabNode.set('object',catObj); | |
128 | + var explorerTree = Ext.getCmp(amdaUI.ExplorerUI.RESRC_TAB.TREE_ID); | |
129 | + var ttRootNode = explorerTree.getRootNode().findChild('id', 'timeTable-treeRootNode', true); | |
130 | + amdaModel.InteractiveNode.preloadNodes(ttRootNode.getRootNode(), | |
131 | + function() | |
132 | + { | |
133 | + // edit newNode into Parameter Module with node as contextNode | |
134 | + timeTabNode.editInModule(); | |
135 | + }); | |
136 | + | |
137 | + | |
138 | + | |
139 | + }, | |
97 | 140 | onAfterInit: function(result, e) |
98 | 141 | { |
99 | 142 | var me = this; |
... | ... | @@ -116,176 +159,228 @@ Ext.define('amdaUI.CatalogUI', { |
116 | 159 | |
117 | 160 | if (me.toReconfigure) |
118 | 161 | { |
119 | - var fields = [], columns = [], width, index; | |
120 | 162 | var fieldsConfig = [ |
121 | - { name : 'start', | |
122 | - convert: function(value,rec) { | |
123 | - if (!Ext.isDate(value)){ | |
124 | - var valueString = new String(value); | |
125 | - var date = new Date(valueString.replace(/\-/g,'\/').replace(/[T|Z]/g,' ')); | |
126 | - return Ext.Date.format(date,'Y-m-d\\TH:i:s'); | |
127 | - } | |
128 | - return value; | |
129 | - } | |
130 | - }, | |
131 | - { name : 'stop', | |
132 | - convert: function(value,rec) { | |
133 | - if (!Ext.isDate(value)){ | |
134 | - var valueString = new String(value); | |
135 | - var date = new Date(valueString.replace(/\-/g,'\/').replace(/[T|Z]/g,' ')); | |
136 | - | |
137 | - return Ext.Date.format(date,'Y-m-d\\TH:i:s'); | |
138 | - } | |
139 | - return value; | |
140 | - } | |
141 | - }, | |
142 | - {name:'durationHour', | |
143 | - convert: function(value, rec){ | |
144 | - starteDate=rec.get('start') ;stopDate=rec.get('stop') ; | |
145 | - | |
146 | - d1=new Date(rec.get('start')); | |
147 | - d2=new Date(rec.get('stop')); | |
148 | - if (d1 && d2 && (d2-d1>=0)) { | |
149 | - return (d2-d1)/3600000.0; | |
150 | - } | |
151 | - }, | |
152 | - }, | |
153 | - { | |
154 | - name: 'durationMin', | |
155 | - type: 'float', | |
156 | - convert: function(value, rec){ | |
157 | - d1=new Date(rec.get('start')); | |
158 | - d2=new Date(rec.get('stop')); | |
159 | - if (d1 && d2 && (d2-d1>=0)) { | |
160 | - return (d2-d1)/60000.0; | |
161 | - } | |
162 | - }, | |
163 | - persist: false, | |
164 | - | |
165 | - }, | |
166 | - { | |
167 | - name: 'durationSec', | |
168 | - type: 'float', | |
169 | - convert: function(value, rec){ | |
170 | - d1=new Date(rec.get('start')); | |
171 | - d2=new Date(rec.get('stop')); | |
172 | - if (d1 && d2 && (d2-d1>=0)) { | |
173 | - return (d2-d1)/1000.0; | |
174 | - } | |
175 | - }, | |
176 | - persist: false, | |
177 | - | |
178 | - }, | |
179 | - { name: 'cacheId', type : 'int'}, | |
180 | - { name: 'isNew', type : 'boolean', defaultValue: false }, | |
181 | - { name: 'isModified', type : 'boolean', defaultValue: false} | |
182 | - ]; | |
183 | - | |
184 | - | |
185 | - | |
186 | - columns[0] = Ext.create('Ext.grid.column.RowNumberer', { width: 50, | |
187 | - renderer: function(value, metaData, record){ | |
188 | - var msg = record.index + 1; | |
189 | - if (record.get('isNew') || record.get('isModified')) { | |
190 | - msg += ' *'; | |
191 | - metaData.style = 'font-weight: bold' | |
192 | - } | |
193 | - return msg; | |
194 | - } | |
195 | - }); | |
196 | - columns[1] = Ext.create('Ext.grid.column.Column', { text: 'Start Time', sortable : true, dataIndex: 'start', | |
197 | - width : 120, menuDisabled: false, editor : { xtype:'datefield', allowBlank:false, hideTrigger: true, format : 'Y-m-d\\TH:i:s'}}); | |
198 | - columns[2] = Ext.create('Ext.grid.column.Column', { text: 'Stop Time', sortable : true, dataIndex: 'stop', | |
199 | - width : 120, menuDisabled: false, editor : { xtype:'datefield', allowBlank:false, hideTrigger: true, format : 'Y-m-d\\TH:i:s'}}); | |
200 | - columns[3] = Ext.create('Ext.grid.column.Column', { text: 'Duration (hour)', sortable : true, dataIndex: 'durationHour', | |
201 | - width : 120, menuDisabled: false, | |
202 | - hidden:true, | |
203 | - id: amdaUI.CatalogUI.COL_TO_HIDE_DURATION+'1', | |
204 | - renderer: function(value) { | |
205 | - return Ext.util.Format.number(value,'0.00'); | |
206 | - }, | |
207 | - listeners: { | |
208 | - beforeshow : function(){ | |
209 | - Ext.Array.each(this.ownerCt.getGridColumns(), function(item,index,all){ | |
210 | - // if item is a column to hide automatically | |
211 | - if ( Ext.util.Format.substr(item.id, 0, amdaUI.CatalogUI.COL_TO_HIDE_DURATION.length) == amdaUI.CatalogUI.COL_TO_HIDE_DURATION ) { | |
212 | - // if item isn't the column which is being declared and is not hidden | |
213 | - if ( item.id != amdaUI.CatalogUI.COL_TO_HIDE_DURATION+'1' && !item.isHidden() ){ | |
214 | - // hide this column | |
215 | - item.hide(); | |
216 | - } | |
217 | - } | |
218 | - }); | |
219 | - } | |
220 | - }}); | |
221 | - columns[4] = Ext.create('Ext.grid.column.Column', { text: 'Duration (Min)', sortable : true, dataIndex: 'durationMin', | |
222 | - width : 120, menuDisabled: false, | |
223 | - hidden:false, | |
224 | - id: amdaUI.CatalogUI.COL_TO_HIDE_DURATION+'2', | |
225 | - renderer: function(value) { | |
226 | - return Ext.util.Format.number(value,'0.00'); | |
227 | - }, | |
228 | - listeners: { | |
229 | - beforeshow : function(){ | |
230 | - Ext.Array.each(this.ownerCt.getGridColumns(), function(item,index,all){ | |
231 | - // if item is a column to hide automatically | |
232 | - if ( Ext.util.Format.substr(item.id, 0, amdaUI.CatalogUI.COL_TO_HIDE_DURATION.length) == amdaUI.CatalogUI.COL_TO_HIDE_DURATION ) { | |
233 | - // if item isn't the column which is being declared and is not hidden | |
234 | - if ( item.id != amdaUI.CatalogUI.COL_TO_HIDE_DURATION+'2' && !item.isHidden() ){ | |
235 | - // hide this column | |
236 | - item.hide(); | |
237 | - } | |
238 | - } | |
239 | - }); | |
240 | - } | |
241 | - }}); | |
242 | - columns[5] = Ext.create('Ext.grid.column.Column', { text: 'Duration (Sec)', sortable : true, dataIndex: 'durationSec', | |
243 | - width : 120, menuDisabled: false,hidden:true, | |
244 | - id: amdaUI.CatalogUI.COL_TO_HIDE_DURATION+'3', | |
245 | - renderer: function(value) { | |
246 | - return Ext.util.Format.number(value,'0.00'); | |
247 | - }, | |
248 | - listeners: { | |
249 | - beforeshow : function(){ | |
250 | - Ext.Array.each(this.ownerCt.getGridColumns(), function(item,index,all){ | |
251 | - // if item is a column to hide automatically | |
252 | - if ( Ext.util.Format.substr(item.id, 0, amdaUI.CatalogUI.COL_TO_HIDE_DURATION.length) == amdaUI.CatalogUI.COL_TO_HIDE_DURATION ) { | |
253 | - // if item isn't the column which is being declared and is not hidden | |
254 | - if ( item.id != amdaUI.CatalogUI.COL_TO_HIDE_DURATION+'3' && !item.isHidden() ){ | |
255 | - // hide this column | |
256 | - item.hide(); | |
257 | - } | |
258 | - } | |
259 | - }); | |
260 | - } | |
261 | - } | |
262 | - }); | |
163 | + { | |
164 | + name : 'start', | |
165 | + type : 'date', | |
166 | + dateFormat: 'Y-m-d\\TH:i:s', | |
167 | + convert: function(value,rec) { | |
168 | + if (!Ext.isDate(value)){ | |
169 | + var valueString = new String(value); | |
170 | + return new Date(valueString.replace(/\-/g,'\/').replace(/[T|Z]/g,' ')); | |
171 | + } | |
172 | + return value; | |
173 | + } | |
174 | + }, | |
175 | + { | |
176 | + name : 'stop', | |
177 | + type : 'date', | |
178 | + dateFormat: 'Y-m-d\\TH:i:s', | |
179 | + convert: function(value,rec) { | |
180 | + if (!Ext.isDate(value)){ | |
181 | + var valueString = new String(value); | |
182 | + return new Date(valueString.replace(/\-/g,'\/').replace(/[T|Z]/g,' ')); | |
183 | + } | |
184 | + return value; | |
185 | + } | |
186 | + }, | |
187 | + { | |
188 | + name:'durationHour', | |
189 | + type: 'float', | |
190 | + convert: function(value, rec){ | |
191 | + if (rec.get('stop') && rec.get('start') && (rec.get('stop')-rec.get('start'))>=0) { | |
192 | + return (rec.get('stop') - rec.get('start'))/3600000.0; | |
193 | + } | |
194 | + }, | |
195 | + persist: false | |
196 | + }, | |
197 | + { | |
198 | + name: 'durationMin', | |
199 | + type: 'float', | |
200 | + convert: function(value, rec){ | |
201 | + if (rec.get('stop') && rec.get('start') && (rec.get('stop')-rec.get('start'))>=0) { | |
202 | + return (rec.get('stop') - rec.get('start'))/60000.0; | |
203 | + } | |
204 | + }, | |
205 | + persist: false | |
206 | + }, | |
207 | + { | |
208 | + name: 'durationSec', | |
209 | + type: 'float', | |
210 | + convert: function(value, rec){ | |
211 | + if (rec.get('stop') && rec.get('start') && (rec.get('stop')-rec.get('start'))>=0) { | |
212 | + return (rec.get('stop') - rec.get('start'))/1000.0; | |
213 | + } | |
214 | + }, | |
215 | + persist: false | |
216 | + }, | |
217 | + { name: 'cacheId', type : 'int'}, | |
218 | + { name: 'isNew', type : 'boolean', defaultValue: false }, | |
219 | + { name: 'isModified', type : 'boolean', defaultValue: false} | |
220 | + ]; | |
263 | 221 | |
264 | - i=columns.length | |
265 | - columsTotalNumber=columns.length+2 | |
266 | - for (var j = 0; j < columsTotalNumber; j++) fields[j] = Ext.create('Ext.data.Field', fieldsConfig[j]); | |
267 | - | |
268 | - Ext.Array.each(result.parameters, function(obj) | |
269 | - { | |
270 | - index = 'param'+(i-4).toString(); | |
222 | + var updateDurationColumnsVisibility = function(columns, visibleId) { | |
223 | + Ext.Array.each(columns, function(item,index){ | |
224 | + // if item is a column to hide automatically | |
225 | + if ( Ext.util.Format.substr(item.id, 0, amdaUI.CatalogUI.COL_TO_HIDE_DURATION.length) == amdaUI.CatalogUI.COL_TO_HIDE_DURATION ) { | |
226 | + // if item isn't the column which is being declared and is not hidden | |
227 | + if ( item.id != visibleId && !item.isHidden() ){ | |
228 | + // hide this column | |
229 | + item.hide(); | |
230 | + } | |
231 | + } | |
232 | + }); | |
233 | + }; | |
271 | 234 | |
272 | - fields[i+2] = Ext.create('Ext.data.Field',{ name : index }); | |
273 | - | |
274 | - if (obj.type == 1) // dateTime | |
235 | + var columnsConfig = [ | |
275 | 236 | { |
276 | - columns[i] = Ext.create('Ext.grid.column.Column', { text: obj.name, sortable : true, dataIndex: index, | |
277 | - width : 120, menuDisabled: false, editor : { xtype:'datefield', allowBlank:false, hideTrigger: true, format : 'Y-m-d\\TH:i:s'}}); | |
237 | + xtype: 'rownumberer', | |
238 | + width: 50, | |
239 | + renderer: function(value, metaData, record){ | |
240 | + var msg = record.index + 1; | |
241 | + if (record.get('isNew') || record.get('isModified')) { | |
242 | + msg += ' *'; | |
243 | + metaData.style = 'font-weight: bold' | |
244 | + } | |
245 | + return msg; | |
246 | + } | |
247 | + }, | |
248 | + { | |
249 | + xtype: 'datecolumn', | |
250 | + text: 'Start Time', | |
251 | + format: 'Y-m-d\\TH:i:s', | |
252 | + sortable : true, | |
253 | + dataIndex: 'start', | |
254 | + width : 120, | |
255 | + menuDisabled: false, | |
256 | + editor : { | |
257 | + xtype:'datefield', | |
258 | + allowBlank:false, | |
259 | + hideTrigger: true, | |
260 | + format : 'Y-m-d\\TH:i:s' | |
261 | + } | |
262 | + }, | |
263 | + { | |
264 | + xtype: 'datecolumn', | |
265 | + text: 'Stop Time', | |
266 | + format: 'Y-m-d\\TH:i:s', | |
267 | + sortable : true, | |
268 | + dataIndex: 'stop', | |
269 | + width : 120, | |
270 | + menuDisabled: false, | |
271 | + editor : { | |
272 | + xtype:'datefield', | |
273 | + allowBlank:false, | |
274 | + hideTrigger: true, | |
275 | + format : 'Y-m-d\\TH:i:s' | |
276 | + } | |
277 | + }, | |
278 | + { | |
279 | + xtype: 'gridcolumn', | |
280 | + text: 'Duration (hour)', | |
281 | + sortable : true, | |
282 | + dataIndex: 'durationHour', | |
283 | + width : 120, | |
284 | + menuDisabled: false, | |
285 | + hidden:true, | |
286 | + id: amdaUI.CatalogUI.COL_TO_HIDE_DURATION+'1', | |
287 | + renderer: function(value) { | |
288 | + return Ext.util.Format.number(value,'0.00'); | |
289 | + }, | |
290 | + listeners: { | |
291 | + beforeshow : function(){ | |
292 | + updateDurationColumnsVisibility(this.ownerCt.getGridColumns(), amdaUI.CatalogUI.COL_TO_HIDE_DURATION+'1'); | |
293 | + } | |
294 | + } | |
295 | + }, | |
296 | + { | |
297 | + xtype: 'gridcolumn', | |
298 | + text: 'Duration (Min)', | |
299 | + sortable : true, | |
300 | + dataIndex: 'durationMin', | |
301 | + width : 120, | |
302 | + menuDisabled: false, | |
303 | + hidden:false, | |
304 | + id: amdaUI.CatalogUI.COL_TO_HIDE_DURATION+'2', | |
305 | + renderer: function(value) { | |
306 | + return Ext.util.Format.number(value,'0.00'); | |
307 | + }, | |
308 | + listeners: { | |
309 | + beforeshow : function(){ | |
310 | + updateDurationColumnsVisibility(this.ownerCt.getGridColumns(), amdaUI.CatalogUI.COL_TO_HIDE_DURATION+'2'); | |
311 | + } | |
312 | + } | |
313 | + }, | |
314 | + { | |
315 | + xtype: 'gridcolumn', | |
316 | + text: 'Duration (Sec)', | |
317 | + sortable : true, | |
318 | + dataIndex: 'durationSec', | |
319 | + width : 120, | |
320 | + menuDisabled: false, | |
321 | + hidden:true, | |
322 | + id: amdaUI.CatalogUI.COL_TO_HIDE_DURATION+'3', | |
323 | + renderer: function(value) { | |
324 | + return Ext.util.Format.number(value,'0.00'); | |
325 | + }, | |
326 | + listeners: { | |
327 | + beforeshow : function(){ | |
328 | + updateDurationColumnsVisibility(this.ownerCt.getGridColumns(), amdaUI.CatalogUI.COL_TO_HIDE_DURATION+'3'); | |
329 | + } | |
330 | + } | |
278 | 331 | } |
279 | - else | |
280 | - { | |
281 | - width = 50. * parseInt(obj.size); | |
282 | - columns[i] = Ext.create('Ext.grid.column.Column', { text: obj.name, sortable : false, dataIndex: index, | |
283 | - width : width, menuDisabled: false, editor: 'textfield' }); | |
332 | + ]; | |
333 | + | |
334 | + Ext.Array.each(result.parameters, function(obj, index) { | |
335 | + var field = { | |
336 | + name: 'param'+(index+2) | |
337 | + }; | |
338 | + var column = { | |
339 | + text: obj.name, | |
340 | + sortable : true, | |
341 | + dataIndex: 'param'+(index+2), | |
342 | + menuDisabled: false | |
343 | + }; | |
344 | + switch (obj.type) { | |
345 | + case 1: //dateTime | |
346 | + field = Ext.apply({}, field, { | |
347 | + type : 'date', | |
348 | + dateFormat: 'Y-m-d\\TH:i:s', | |
349 | + convert: function(value,rec) { | |
350 | + if (!Ext.isDate(value)){ | |
351 | + var valueString = new String(value); | |
352 | + return new Date(valueString.replace(/\-/g,'\/').replace(/[T|Z]/g,' ')); | |
353 | + } | |
354 | + return value; | |
355 | + } | |
356 | + | |
357 | + }); | |
358 | + column = Ext.apply({}, column, { | |
359 | + xtype: 'datecolumn', | |
360 | + width : 120, | |
361 | + editor : { | |
362 | + xtype:'datefield', | |
363 | + allowBlank:false, | |
364 | + hideTrigger: true, | |
365 | + format : 'Y-m-d\\TH:i:s' | |
366 | + } | |
367 | + }); | |
368 | + break; | |
369 | + default: | |
370 | + field = Ext.apply({}, field, { | |
371 | + type: 'string' | |
372 | + }); | |
373 | + column = Ext.apply({}, column, { | |
374 | + width : 50. * parseInt(obj.size), | |
375 | + editor: 'textfield' | |
376 | + }); | |
284 | 377 | } |
285 | - i++; | |
378 | + fieldsConfig.push(field); | |
379 | + columnsConfig.push(column); | |
286 | 380 | }); |
381 | + | |
287 | 382 | var store = Ext.create('Ext.data.Store', { |
288 | - fields: fields, | |
383 | + fields: fieldsConfig, | |
289 | 384 | autoDestroy: false, |
290 | 385 | pageSize : 200, |
291 | 386 | buffered : true, |
... | ... | @@ -310,13 +405,13 @@ Ext.define('amdaUI.CatalogUI', { |
310 | 405 | me.TTGrid.getView().refresh(); |
311 | 406 | me.TTGrid.getSelectionModel().refresh(); |
312 | 407 | me.updateCount(); |
313 | - //Statistical plugin | |
314 | - // this.fireEvent("refresh"); | |
408 | + //Statistical plugin | |
409 | + this.fireEvent("refresh"); | |
315 | 410 | } |
316 | 411 | } |
317 | 412 | }); |
318 | 413 | |
319 | - me.TTGrid.reconfigure(store, columns); | |
414 | + me.TTGrid.reconfigure(store, columnsConfig); | |
320 | 415 | } |
321 | 416 | me.TTGrid.getSelectionModel().deselectAll(); |
322 | 417 | // |
... | ... | @@ -333,6 +428,8 @@ Ext.define('amdaUI.CatalogUI', { |
333 | 428 | me.TTGrid.getStore().load(); |
334 | 429 | |
335 | 430 | me.status = result.status; |
431 | + //Statistical plugin | |
432 | + me.fireEvent("refresh"); | |
336 | 433 | }, |
337 | 434 | |
338 | 435 | /** |
... | ... | @@ -344,7 +441,7 @@ Ext.define('amdaUI.CatalogUI', { |
344 | 441 | |
345 | 442 | this.status = null; |
346 | 443 | |
347 | - if (this.object.get('fromPlugin')){ | |
444 | + if (this.object.get('fromPlugin') && (this.object.get('objName') != '')){ | |
348 | 445 | if (this.object.get('objFormat') && this.object.get('objFormat') != ''){ |
349 | 446 | //From uploaded file |
350 | 447 | AmdaAction.initTTCacheFromUploadedFile(this.object.get('objName'), this.object.get('objFormat'), this.isCatalog, this.onAfterInit, this); |
... | ... | @@ -358,13 +455,15 @@ Ext.define('amdaUI.CatalogUI', { |
358 | 455 | var typeTT = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.catalog.id).linkedNode.data.nodeType; |
359 | 456 | |
360 | 457 | if (this.object.get('id') == '') { |
361 | - AmdaAction.initTTCache(this.isCatalog, 1, this.onAfterInit,this); | |
458 | + AmdaAction.initTTCache(this.isCatalog, this.object.get('nbParameters'), this.onAfterInit,this); | |
362 | 459 | } |
363 | 460 | else { |
364 | 461 | //From existing TT file |
365 | 462 | AmdaAction.initTTCacheFromTT(this.object.get('id'), typeTT, this.onAfterInit, this); |
366 | 463 | } |
367 | 464 | } |
465 | + //Statistical plugin | |
466 | + this.fireEvent("refresh"); | |
368 | 467 | }, |
369 | 468 | |
370 | 469 | checkIntervalsStatusForSave : function(onStatusOk) { |
... | ... | @@ -410,7 +509,7 @@ Ext.define('amdaUI.CatalogUI', { |
410 | 509 | this.object = obj; |
411 | 510 | if (toRename) module.linkedNode.toRename = true; |
412 | 511 | } |
413 | - module.linkedNode.create(/*{callback : function() {module.linkedNode.update();}, scope : this}*/); | |
512 | + module.linkedNode.create({callback : function() {module.linkedNode.update();}, scope : this}); | |
414 | 513 | } else { |
415 | 514 | //update |
416 | 515 | module.linkedNode.update(); |
... | ... | @@ -580,7 +679,9 @@ Ext.define('amdaUI.CatalogUI', { |
580 | 679 | |
581 | 680 | this.formPanel = Ext.create('Ext.form.Panel', { |
582 | 681 | region : 'center', |
583 | - layout: 'hbox', | |
682 | + layout: 'hbox', | |
683 | + model : 'amdaModel.Catalog', | |
684 | + trackResetOnLoad : true, // reset to the last loaded record | |
584 | 685 | bodyStyle: {background : '#dfe8f6'}, |
585 | 686 | defaults: { border : false, align: 'stretch', bodyStyle: {background : '#dfe8f6'}, padding: '3'}, |
586 | 687 | fieldDefaults: { labelWidth: 80, labelAlign : 'top' }, |
... | ... | @@ -612,7 +713,7 @@ Ext.define('amdaUI.CatalogUI', { |
612 | 713 | }, |
613 | 714 | { |
614 | 715 | xtype: 'component', |
615 | - height: 180 | |
716 | + height: 90 | |
616 | 717 | }], |
617 | 718 | dockedItems:[{ |
618 | 719 | xtype: 'toolbar', |
... | ... | @@ -637,16 +738,24 @@ Ext.define('amdaUI.CatalogUI', { |
637 | 738 | |
638 | 739 | Ext.Msg.prompt('Define Parameters', 'Please enter parameters number:', function(btn, text){ |
639 | 740 | if (btn == 'ok'){ |
640 | - AmdaAction.initTTCache(me.isCatalog, text, me.onAfterInit, me); | |
641 | - } | |
642 | - else { | |
643 | - AmdaAction.initTTCache(me.isCatalog, 0, me.onAfterInit, me); | |
741 | + module.createLinkedNode(); | |
742 | + module.createObject(); | |
743 | + var obj = module.linkedNode.get('object'); | |
744 | + | |
745 | + var nbParam = parseInt(text); | |
746 | + if ((nbParam <= 0) || (nbParam > 100)) { | |
747 | + nbParam = 1; | |
748 | + } | |
749 | + | |
750 | + obj.set('nbParameters', nbParam); | |
751 | + me.setObject(obj,true); | |
644 | 752 | } |
645 | 753 | }, this); |
646 | 754 | |
647 | 755 | } |
648 | 756 | }] |
649 | 757 | }, |
758 | + | |
650 | 759 | { |
651 | 760 | xtype: 'toolbar', |
652 | 761 | dock: 'bottom', |
... | ... | @@ -713,7 +822,7 @@ Ext.define('amdaUI.CatalogUI', { |
713 | 822 | }); |
714 | 823 | } |
715 | 824 | else { |
716 | - Ext.Msg.alert('No intervals', 'Your time table is invalid, <br>you must have at least one interval'); | |
825 | + Ext.Msg.alert('No intervals', 'Your catalog is invalid, <br>you must have at least one interval'); | |
717 | 826 | } |
718 | 827 | } |
719 | 828 | } |
... | ... | @@ -740,7 +849,25 @@ Ext.define('amdaUI.CatalogUI', { |
740 | 849 | // }); |
741 | 850 | // } |
742 | 851 | // }, |
743 | - { | |
852 | + | |
853 | + ] | |
854 | + }, | |
855 | + //statistical info | |
856 | + { | |
857 | + xtype: 'toolbar', | |
858 | + dock: 'bottom', | |
859 | + ui: 'footer', | |
860 | + items:[{ | |
861 | + xtype: 'button', | |
862 | + text: 'Statistical info', | |
863 | + scope: this, | |
864 | + //dock: 'bottom', | |
865 | + //ui: 'footer', | |
866 | + handler: function() { | |
867 | + this.fireEvent('info','catalogUI'); | |
868 | + } | |
869 | + }, | |
870 | + { | |
744 | 871 | type: 'button', |
745 | 872 | text: 'Visualize', |
746 | 873 | scope: this, |
... | ... | @@ -755,8 +882,24 @@ Ext.define('amdaUI.CatalogUI', { |
755 | 882 | module.createWindow(); |
756 | 883 | }); |
757 | 884 | } |
758 | - }] | |
759 | - }] | |
885 | + } | |
886 | + ] | |
887 | + }, | |
888 | + { | |
889 | + xtype: 'toolbar', | |
890 | + dock: 'bottom', | |
891 | + ui: 'footer', | |
892 | + items:[{ | |
893 | + xtype: 'button', | |
894 | + text: 'Generate Time Table', | |
895 | + scope: this, | |
896 | + //dock: 'bottom', | |
897 | + //ui: 'footer', | |
898 | + handler: function() { | |
899 | + this.generateTT(this.object.get('id')); | |
900 | + } | |
901 | + }]}, | |
902 | + ] | |
760 | 903 | }, |
761 | 904 | { |
762 | 905 | xtype: 'form', |
... | ... | @@ -791,8 +934,10 @@ Ext.define('amdaUI.CatalogUI', { |
791 | 934 | url: helpDir+'catalogHOWTO' |
792 | 935 | } |
793 | 936 | } |
794 | - ] | |
937 | + ] , | |
938 | + plugins: [ {ptype: 'statisticalPlugin'} ] | |
795 | 939 | }; |
796 | 940 | Ext.apply (this, Ext.apply(arguments, myConf)); |
797 | - } | |
941 | + } | |
942 | + | |
798 | 943 | }); |
... | ... |
js/app/views/OperationsTT.js
js/app/views/PlotComponents/PlotZoomPlug.js
... | ... | @@ -21,6 +21,7 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { |
21 | 21 | id: 'plot-zoom-plug', |
22 | 22 | |
23 | 23 | ttModuleId: 'timetab-win', |
24 | + catModuleId: 'catalog-win', | |
24 | 25 | |
25 | 26 | win: null, |
26 | 27 | form: null, |
... | ... | @@ -28,7 +29,7 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { |
28 | 29 | tabId: '', |
29 | 30 | panelId: -1, |
30 | 31 | |
31 | - linkedTTNode: null, | |
32 | + linkedTTCatNode: null, | |
32 | 33 | |
33 | 34 | constructor: function (config) { |
34 | 35 | Ext.apply(this, config); |
... | ... | @@ -87,7 +88,10 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { |
87 | 88 | var start = this.form.getForm().findField('zoom-min-time').getValue(); |
88 | 89 | var stop = this.form.getForm().findField('zoom-max-time').getValue(); |
89 | 90 | |
90 | - myDesktopApp.getLoadedModule(this.ttModuleId, true, function (module) { | |
91 | + var TTCatType = this.form.getForm().findField('ttcat-type').getValue(); | |
92 | + var isCatalog = (TTCatType == 'catalog'); | |
93 | + | |
94 | + myDesktopApp.getLoadedModule(isCatalog ? this.catModuleId : this.ttModuleId, true, function (module) { | |
91 | 95 | var targetModuleUI = module.getUiContent(); |
92 | 96 | if (targetModuleUI) |
93 | 97 | targetModuleUI.addInterval(start, stop); |
... | ... | @@ -172,9 +176,9 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { |
172 | 176 | this.form.getForm().findField('zoom-min-float').setVisible(this.zoomType != 'timeAxis'); |
173 | 177 | this.form.getForm().findField('zoom-max-float').setVisible(this.zoomType != 'timeAxis'); |
174 | 178 | |
175 | - var ttNameField = this.form.getForm().findField('tt-name'); | |
176 | - if (ttNameField) | |
177 | - ttNameField.findParentByType('fieldset').setVisible(this.zoomType == 'timeAxis'); | |
179 | + var ttCatNameField = this.form.getForm().findField('ttcat-name'); | |
180 | + if (ttCatNameField) | |
181 | + ttCatNameField.findParentByType('fieldset').setVisible(this.zoomType == 'timeAxis'); | |
178 | 182 | }, |
179 | 183 | |
180 | 184 | resetMinMaxValue: function () { |
... | ... | @@ -232,9 +236,18 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { |
232 | 236 | ] |
233 | 237 | }; |
234 | 238 | |
239 | + var insertTypeStore = Ext.create('Ext.data.Store', { | |
240 | + fields: ['key', 'name'], | |
241 | + data : [ | |
242 | + {"key":"timeTable", "name":"TimeTable"}, | |
243 | + {"key":"catalog", "name":"Catalog"} | |
244 | + ] | |
245 | + }); | |
246 | + | |
247 | + var me = this; | |
235 | 248 | var insertTTFieldSet = { |
236 | 249 | xtype: 'fieldset', |
237 | - title: 'TimeTable Insertion', | |
250 | + title: 'Intervals Insertion', | |
238 | 251 | name: 'tt-insertion-fieldset', |
239 | 252 | collapsible: false, |
240 | 253 | layout: { |
... | ... | @@ -244,20 +257,32 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { |
244 | 257 | }, |
245 | 258 | items: [ |
246 | 259 | { |
260 | + xtype: 'combo', | |
261 | + fieldLabel: 'Insert In', | |
262 | + store: insertTypeStore, | |
263 | + queryMode: 'local', | |
264 | + displayField: 'name', | |
265 | + valueField: 'key', | |
266 | + editable: false, | |
267 | + value: 'timeTable', | |
268 | + name: 'ttcat-type' | |
269 | + }, | |
270 | + { | |
247 | 271 | xtype: 'textfield', |
248 | - fieldLabel: 'TimeTable Name', | |
249 | - name: 'tt-name', | |
272 | + fieldLabel: 'Name', | |
273 | + name: 'ttcat-name', | |
250 | 274 | listeners: |
251 | 275 | { |
252 | 276 | render: function (o, op) { |
253 | - var me = this; | |
254 | - var el = me.el; | |
277 | + var field = this; | |
278 | + var el = this.el; | |
255 | 279 | var dropTarget = Ext.create('Ext.dd.DropTarget', el, { |
256 | 280 | ddGroup: 'explorerTree', |
257 | 281 | notifyOver: function (ddSource, e, data) { |
258 | - if ((data.records[0].data.nodeType == 'timeTable') && (data.records[0].data.leaf)) { | |
259 | - this.valid = true; | |
260 | - return this.dropAllowed; | |
282 | + var TTCatType = me.form.getForm().findField('ttcat-type').getValue(); | |
283 | + if (data.records[0].data.leaf && (data.records[0].data.nodeType == TTCatType)) { | |
284 | + this.valid = true; | |
285 | + return this.dropAllowed; | |
261 | 286 | } |
262 | 287 | this.valid = false; |
263 | 288 | return this.dropNotAllowed; |
... | ... | @@ -265,7 +290,7 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { |
265 | 290 | notifyDrop: function (ddSource, e, data) { |
266 | 291 | if (!this.valid) |
267 | 292 | return false; |
268 | - me.setValue(data.records[0].get('text')); | |
293 | + field.setValue(data.records[0].get('text')); | |
269 | 294 | return true; |
270 | 295 | } |
271 | 296 | }); |
... | ... | @@ -280,47 +305,61 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { |
280 | 305 | handler: function () { |
281 | 306 | var me = this; |
282 | 307 | |
283 | - var TTname = this.form.getForm().findField('tt-name').getValue(); | |
308 | + var TTCatType = this.form.getForm().findField('ttcat-type').getValue(); | |
309 | + var TTCatName = this.form.getForm().findField('ttcat-name').getValue(); | |
284 | 310 | |
285 | - myDesktopApp.getLoadedModule(this.ttModuleId, true, function (module) { | |
311 | + var isCatalog = (TTCatType == 'catalog'); | |
312 | + myDesktopApp.getLoadedModule(isCatalog ? this.catModuleId : this.ttModuleId, true, function (module) { | |
286 | 313 | var targetModuleUI = module.getUiContent(); |
287 | - if (me.linkedTTNode && (me.linkedTTNode.get('text') == TTname)) { | |
314 | + if (me.linkedTTCatNode && (me.linkedTTCatNode.get('text') == TTCatName) && (me.linkedTTCatNode.get('nodeType') == TTCatType)) { | |
288 | 315 | if (targetModuleUI) |
289 | 316 | me.insertInterval(); |
290 | 317 | else { |
291 | - me.linkedTTNode.editLeaf(function () { | |
318 | + me.linkedTTCatNode.editLeaf(function () { | |
292 | 319 | me.insertInterval(); |
293 | 320 | }); |
294 | 321 | } |
295 | 322 | } |
296 | 323 | else { |
297 | - if (TTname == '') { | |
298 | - me.linkedTTNode.editLeaf(function () { | |
299 | - me.insertInterval(); | |
300 | - }); | |
301 | - } | |
302 | - | |
303 | 324 | var explorerTree = Ext.getCmp(amdaUI.ExplorerUI.RESRC_TAB.TREE_ID); |
304 | - var ttRootNode = explorerTree.getRootNode().findChild('id', 'timeTable-treeRootNode', true); | |
305 | - amdaModel.InteractiveNode.preloadNodes(ttRootNode, function () { | |
325 | + var ttCatRootNode = explorerTree.getRootNode().findChild('id', isCatalog ? 'catalog-treeRootNode' : 'timeTable-treeRootNode', true); | |
326 | + amdaModel.InteractiveNode.preloadNodes(ttCatRootNode, function () { | |
306 | 327 | var nodeWithSameName = null; |
307 | 328 | |
308 | - if (TTname != '') | |
309 | - nodeWithSameName = ttRootNode.findChild('text', TTname, true); | |
329 | + if (TTCatName != '') | |
330 | + nodeWithSameName = ttCatRootNode.findChild('text', TTCatName, true); | |
310 | 331 | |
311 | 332 | if (nodeWithSameName !== null) |
312 | - me.linkedTTNode = nodeWithSameName; | |
333 | + me.linkedTTCatNode = nodeWithSameName; | |
313 | 334 | else { |
314 | - var obj = Ext.create('amdaModel.TimeTable', {name: TTname, fromPlugin: true}); | |
315 | - me.linkedTTNode = Ext.create('amdaModel.TimeTableNode', { | |
316 | - leaf: true, | |
317 | - text: TTname, | |
318 | - nodeType: 'timeTable', | |
319 | - object: obj | |
320 | - }); | |
335 | + module.createLinkedNode(); | |
336 | + module.getLinkedNode().set('text', TTCatName); | |
337 | + me.linkedTTCatNode = module.getLinkedNode(); | |
338 | + var obj = { | |
339 | + name: TTCatName, | |
340 | + fromPlugin: true | |
341 | + }; | |
342 | + if (isCatalog) { | |
343 | + Ext.Msg.prompt('Define Parameters', 'Please enter parameters number for the new catalog:', function(btn, text){ | |
344 | + if (btn == 'ok'){ | |
345 | + obj.nbParameters = parseInt(text,10); | |
346 | + if (isNaN(obj.nbParameters)) { | |
347 | + obj.nbParameters = 1; | |
348 | + } | |
349 | + module.createObject(obj); | |
350 | + me.linkedTTCatNode.editLeaf(function () { | |
351 | + me.insertInterval(); | |
352 | + }); | |
353 | + } | |
354 | + }); | |
355 | + return; | |
356 | + } | |
357 | + else { | |
358 | + module.createObject(obj); | |
359 | + } | |
321 | 360 | } |
322 | 361 | |
323 | - me.linkedTTNode.editLeaf(function () { | |
362 | + me.linkedTTCatNode.editLeaf(function () { | |
324 | 363 | me.insertInterval(); |
325 | 364 | }); |
326 | 365 | }); |
... | ... | @@ -395,4 +434,4 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { |
395 | 434 | }); |
396 | 435 | return this.form; |
397 | 436 | } |
398 | -}); | |
399 | 437 | \ No newline at end of file |
438 | +}); | |
... | ... |
js/app/views/PlotTabResultUI.js
... | ... | @@ -78,6 +78,7 @@ Ext.define('amdaUI.PlotTabResultUI', { |
78 | 78 | var size = this.getImageSize(); |
79 | 79 | |
80 | 80 | var me = this; |
81 | + var insertIntervalItem = null; | |
81 | 82 | Ext.each(panelContext.plotArea.axes, function (axis) { |
82 | 83 | //Events for zoom on a time axis |
83 | 84 | var onMinTimeSelection = function (posX) { |
... | ... | @@ -152,6 +153,15 @@ Ext.define('amdaUI.PlotTabResultUI', { |
152 | 153 | }, |
153 | 154 | scope: this |
154 | 155 | }); |
156 | + insertIntervalItem = { | |
157 | + text:'Insert Interval in TimeTable or Catalog', | |
158 | + handler : function(item, e) { | |
159 | + zoomPlugin.show(me.tabId, axis.id, panelContext.id); | |
160 | + zoomPlugin.resetMinMaxValue(); | |
161 | + me.panelImage.startZoom(true, 0/*me.toPixelOnResultImage(panelContext.y)*/, size.height /*me.toPixelOnResultImage(panelContext.height)*/, onMinTimeSelection, onMaxTimeSelection); | |
162 | + }, | |
163 | + scope: this | |
164 | + }; | |
155 | 165 | break; |
156 | 166 | case 'y-left' : |
157 | 167 | me.contextualMenu.add({ |
... | ... | @@ -189,6 +199,11 @@ Ext.define('amdaUI.PlotTabResultUI', { |
189 | 199 | } |
190 | 200 | |
191 | 201 | }); |
202 | + | |
203 | + if (insertIntervalItem != null) { | |
204 | + me.contextualMenu.add('-'); | |
205 | + me.contextualMenu.add(insertIntervalItem); | |
206 | + } | |
192 | 207 | }, |
193 | 208 | |
194 | 209 | createPlotImage: function(resultFolder, plotFile) { |
... | ... | @@ -307,7 +322,7 @@ Ext.define('amdaUI.PlotTabResultUI', { |
307 | 322 | if (amdaPlotComp.PlotContextManager.isInPlotArea(panel, sourceXPos, sourceYPos)) |
308 | 323 | me.createZoomItemsForPanel(panel.id); |
309 | 324 | } |
310 | - | |
325 | + | |
311 | 326 | if (me.contextualMenu.items.getCount() > 0) |
312 | 327 | me.contextualMenu.add('-'); |
313 | 328 | |
... | ... |
js/app/views/StatisticalPlug.js
... | ... | @@ -45,7 +45,7 @@ Ext.define('amdaUI.StatisticalPlug', { |
45 | 45 | }*/ |
46 | 46 | }, |
47 | 47 | |
48 | - onInfo: function() { | |
48 | + onInfo: function(type) { | |
49 | 49 | if (!this.win) { |
50 | 50 | this.win = new Ext.Window({ |
51 | 51 | id: 'statistical-win', |
... | ... | @@ -63,7 +63,8 @@ Ext.define('amdaUI.StatisticalPlug', { |
63 | 63 | type:'help', |
64 | 64 | qtip: 'Help on Statistical info', |
65 | 65 | handler: function(event, toolEl, panel){ |
66 | - AmdaAction.getInfo({name : 'statisticalHelp'}, function(res,e) { | |
66 | + | |
67 | + AmdaAction.getInfo({name : 'statisticalHelp'+type}, function(res,e) { | |
67 | 68 | if (res.success) myDesktopApp.infoMsg(res.result); |
68 | 69 | }); |
69 | 70 | } |
... | ... | @@ -90,8 +91,9 @@ Ext.define('amdaUI.StatisticalPlug', { |
90 | 91 | */ |
91 | 92 | statTT: function(){ |
92 | 93 | if (this.win) { |
94 | + var type =this.hostCmp[0]['id']; | |
93 | 95 | var me = this; |
94 | - AmdaAction.getTTCacheStatistics(function (result, e) { | |
96 | + AmdaAction.getTTCacheStatistics({name : type }, function (result, e) { | |
95 | 97 | if (!result || !result.success) |
96 | 98 | { |
97 | 99 | if (result.message) |
... | ... |
js/app/views/TimeTableUI.js
... | ... | @@ -118,7 +118,17 @@ Ext.define('amdaUI.TimeTableUI', { |
118 | 118 | AmdaAction.initTTCacheFromTmpObject(this.object.get('folderId'), this.object.get('objName'), false, onAfterInit); |
119 | 119 | } |
120 | 120 | } |
121 | - else | |
121 | + else if(this.object.get('relatedCatalogId') != '') | |
122 | + { | |
123 | + var pathern=this.object.get('relatedCatalogId').split('_')[0] ; | |
124 | + catType=''; | |
125 | + if(pathern=='cat') | |
126 | + catType=' catalog' ; | |
127 | + if(pathern=='sharedcatalog') | |
128 | + catType='sharedcatalog' ; | |
129 | + AmdaAction.initTTCacheFromCatalog(this.object.get('relatedCatalogId'), catType, onAfterInit); | |
130 | + } | |
131 | + else | |
122 | 132 | { |
123 | 133 | var typeTT = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.tt.id).linkedNode.data.nodeType; |
124 | 134 | if (this.object.get('id') == '') |
... | ... |
php/classes/AmdaAction.php
... | ... | @@ -172,12 +172,12 @@ class AmdaAction |
172 | 172 | break; |
173 | 173 | |
174 | 174 | case 'condition': |
175 | - $objectMgr = new RequestMgr(); | |
175 | + $objectMgr = new RequestMgr($nodeType); | |
176 | 176 | $info = $objectMgr->getObject($id)->expression; |
177 | 177 | break; |
178 | 178 | |
179 | 179 | case 'request': |
180 | - $objectMgr = new RequestMgr(); | |
180 | + $objectMgr = new RequestMgr($nodeType); | |
181 | 181 | $objplot = $objectMgr->getObject($id); |
182 | 182 | if (isset($objplot->name)) { |
183 | 183 | $info = $objplot->name; |
... | ... | @@ -1087,6 +1087,14 @@ class AmdaAction |
1087 | 1087 | return $cacheMgr->initFromTT($id, $type); |
1088 | 1088 | } |
1089 | 1089 | |
1090 | + public function initTTCacheFromCatalog($id, $type) | |
1091 | + { | |
1092 | + $cacheMgr = new TimeTableCacheMgr(); | |
1093 | + | |
1094 | + return $cacheMgr->initFromCatalog($id, $type); | |
1095 | + } | |
1096 | + | |
1097 | + | |
1090 | 1098 | public function initForChart($id, $name, $isTmpObject, $type) |
1091 | 1099 | { |
1092 | 1100 | if ($isTmpObject && $type == 'catalog' && $id == 'cacheCat') |
... | ... | @@ -1183,9 +1191,16 @@ class AmdaAction |
1183 | 1191 | return $cacheMgr->mergeIntervals(); |
1184 | 1192 | } |
1185 | 1193 | |
1186 | - public function getTTCacheStatistics() | |
1194 | + public function getTTCacheStatistics($obj) | |
1187 | 1195 | { |
1188 | - $cacheMgr = new TimeTableCacheMgr(); | |
1196 | + error_log("name",$obj->name ); | |
1197 | + if($obj->name == "timeTableUi"){ | |
1198 | + $cacheMgr = new TimeTableCacheMgr(); | |
1199 | + }elseif($obj->name == "catalogUI"){ | |
1200 | + $cacheMgr = new CatalogCacheMgr(); | |
1201 | + }else{ | |
1202 | + return array('success' => false, 'message' => 'unkown type: '.$obj->name); | |
1203 | + } | |
1189 | 1204 | return $cacheMgr->getStatistics(); |
1190 | 1205 | } |
1191 | 1206 | |
... | ... |
php/classes/TimeTableCacheMgr.php
1 | 1 | <?php |
2 | - | |
3 | 2 | class CacheTools |
4 | 3 | { |
5 | 4 | public static function iso2stamp($iso) { |
... | ... | @@ -569,6 +568,7 @@ class FilterCacheObject |
569 | 568 | |
570 | 569 | function __construct() { |
571 | 570 | $this->ttMgr = new TimeTableMgr(); |
571 | + $this->catMgr = new CatalogMgr(); | |
572 | 572 | } |
573 | 573 | |
574 | 574 | public function initTTCache() { |
... | ... | @@ -604,6 +604,32 @@ class FilterCacheObject |
604 | 604 | return array('success' => $this->saveToFile(), 'token' => $this->cache->getToken(), 'status' => $this->cache->getStatus()); |
605 | 605 | } |
606 | 606 | |
607 | + public function initFromCatalog($id, $typeTT) { | |
608 | + //Create new cache | |
609 | + $this->cache = new TimeTableCacheObject(); | |
610 | + | |
611 | + //Load intervals from TT file and add to cache | |
612 | + $intervals_res = $this->catMgr->loadIntervalsFromTT($id,$typeTT); | |
613 | + | |
614 | + if (!$intervals_res['success']) | |
615 | + return $intervals_res; | |
616 | + | |
617 | + foreach ($intervals_res['intervals'] as $interval) | |
618 | + { | |
619 | + //Add interval | |
620 | + $this->cache->addInterval($interval['start'], $interval['stop']); | |
621 | + } | |
622 | + | |
623 | + unset($intervals_res); | |
624 | + | |
625 | + //Update cache | |
626 | + $this->cache->updateIndexes(); | |
627 | + | |
628 | + //Save cache file | |
629 | + return array('success' => $this->saveToFile(), 'token' => $this->cache->getToken(), 'status' => $this->cache->getStatus()); | |
630 | + } | |
631 | + | |
632 | + | |
607 | 633 | public function initFromTmpObject($folderId, $name) { |
608 | 634 | //Create new cache |
609 | 635 | $this->cache = new TimeTableCacheObject(); |
... | ... |
php/classes/UserMgr.php
... | ... | @@ -586,9 +586,9 @@ class UserMgr |
586 | 586 | |
587 | 587 | $ok = $this->makeRemoteTree(); |
588 | 588 | |
589 | - if (!file_exists(USERWSDIR.'Request.xml')) $reqMgr = new RequestMgr(); | |
589 | + /*if (!file_exists(USERWSDIR.'Request.xml')) $reqMgr = new RequestMgr(); | |
590 | 590 | if (!file_exists(USERWSDIR.'Tt.xml')) $ttMgr = new TimeTableMgr(); |
591 | - if (!file_exists(USERWSDIR.'Alias.xml')) $ttMgr = new AliasMgr(); | |
591 | + if (!file_exists(USERWSDIR.'Alias.xml')) $ttMgr = new AliasMgr();*/ | |
592 | 592 | |
593 | 593 | //TODO sessionID = user + WSname |
594 | 594 | $sessionID = $this->user; |
... | ... |
php/config.php
... | ... | @@ -160,6 +160,7 @@ $API = array( |
160 | 160 | 'initForChart'=>array('len'=>4), |
161 | 161 | 'initTTCacheFromTmpObject'=>array('len'=>3), |
162 | 162 | 'initTTCacheFromUploadedFile'=>array('len'=>3), |
163 | + 'initTTCacheFromCatalog'=>array('len'=>2), | |
163 | 164 | 'readTTCacheIntervals'=>array('len'=>1), |
164 | 165 | 'readIntervalsForChart'=>array('len'=>1), |
165 | 166 | 'addTTCacheInterval'=>array('len'=>1), |
... | ... | @@ -167,7 +168,7 @@ $API = array( |
167 | 168 | 'modifyTTCacheInterval'=>array('len'=>1), |
168 | 169 | 'operationTTCacheIntervals'=>array('len'=>2), |
169 | 170 | 'mergeTTCacheIntervals'=>array('len'=>0), |
170 | - 'getTTCacheStatistics'=>array('len'=>0), | |
171 | + 'getTTCacheStatistics'=>array('len'=>1), | |
171 | 172 | 'sendFeedback'=>array('len'=>1), |
172 | 173 | 'saveState'=>array('len'=>1), |
173 | 174 | 'loadState'=>array('len'=>1), |
... | ... |