Commit 96cdc6644169d22bcae007ad0cd1527bd2cf1158

Authored by Elena.Budnik
1 parent d80af896

new record type in statistics store

Showing 2 changed files with 83 additions and 76 deletions   Show diff stats
js/app/models/Statistics.js
... ... @@ -7,69 +7,76 @@
7 7 * @author elena
8 8 */
9 9  
10   -
11   -
12 10 Ext.define('amdaModel.Statistics', {
13   -
14   - extend: 'amdaModel.AmdaTimeObject',
  11 + extend: 'amdaModel.AmdaTimeObject',
15 12  
16   - fields : [
17   - { name: 'parameter' } ,
18   - { name: 'description' }
19   - // { name: 'timesrc', type: 'string'}
  13 + fields : [
  14 + { name: 'parameter' } ,
  15 + { name: 'description' }
20 16 ],
21 17  
22   - getJsonValues : function (hasId) {
23   - var values = new Object();
24   - if (hasId) {
25   - values.id = this.get('id');
26   - }
27   -
28   - values.timesrc = this.get('timesrc');
29   - values.name = 'test'; //this.get('name');
  18 + getJsonValues : function (hasId)
  19 + {
  20 + var values = new Object();
  21 + if (hasId) {
  22 + values.id = this.get('id');
  23 + }
  24 +
  25 + values.timesrc = this.get('timesrc');
  26 + values.name = 'test'; //this.get('name');
30 27  
31   -
32   - if (this.get('description').match(/[a-z,0-9]/gi) != null) {
33   - values.description = this.get('description');
34   - }
  28 + if (this.get('description').match(/[a-z,0-9]/gi) != null) {
  29 + values.description = this.get('description');
  30 + }
35 31 // if (this.get('history').match(/[a-z,0-9]/gi) != null) {
36 32 // values.history = this.get('history');
37 33 // }
38   - values.objName = this.get('objName');
39   - values.objFormat = this.get('objFormat');
  34 + values.objName = this.get('objName');
  35 + values.objFormat = this.get('objFormat');
40 36  
41   -// values.cacheToken = this.get('cacheToken');
42   - values.parameter = this.get('parameter');
43   - if (values.timesrc == amdaModel.AmdaTimeObject.inputTimeSrc[0]){
44   - // get complete timeTables collection
45   - var timeTables = this.get('timeTables');
46   - // init an empty array for timeTables
47   - values.timeTables=[];
48   - // for each interval record
49   - Ext.Array.each(timeTables, function(item, index, all){
50   - if (!item.$className) {
51   - values.timeTables[index] = {timeTableName : item.timeTableName, id : item.id};
52   - }
53   - // get Json simplified value
54   - else {
55   - values.timeTables[index] = item.getJsonValues();
56   - }
57   - });
58   - } else {
59   - values.startDate = this.get('startDate');
60   - values.stopDate = this.get('stopDate');
61   - values.durationDay = this.get('durationDay');
62   - values.durationHour = this.get('durationHour');
63   - values.durationMin = this.get('durationMin');
64   - values.durationSec = this.get('durationSec');
65   - }
  37 +// values.cacheToken = this.get('cacheToken');
  38 + values.parameter = this.get('parameter');
  39 +
  40 + // if there's at least one parameter
  41 +// if (this.get('parameter') && this.get('parameter').length)
  42 +// {
  43 +// var list = this.get('parameter');
  44 +// values.parameter=[];
  45 +// Ext.each(list, function(item, index){
  46 +// values.parameter[index] = item.getJsonValues();
  47 +// });
  48 +// }
  49 +
  50 + if (values.timesrc == amdaModel.AmdaTimeObject.inputTimeSrc[0])
  51 + {
  52 + // get complete timeTables collection
  53 + var timeTables = this.get('timeTables');
  54 + // init an empty array for timeTables
  55 + values.timeTables=[];
  56 + // for each interval record
  57 + Ext.Array.each(timeTables, function(item, index, all)
  58 + {
  59 + if (!item.$className) {
  60 + values.timeTables[index] = {timeTableName : item.timeTableName, id : item.id};
  61 + }
  62 + // get Json simplified value
  63 + else {
  64 + values.timeTables[index] = item.getJsonValues();
  65 + }
  66 + });
  67 + } else
  68 + {
  69 + values.startDate = this.get('startDate');
  70 + values.stopDate = this.get('stopDate');
  71 + values.durationDay = this.get('durationDay');
  72 + values.durationHour = this.get('durationHour');
  73 + values.durationMin = this.get('durationMin');
  74 + values.durationSec = this.get('durationSec');
  75 + }
66 76  
67   - values.leaf = true;
68   - values.nodeType = 'statistics';
69   -
70   - return values;
71   - }
72   -
73   -
74   -
  77 + values.leaf = true;
  78 + values.nodeType = 'statistics';
  79 +
  80 + return values;
  81 + }
75 82 });
76 83 \ No newline at end of file
... ...
js/app/views/StatisticsUI.js
... ... @@ -53,20 +53,19 @@ Ext.define('amdaUI.StatisticsUI', {
53 53 template_args: {}
54 54 };
55 55  
56   -// if (components) {
57   -// if (components['index1']) {
58   -// paramObj['dim1-index'] = components['index1'];
59   -// ++paramObj['type'];
60   -// }
61   -//
62   -// if (components['index2']) {
63   -// paramObj['dim2-index'] = components['index2'];
64   -// ++paramObj['type'];
65   -// }
66   -// }
  56 + if (components) {
  57 + if (components['index1']) {
  58 + // paramObj['dim1-index'] = components['index1'];
  59 + ++paramObj['type'];
  60 + }
  61 +
  62 + if (components['index2']) {
  63 + // paramObj['dim2-index'] = components['index2'];
  64 + ++paramObj['type'];
  65 + }
  66 + }
67 67  
68   - var r = Ext.create('amdaModel.DownloadParam', paramObj);
69   -
  68 + var r = Ext.create('amdaModel.DownloadParam', paramObj);
70 69 this.paramGrid.getStore().add(r);
71 70 this.paramGrid.getSelectionModel().select(this.paramGrid.getStore().getCount()-1);
72 71 // var pos = this.paramGrid.store.getCount();
... ... @@ -96,12 +95,11 @@ Ext.define('amdaUI.StatisticsUI', {
96 95 module.linkedNode.execute();
97 96 },
98 97  
99   - /**
100   - * update this.object from form
101   - */
102   -
  98 + /*
  99 + * Update this.object from form
  100 + */
103 101 updateObject : function(){
104   - // get the basic form of the left
  102 + // get the basic form of the left
105 103 var basicForm = this.formPanel.items.items[0].getForm();
106 104 var updateStatus = true;
107 105  
... ... @@ -112,11 +110,13 @@ Ext.define('amdaUI.StatisticsUI', {
112 110 var recs = this.paramGrid.getStore().getNewRecords();
113 111 var paramArr = new Array();
114 112  
115   - Ext.Array.each(recs, function(rec, index,allItems)
  113 + Ext.Array.each(recs, function(rec, index, allItems)
116 114 {
117 115 var obj = new Object();
118   - obj.param = rec.get('name');
  116 + obj.param = rec.get('paramid');
  117 + obj.template_args = rec.get('template_args');
119 118 obj.function = rec.get('function');
  119 +
120 120 if (obj.function == null)
121 121 {
122 122 myDesktopApp.warningMsg('Please select function : `click to select`');
... ... @@ -144,7 +144,7 @@ Ext.define('amdaUI.StatisticsUI', {
144 144 // set valid intervals into TimeTable object
145 145 if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0])
146 146 this.object.set('timeTables',this.timeSelector.TTGrid.getStore().data.items);
147   -
  147 +
148 148 return updateStatus;
149 149 },
150 150  
... ...