Commit e1fd05b4b3f94cef73d63bf739f25c03b85038d0

Authored by Elena.Budnik
1 parent 3768c8a8

visu from cacheCat

js/app/views/CatalogUI.js
... ... @@ -189,8 +189,7 @@ Ext.define('amdaUI.CatalogUI', {
189 189  
190 190 //set cache token to the Catalog object
191 191 me.object.set('cacheToken', result.token);
192   - me.setParamInfo(result.parameters);
193   -
  192 + me.setParamInfo(result.parameters);
194 193 me.TTGrid.getStore().load();
195 194  
196 195 me.status = result.status;
... ... @@ -576,8 +575,7 @@ Ext.define('amdaUI.CatalogUI', {
576 575  
577 576 myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.visu.id, true, function (module) {
578 577 //temporary linked node - as Visu module is 'pseudo' interactive - no 'save', no 'execute'
579   - var temporaryNode = Ext.create('amdaModel.CatalogNode', { leaf : true });
580   -
  578 + var temporaryNode = Ext.create('amdaModel.CatalogNode', { leaf : true });
581 579 if (temporaryNode) temporaryNode.set('object',me.object);
582 580 module.setLinkedNode(temporaryNode);
583 581  
... ...
js/app/views/VisuUI.js
... ... @@ -11,30 +11,30 @@ Ext.define('amdaUI.VisuUI', {
11 11 extend: 'Ext.container.Container',
12 12 alias: 'widget.panelVisu',
13 13  
14   - constructor: function(config)
15   - {
  14 + constructor: function(config) {
16 15 this.init(config);
17 16 this.callParent(arguments);
18 17 if (this.object) this.reformObject();
19 18 },
20 19  
21   - setObject : function (obj) {
22   -
  20 + setObject : function (obj) {
23 21 this.object = obj;
24 22 this.reformObject();
25 23 },
26 24  
27   - updateObject : function () {
28   -
  25 + updateObject : function () {
29 26 return true;
30 27 },
31 28  
32   - reformObject : function ()
33   - {
  29 + reformObject : function () {
34 30 this.fromPlugin = this.object.get('fromPlugin');
35 31  
36 32 if (this.fromPlugin) {
37   - this.object.set('id',this.object.get('folderId'));
  33 + if (this.object.get('folderId') == '')
  34 + this.object.set('id','cacheCat');
  35 + else
  36 + this.object.set('id',this.object.get('folderId'));
  37 +
38 38 this.object.set('objName',this.object.get('objName'));
39 39 }
40 40 else {
... ... @@ -42,12 +42,11 @@ Ext.define('amdaUI.VisuUI', {
42 42 this.object.set('name',this.object.get('name'));
43 43 }
44 44 // load object into view
45   - if (this.object.get('id') != '')
  45 + if (this.object.get('id') != '')
46 46 this.loadObject();
47 47 },
48 48  
49 49 reset : function() {
50   -
51 50 //reset all fieldsets except the first one (name, intervals)
52 51 var form = this.items.items[0].items.items[0];
53 52 for (var i = 1; i < 4; i++) {
... ... @@ -56,62 +55,88 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
56 55 field.reset();
57 56 });
58 57 }
59   - this.resetChart();
60   -
  58 + this.resetChart();
61 59 },
  60 +
62 61 /**
63 62 * load object catalog into this view
64 63 */
65 64 loadObject : function()
66   - {
67   -
  65 + {
68 66 var me = this;
69 67  
70 68 var onAfterInit = function(result, e)
71   - {
72   - if (!result || !result.success)
  69 + {
  70 + if (!result) {
  71 + myDesktopApp.errorMsg(e.message);
  72 + Ext.defer(function(){Ext.Msg.toFront()},10);
  73 +
  74 + return;
  75 + }
  76 + else if (!result.success)
73 77 {
74 78 if (result.message)
75 79 myDesktopApp.errorMsg(result.message);
76 80 else
77 81 myDesktopApp.errorMsg('Unknown error during catalog cache initialisation');
  82 +
  83 + Ext.defer(function(){Ext.Msg.toFront()},10);
  84 +
78 85 return;
79 86 }
80   -
81   - me.object.set('name', result.name);
82   - me.object.set('nbIntervals', result.totalCount);
83   -
  87 +
84 88 var fields = [], i = 0, index;
85   -
86   - Ext.Array.each(result.parameters, function(obj)
87   - {
  89 +
  90 + if (!result.cache) {
  91 + me.object.set('name', result.name);
  92 + me.object.set('nbIntervals', result.totalCount);
88 93  
89   - index = 'param'+i.toString();
90   - fields[i] = Ext.create('Ext.data.Field', { name : index, id: index, text : obj.name,
91   - convert: function(value, record) {
92   - return parseFloat(value);
93   - }
  94 + var params = [];
  95 + Ext.Array.each(result.parameters, function(item, index) {
  96 + params[index] = item;
  97 + }, this);
  98 +
  99 + me.object.set('parameters', params);
  100 + }
  101 + else {
  102 + fields[0] = Ext.create('Ext.data.Field', { name : 'start', id: 'start', text : 'start: date' });
  103 + fields[1] = Ext.create('Ext.data.Field', { name : 'stop', id: 'stop', text : 'stop: date' });
  104 + i = 2;
  105 + }
  106 +
  107 + Ext.Array.each(me.object.get('parameters'), function(obj) {
  108 + index = 'param'+i.toString();
  109 + if (obj.type == 0) {
  110 + fields[i] = Ext.create('Ext.data.Field', { name : index, id: index, text : obj.name,
  111 + convert: function(value, record) {
  112 + return parseFloat(value);
  113 + }
  114 + });
  115 + }
  116 + else if (obj.type == 1){
  117 + fields[i] = Ext.create('Ext.data.Field', { name : index, id: index, text : obj.name + ': date' });
  118 + }
  119 + else {
  120 + fields[i] = Ext.create('Ext.data.Field', { name : index, id: index, text : obj.name + ': string' });
94 121 }
95   - );
96   -
97 122 i++;
98 123 });
99   -
  124 +
100 125 if (me.chartStore) {
101 126 me.parList.removeAll();
102 127 me.reset();
103 128 me.chartStore = null;
104 129 }
105 130  
106   - me.parList.add(fields);
  131 + me.parList.add(fields);
107 132  
108 133 me.chartStore = Ext.create('Ext.data.Store', {
109 134 fields : fields,
110 135 // autoDestroy: false,
111   - // pageSize : 200,
112   - // buffered : true,
113   - // purgePageCount: 0,
114   - // remoteSort: true,
  136 + // pageSize : 200,
  137 + // buffered : true,
  138 + // purgePageCount: 0,
  139 + // remoteSort: true,
115 140 autoload: false,
116 141 proxy: {
117 142 type: 'direct',
... ... @@ -144,9 +169,8 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
144 169  
145 170 me.chartStore.load();
146 171 }
147   -
148   - AmdaAction.initForChart(this.object.get('id'), this.object.get('objName'), this.fromPlugin, 'catalog', onAfterInit);
149   -
  172 +
  173 + AmdaAction.initForChart(this.object.get('id'), this.object.get('objName'), this.fromPlugin, 'catalog', onAfterInit);
150 174 },
151 175  
152 176  
... ... @@ -155,9 +179,8 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
155 179 * @return true if changes
156 180 */
157 181 fclose : function()
158   - {
159   -
160   - return false;
  182 + {
  183 + return false;
161 184 },
162 185  
163 186 resetChart : function () {
... ... @@ -168,7 +191,7 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
168 191 fields: [],
169 192 title: 'X axis',
170 193 grid : true
171   - }, {
  194 + }, {
172 195 type: 'Numeric',
173 196 position: 'left',
174 197 fields: [],
... ... @@ -224,13 +247,10 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
224 247  
225 248 var chart = Ext.create('Ext.chart.Chart', this.chartConfig);
226 249  
227   - this.replaceChart(chart);
228   -
  250 + this.replaceChart(chart);
229 251 },
230   -
231   -
232   - replaceChart: function(chart) {
233   -
  252 +
  253 + replaceChart: function(chart) {
234 254 var chartPanel = this.items.items[0].items.items[1];
235 255 var oldChart = chartPanel.down('chart');
236 256 oldIndex = chartPanel.items.indexOf(oldChart);
... ... @@ -250,7 +270,6 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
250 270 autoload : false
251 271 });
252 272  
253   -
254 273 this.chartConfig = {
255 274 width: 500,
256 275 height: 500,
... ... @@ -266,7 +285,7 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
266 285 fields: [],
267 286 title: 'X axis',
268 287 grid : true
269   - }, {
  288 + }, {
270 289 type: 'Numeric',
271 290 position: 'left',
272 291 fields: [],
... ... @@ -290,7 +309,7 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
290 309 // // return storeItem.param3;
291 310 // // }
292 311 // },
293   - tips: {
  312 + tips: {
294 313 // trackMouse: true,
295 314 width: 10,
296 315 height: 20,
... ... @@ -299,9 +318,8 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
299 318 renderer: function(storeItem, item) {
300 319 this.setTitle(storeItem.index + 1);
301 320 }
302   - }
303   - }
304   - ]
  321 + }
  322 + }]
305 323 }
306 324  
307 325 this.parList = Ext.create('Ext.data.Store', {
... ... @@ -414,16 +432,13 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
414 432 bodyStyle: {background : '#dfe8f6'},
415 433 defaults: { border : false, align: 'stretch', padding: '3'},
416 434 fieldDefaults: { labelWidth: 80, labelAlign : 'top' },
417   - items: [
418   - {
  435 + items: [ {
419 436 xtype: 'form',
420 437 flex : 1,
421 438 bodyStyle: {background : '#dfe8f6'},
422   - items: [
423   - {
  439 + items: [{
424 440 xtype : 'fieldset',
425   - items : [
426   - {
  441 + items : [{
427 442 xtype: 'fieldcontainer',
428 443 layout: 'hbox',
429 444 items: [
... ... @@ -431,15 +446,13 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
431 446 { xtype: 'splitter' },
432 447 { xtype:'textfield', fieldLabel: 'Intervals', name: 'nbIntervals', readOnly: true}
433 448 ]
434   - }
435   - ]
436   - },
437   - {
  449 + }]
  450 + },{
438 451 xtype : 'fieldset',
439 452 title : 'X axis',
440 453 items : [
441   - this.parCombo,
442   - {
  454 + this.parCombo,
  455 + {
443 456 xtype : 'fieldcontainer',
444 457 layout: 'hbox',
445 458 items: [{
... ... @@ -450,58 +463,57 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
450 463 items: [
451 464 this.comboXrange,
452 465 {
453   - xtype: 'splitter'
  466 + xtype: 'splitter'
454 467 }, {
455   - xtype: 'numberfield',
456   - hideTrigger: true,
457   - width: 50,
458   - disabled: true
  468 + xtype: 'numberfield',
  469 + hideTrigger: true,
  470 + width: 50,
  471 + disabled: true
459 472 },{
460   - xtype: 'splitter'
  473 + xtype: 'splitter'
461 474 },{
462   - xtype: 'numberfield',
463   - hideTrigger: true,
464   - width: 50,
465   - disabled: true
  475 + xtype: 'numberfield',
  476 + hideTrigger: true,
  477 + width: 50,
  478 + disabled: true
466 479 }]
467 480 }]
468 481 },
469 482 // { xtype : 'checkbox', boxLabel: 'Logarithmic'},
470 483 { xtype: 'textfield', fieldLabel: 'X title', name: 'xtitle'}
471 484 ]
472   - },
473   - {
474   - xtype : 'fieldset',
  485 + },{
  486 + xtype : 'fieldset',
475 487 title : 'Y axis',
476 488 items : [
477 489 this.parCombo1,
478 490 {
479   - xtype : 'fieldcontainer',
480   - layout: 'hbox',
481   - items: [{
482   - xtype:'fieldset',
483   - title: 'Y Range',
484   - border: false,
  491 + xtype : 'fieldcontainer',
485 492 layout: 'hbox',
486   - items: [
487   - this.comboYrange,
488   - {
489   - xtype: 'splitter'
490   - }, {
491   - xtype: 'numberfield',
492   - hideTrigger: true,
493   - width: 50,
494   - disabled: true
495   - },{
496   - xtype: 'splitter'
497   - },{
498   - xtype: 'numberfield',
499   - hideTrigger: true,
500   - width: 50,
501   - disabled: true
  493 + items: [{
  494 + xtype:'fieldset',
  495 + title: 'Y Range',
  496 + border: false,
  497 + layout: 'hbox',
  498 + items: [
  499 + this.comboYrange,
  500 + {
  501 + xtype: 'splitter'
  502 + }, {
  503 + xtype: 'numberfield',
  504 + hideTrigger: true,
  505 + width: 50,
  506 + disabled: true
  507 + },{
  508 + xtype: 'splitter'
  509 + },{
  510 + xtype: 'numberfield',
  511 + hideTrigger: true,
  512 + width: 50,
  513 + disabled: true
502 514 }]
503 515 }]
504   - },
  516 + },
505 517 // { xtype : 'checkbox', boxLabel: 'Logarithmic',
506 518 // listeners: {
507 519 // scope: this,
... ... @@ -510,84 +522,75 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
510 522 // }
511 523 // }
512 524 // },
513   - { xtype: 'textfield', fieldLabel: 'Y title', name: 'ytitle'}
514   -
  525 + { xtype: 'textfield', fieldLabel: 'Y title', name: 'ytitle'}
515 526 ]
516 527 },
517   - {
518   - xtype : 'fieldset',
519   - title : 'Plotting Options',
520   - items : [
521   - plotTypeCombo,
522   - plotThemeCombo
523   - ]
524   - }
525   - ],
526   - fbar:[
527   - {
528   - type: 'button',
529   - text: 'Plot',
530   - scope : this,
531   - handler: this.plotChart
  528 + {
  529 + xtype : 'fieldset',
  530 + title : 'Plotting Options',
  531 + items : [
  532 + plotTypeCombo,
  533 + plotThemeCombo
  534 + ]
  535 + }
  536 + ],
  537 + fbar:[{
  538 + type: 'button',
  539 + text: 'Plot',
  540 + scope : this,
  541 + handler: this.plotChart
  542 +
  543 + },{
  544 + type: 'button',
  545 + text: 'Reset',
  546 + scope : this,
  547 + handler: this.reset
532 548  
533   - },{
534   - type: 'button',
535   - text: 'Reset',
536   - scope : this,
537   - handler: this.reset
538   -
539   - }
540   - ]
  549 + }]
541 550 }, {
542   - xtype: 'form',
543   - // padding: '3',
544   - flex: 2,
545   - items : [
546   - chart
547   - ],
548   - fbar:[
  551 + xtype: 'form',
  552 + // padding: '3',
  553 + flex: 2,
  554 + items : [ chart ],
  555 + fbar:[
549 556 {
550   - type: 'button',
551   - text: 'Save Chart',
552   - scope: this,
553   - handler: function() {
554   - var chartPanel = this.items.items[0].items.items[1];
555   - var chart = chartPanel.down('chart');
556   - chart.save({
557   - type: 'image/png',
558   - defaultUrl : window.location //'http://apus.irap.omp.eu/NEWAMDA/'
559   - });
560   - }
561   -
562   - }
563   - ]
564   - }
565   - ]
  557 + type: 'button',
  558 + text: 'Save Chart',
  559 + scope: this,
  560 + handler: function() {
  561 + var chartPanel = this.items.items[0].items.items[1];
  562 + var chart = chartPanel.down('chart');
  563 + chart.save({
  564 + type: 'image/png',
  565 + defaultUrl : window.location //'http://apus.irap.omp.eu/NEWAMDA/'
  566 + });
  567 + }
  568 + }]
  569 + }
  570 + ]
566 571 });
567   -
568 572  
569 573 var myConf = {
570 574 layout: 'border',
571 575 items: [
572 576 formPanel,
573 577 {
574   - xtype: 'panel',
575   - region: 'south',
576   - title: 'Information',
577   - collapsible: true,
578   - height: 100,
579   - autoHide: false,
580   - bodyStyle: 'padding:5px',
581   - iconCls: 'icon-information',
582   - loader: {
583   - autoLoad: true,
584   - url: helpDir+'visuHOWTO'
585   - }
  578 + xtype: 'panel',
  579 + region: 'south',
  580 + title: 'Information',
  581 + collapsible: true,
  582 + height: 100,
  583 + autoHide: false,
  584 + bodyStyle: 'padding:5px',
  585 + iconCls: 'icon-information',
  586 + loader: {
  587 + autoLoad: true,
  588 + url: helpDir+'visuHOWTO'
  589 + }
586 590 }
587 591 ]
588 592 };
589 593  
590 594 Ext.apply (this, Ext.apply(arguments, myConf));
591   - }
592   -
  595 + }
593 596 });
... ...
php/classes/AmdaAction.php
... ... @@ -1028,6 +1028,9 @@ class AmdaAction
1028 1028  
1029 1029 public function initForChart($id, $name, $isTmpObject, $type)
1030 1030 {
  1031 + if ($isTmpObject && $type == 'catalog' && $id == 'cacheCat')
  1032 + return array('success' => true, 'cache' => $id);
  1033 +
1031 1034 if ($type == 'catalog' || $type == 'sharedcatalog') $objMgr = new CatalogMgr();
1032 1035  
1033 1036 return $objMgr->initForChart($id, $name, $isTmpObject, $type);
... ... @@ -1059,7 +1062,16 @@ class AmdaAction
1059 1062  
1060 1063 public function readIntervalsForChart($o)
1061 1064 {
1062   - if ($o->typeTT == 'catalog' || $type == 'sharedcatalog') $objMgr = new CatalogMgr();
  1065 + if ($o->typeTT == 'catalog' || $type == 'sharedcatalog') {
  1066 +
  1067 + if ($o->fromPlugin && $o->id == 'cacheCat') {
  1068 + $objMgr = new CatalogCacheMgr();
  1069 +
  1070 + return $objMgr->getIntervals();
  1071 + }
  1072 +
  1073 + $objMgr = new CatalogMgr();
  1074 + }
1063 1075  
1064 1076 return $objMgr->getIntervalsForChart($o->id, $o->name, $o->fromPlugin, $o->typeTT);
1065 1077 }
... ...