Commit 2e7079bbf98baf8e484e893cb42bc9f9e336fdd6

Authored by Benjamin Renard
1 parent 4667889e

First implementation to save statistics requests

generic_data/operations.json
1 {"nodes": [ 1 {"nodes": [
2 {"nodeType" : "request", "text" : "Plot", "id" : "request-treeRootNode"} , 2 {"nodeType" : "request", "text" : "Plot", "id" : "request-treeRootNode"} ,
3 {"nodeType" : "download", "text" : "Download", "id" : "download-treeRootNode"} , 3 {"nodeType" : "download", "text" : "Download", "id" : "download-treeRootNode"} ,
4 - {"nodeType" : "condition","text" : "Data Mining","id" : "condition-treeRootNode" } 4 + {"nodeType" : "condition","text" : "Data Mining","id" : "condition-treeRootNode" },
  5 + {"nodeType" : "statistic","text" : "Statistic","id" : "statistic-treeRootNode" }
5 ]} 6 ]}
js/app/controllers/ExplorerModule.js
@@ -48,7 +48,7 @@ Ext.define('amdaDesktop.ExplorerModule', @@ -48,7 +48,7 @@ Ext.define('amdaDesktop.ExplorerModule',
48 'amdaModel.Download', 48 'amdaModel.Download',
49 'amdaModel.TimeTable', 49 'amdaModel.TimeTable',
50 'amdaModel.Catalog', 50 'amdaModel.Catalog',
51 - 'amdaModel.Stats', 51 + 'amdaModel.Statistic',
52 'amdaModel.FileObject', 52 'amdaModel.FileObject',
53 'amdaModel.FileParamObject', 53 'amdaModel.FileParamObject',
54 'amdaModel.FilterInfo' 54 'amdaModel.FilterInfo'
js/app/controllers/JobsMgr.js
@@ -94,7 +94,7 @@ Ext.define('amdaDesktop.JobsMgr', { @@ -94,7 +94,7 @@ Ext.define('amdaDesktop.JobsMgr', {
94 case 'download': 94 case 'download':
95 type = 'Download ' 95 type = 'Download '
96 break 96 break
97 - case 'statistics': 97 + case 'statistic':
98 type = 'Statistics ' 98 type = 'Statistics '
99 break 99 break
100 default: 100 default:
@@ -161,7 +161,7 @@ Ext.define('amdaDesktop.JobsMgr', { @@ -161,7 +161,7 @@ Ext.define('amdaDesktop.JobsMgr', {
161 resRootNode = root.findChild('id', bkgJob.RES_ROOT_NODE.DOWNLOAD, true) 161 resRootNode = root.findChild('id', bkgJob.RES_ROOT_NODE.DOWNLOAD, true)
162 jobRootNode = root.findChild('id', bkgJob.JOB_ROOT_NODE.DOWNLOAD, true) 162 jobRootNode = root.findChild('id', bkgJob.JOB_ROOT_NODE.DOWNLOAD, true)
163 break 163 break
164 - case 'statistics': 164 + case 'statistic':
165 resRootNode = root.findChild('id', bkgJob.RES_ROOT_NODE.STATISTICS, true) 165 resRootNode = root.findChild('id', bkgJob.RES_ROOT_NODE.STATISTICS, true)
166 jobRootNode = root.findChild('id', bkgJob.JOB_ROOT_NODE.STATISTICS, true) 166 jobRootNode = root.findChild('id', bkgJob.JOB_ROOT_NODE.STATISTICS, true)
167 break 167 break
js/app/controllers/StatisticsModule.js
@@ -21,7 +21,7 @@ Ext.define('amdaDesktop.StatisticsModule', { @@ -21,7 +21,7 @@ Ext.define('amdaDesktop.StatisticsModule', {
21 * @required 21 * @required
22 */ 22 */
23 nodeDataModel : 'amdaModel.StatisticsNode', 23 nodeDataModel : 'amdaModel.StatisticsNode',
24 - objectDataModel : 'amdaModel.Stats', 24 + objectDataModel : 'amdaModel.Statistic',
25 /** 25 /**
26 * @cfg {String} window definitions 26 * @cfg {String} window definitions
27 * @required 27 * @required
@@ -31,15 +31,6 @@ Ext.define('amdaDesktop.StatisticsModule', { @@ -31,15 +31,6 @@ Ext.define('amdaDesktop.StatisticsModule', {
31 uiType : 'panelStatistics', 31 uiType : 'panelStatistics',
32 helpTitle : 'Help on Statistics Module', 32 helpTitle : 'Help on Statistics Module',
33 helpFile : 'statisticsHelp', 33 helpFile : 'statisticsHelp',
34 - /**  
35 - * @override  
36 - */  
37 - createWindow : function() {  
38 - if (!this.linkedNode){  
39 - this.setLinkedNode(amdaModel.StatisticsNode);  
40 - }  
41 - this.callParent(arguments);  
42 - },  
43 34
44 saveState: function() { 35 saveState: function() {
45 var uiContent = this.getUiContent(); 36 var uiContent = this.getUiContent();
js/app/models/BkgJobNode.js
@@ -18,7 +18,7 @@ Ext.define('amdaModel.BkgJobNode', { @@ -18,7 +18,7 @@ Ext.define('amdaModel.BkgJobNode', {
18 PLOT: 'request',//'plot', 18 PLOT: 'request',//'plot',
19 CONDITION: 'condition', 19 CONDITION: 'condition',
20 DOWNLOAD: 'download', 20 DOWNLOAD: 'download',
21 - STATISTICS: 'statistics' 21 + STATISTICS: 'statistic'
22 }, 22 },
23 JOB_ROOT_NODE: { 23 JOB_ROOT_NODE: {
24 PLOT: 'bkgPlot-treeRootNode', 24 PLOT: 'bkgPlot-treeRootNode',
@@ -179,7 +179,7 @@ Ext.define('amdaModel.BkgJobNode', { @@ -179,7 +179,7 @@ Ext.define('amdaModel.BkgJobNode', {
179 case 'condition' : var type = 'Data Mining '; break; 179 case 'condition' : var type = 'Data Mining '; break;
180 case 'request' : var type = 'Plot '; break; 180 case 'request' : var type = 'Plot '; break;
181 case 'download' : var type = 'Download '; break; 181 case 'download' : var type = 'Download '; break;
182 - case 'statistics' : var type = 'Statistics '; break; 182 + case 'statistic' : var type = 'Statistics '; break;
183 default: var type = 'unknown'; 183 default: var type = 'unknown';
184 } 184 }
185 185
@@ -228,8 +228,8 @@ Ext.define('amdaModel.BkgJobNode', { @@ -228,8 +228,8 @@ Ext.define('amdaModel.BkgJobNode', {
228 resultId : result.result, 228 resultId : result.result,
229 folderId : result.folder}); 229 folderId : result.folder});
230 break; 230 break;
231 - case 'statistics' :  
232 - obj = Ext.create('amdaModel.Stats', 231 + case 'statistic' :
  232 + obj = Ext.create('amdaModel.Statistic',
233 {name: result.name, 233 {name: result.name,
234 resultId : result.result, 234 resultId : result.result,
235 folderId : result.folder}); 235 folderId : result.folder});
@@ -325,7 +325,7 @@ Ext.define('amdaModel.BkgJobNode', { @@ -325,7 +325,7 @@ Ext.define('amdaModel.BkgJobNode', {
325 case 'condition' : var type = 'Data Mining '; break; 325 case 'condition' : var type = 'Data Mining '; break;
326 case 'request' : var type = 'Plot '; break; 326 case 'request' : var type = 'Plot '; break;
327 case 'download' : var type = 'Download '; break; 327 case 'download' : var type = 'Download '; break;
328 - case 'statistics' : var type = 'Statistics '; break; 328 + case 'statistic' : var type = 'Statistics '; break;
329 default: var type = 'unknown'; 329 default: var type = 'unknown';
330 } 330 }
331 myDesktopApp.infoMsg('Your request is still running and has been assigned the name '+this.get('text')+' -- Check Jobs in Progress'); 331 myDesktopApp.infoMsg('Your request is still running and has been assigned the name '+this.get('text')+' -- Check Jobs in Progress');
js/app/models/Stats.js renamed to js/app/models/Statistic.js
1 /** 1 /**
2 * Project : AMDA-NG 2 * Project : AMDA-NG
3 - * Name : Stats.js 3 + * Name : Statistic.js
4 * Description : Statistics Object Definition 4 * Description : Statistics Object Definition
5 - * @class amdaModel.Stats  
6 - * @extends amdaModel.TimeTable 5 + * @class amdaModel.Statistic
  6 + * @extends amdaModel.AmdaTimeObject
7 * @author elena 7 * @author elena
8 */ 8 */
9 9
10 -Ext.define('amdaModel.Stats', { 10 +Ext.define('amdaModel.Statistic', {
11 extend: 'amdaModel.AmdaTimeObject', 11 extend: 'amdaModel.AmdaTimeObject',
12 - 12 +
  13 + requires: [
  14 + "amdaModel.StatisticParam"
  15 + ],
  16 +
13 fields : [ 17 fields : [
14 - { name: 'parameter' } ,  
15 - { name: 'description' } 18 + {name: 'type', type: 'string', defaultValue: 'Statistic'},
  19 + {name: 'description', type: 'string'}
16 ], 20 ],
  21 +
  22 + associations : [
  23 + {
  24 + type : 'hasMany',
  25 + model : 'amdaModel.StatisticParam',
  26 + name : 'params'
  27 + }
  28 + ],
  29 +
  30 + constructor: function(){
  31 + var me = this;
  32 + me.callParent(arguments);
  33 + if ((arguments.length > 0) && arguments[0])
  34 + {
  35 + if (arguments[0].parameter)
  36 + me.loadParams(arguments[0].parameter);
  37 + }
  38 + this.dirty = false;
  39 + },
  40 +
  41 + loadParams: function(params)
  42 + {
  43 + /* Compatability mode */
  44 + Ext.each(params, function(param, index) {
  45 + if (param.hasOwnProperty('is-init')) {
  46 + return;
  47 + }
  48 + params[index]['dim1-sum-type'] = param['dim1-is-range'] ? 1 : 0;
  49 + params[index]['dim1-min-value'] = param['dim1-min-range'];
  50 + params[index]['dim1-max-value'] = param['dim1-max-range'];
  51 + params[index]['dim2-sum-type'] = param['dim2-is-range'] ? 1 : 0;
  52 + params[index]['dim2-min-value'] = param['dim2-min-range'];
  53 + params[index]['dim2-max-value'] = param['dim2-max-range'];
  54 + params[index]['is-init'] = true;
  55 + });
  56 + this.params().loadData(params);
  57 + },
  58 +
  59 + isDirty : function() {
  60 + if (this.dirty)
  61 + return true;
  62 +
  63 + var d = false;
  64 +
  65 + this.params().each(function (param, index) {
  66 + if (param.dirty)
  67 + d = true;
  68 + });
  69 + return d;
  70 + },
17 71
18 - getJsonValues : function (hasId) 72 + getJsonValues : function ()
19 { 73 {
20 var values = new Object(); 74 var values = new Object();
21 - if (hasId) {  
22 - values.id = this.get('id');  
23 - }  
24 - 75 + values.nodeType = 'statistic';
  76 + values.type = this.get('type');
  77 + values.name = this.get('name');
25 values.timesrc = this.get('timesrc'); 78 values.timesrc = this.get('timesrc');
26 - values.name = this.get('name');  
27 -  
28 -// if (this.get('description').match(/[a-z,0-9]/gi) != null) {  
29 -// values.description = this.get('description');  
30 -// }  
31 -// if (this.get('history').match(/[a-z,0-9]/gi) != null) {  
32 -// values.history = this.get('history');  
33 -// }  
34 - values.objName = this.get('objName');  
35 - values.objFormat = this.get('objFormat');  
36 79
37 -// values.cacheToken = this.get('cacheToken');  
38 - values.parameter = this.get('parameter');  
39 -  
40 // if there's at least one parameter 80 // 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 -// } 81 + values.parameter = [];
  82 + this.params().each(function (param, index) {
  83 + values.parameter[index] = param.getJsonValues();
  84 + });
49 85
50 if (values.timesrc == amdaModel.AmdaTimeObject.inputTimeSrc[0]) 86 if (values.timesrc == amdaModel.AmdaTimeObject.inputTimeSrc[0])
51 { 87 {
@@ -75,7 +111,6 @@ Ext.define('amdaModel.Stats', { @@ -75,7 +111,6 @@ Ext.define('amdaModel.Stats', {
75 } 111 }
76 112
77 values.leaf = true; 113 values.leaf = true;
78 - values.nodeType = 'statistics';  
79 114
80 return values; 115 return values;
81 } 116 }
js/app/models/StatisticParam.js 0 โ†’ 100644
@@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
  1 +/**
  2 + * Project  : AMDA-NG
  3 + * Name : StatisticParam.js
  4 + * Description : Statistic Param Business Object Definition
  5 + * @class amdaModel.StatisticParam
  6 + * @extends amdaModel.RequestParamObject
  7 + *
  8 + * @author benjamin
  9 + * @version $Id: StatisticParam.js 2068 2021-05-20 11:27:38Z benjamin $
  10 + ******************************************************************************
  11 + * FT Id : Date : Name - Description
  12 + ******************************************************************************
  13 + * : :20/05/2021: benjamin โ€“ creation
  14 + */
  15 +
  16 +
  17 +Ext.define('amdaModel.StatisticParam', {
  18 + extend: 'amdaModel.RequestParamObject',
  19 +
  20 + fields : [
  21 + {name: 'function', type: 'string', defaultValue: ''}
  22 + ],
  23 +
  24 + getJsonValues : function ()
  25 + {
  26 + var values = this.callParent(arguments);
  27 + values['function'] = this.get('function');
  28 + return values;
  29 + }
  30 +});
js/app/models/StatisticsNode.js
@@ -10,22 +10,15 @@ @@ -10,22 +10,15 @@
10 Ext.define('amdaModel.StatisticsNode', { 10 Ext.define('amdaModel.StatisticsNode', {
11 11
12 extend: 'amdaModel.ExecutableNode', 12 extend: 'amdaModel.ExecutableNode',
13 -  
14 - singleton: true, 13 +
  14 + statics: {
  15 + nodeType: 'statistic',
  16 + objectName: 'Statistic'
  17 + },
15 18
16 - fields: [  
17 - {name: 'object', type: 'object'},  
18 - {name: 'moduleId', type: 'string', defaultValue:'statistics-win'},  
19 - {name: 'nodeType', type: 'string', defaultValue: 'statistics'},  
20 - {name: 'objectDataModel', type: 'string', defaultValue:'amdaModel.Stats'},  
21 - {name: 'jobNode', type: 'string', defaultValue: 'amdaModel.BkgJobNode'}  
22 - ],  
23 -  
24 - constructor: function(config) {  
25 - this.callParent(arguments);  
26 - this.set('nodeType','statistics');  
27 - },  
28 - isExecutable: function(){  
29 - return true; 19 + constructor: function(config) {
  20 + this.callParent(arguments);
  21 + this.set('moduleId',myDesktopApp.dynamicModules.statistics.id);
  22 + this.set('objectDataModel',amdaModel.Statistic.$className);
30 } 23 }
31 }); 24 });
js/app/stores/ExplorerReader.js
@@ -48,7 +48,9 @@ Ext.define('amdaReader.ExplorerReader', { @@ -48,7 +48,9 @@ Ext.define('amdaReader.ExplorerReader', {
48 case 'request' : 48 case 'request' :
49 return amdaModel.PlotNode; 49 return amdaModel.PlotNode;
50 case 'download' : 50 case 'download' :
51 - return amdaModel.DownloadNode; 51 + return amdaModel.DownloadNode;
  52 + case 'statistic' :
  53 + return amdaModel.StatisticsNode;
52 case 'bkgWorks' : 54 case 'bkgWorks' :
53 return amdaModel.BkgJobNode; 55 return amdaModel.BkgJobNode;
54 default: 56 default:
js/app/views/ExplorerUI.js
@@ -589,6 +589,7 @@ Ext.define('amdaUI.ExplorerUI', { @@ -589,6 +589,7 @@ Ext.define('amdaUI.ExplorerUI', {
589 case 'request' : 589 case 'request' :
590 case 'condition' : 590 case 'condition' :
591 case 'download': 591 case 'download':
  592 + case 'statistic':
592 record.editLeaf(); 593 record.editLeaf();
593 break; 594 break;
594 case 'localParam' : 595 case 'localParam' :
js/app/views/StatisticsUI.js
@@ -13,18 +13,11 @@ Ext.define('amdaUI.StatisticsUI', @@ -13,18 +13,11 @@ Ext.define('amdaUI.StatisticsUI',
13 alias: 'widget.panelStatistics', 13 alias: 'widget.panelStatistics',
14 14
15 requires: [ 15 requires: [
16 - //'amdaModel.Function'  
17 'amdaUI.TimeSelectorUI', 16 'amdaUI.TimeSelectorUI',
18 'amdaUI.ParamArgumentsPlug', 17 'amdaUI.ParamArgumentsPlug',
19 - 'amdaModel.DownloadParam',  
20 - 'amdaModel.RequestParamObject' 18 + 'amdaModel.StatisticParam'
21 ], 19 ],
22 20
23 - statics:  
24 - {  
25 - // functionStore : null  
26 - },  
27 -  
28 constructor: function (config) 21 constructor: function (config)
29 { 22 {
30 this.init(config); 23 this.init(config);
@@ -41,7 +34,13 @@ Ext.define('amdaUI.StatisticsUI', @@ -41,7 +34,13 @@ Ext.define('amdaUI.StatisticsUI',
41 // load object into form 34 // load object into form
42 var basicForm = this.formPanel.items.items[1].getForm(); 35 var basicForm = this.formPanel.items.items[1].getForm();
43 basicForm.loadRecord(this.object); 36 basicForm.loadRecord(this.object);
  37 + // set parameters
  38 + this.paramGrid.reconfigure(this.object.params());
  39 + },
44 40
  41 + setObject: function (obj) {
  42 + this.object = obj;
  43 + this.loadObject();
45 }, 44 },
46 45
47 onApplyParameterArgs: function (parentUI, paramObject) 46 onApplyParameterArgs: function (parentUI, paramObject)
@@ -67,7 +66,7 @@ Ext.define('amdaUI.StatisticsUI', @@ -67,7 +66,7 @@ Ext.define('amdaUI.StatisticsUI',
67 } 66 }
68 } 67 }
69 68
70 - var r = Ext.create('amdaModel.DownloadParam', paramObj); 69 + var r = Ext.create('amdaModel.StatisticParam', paramObj);
71 this.paramGrid.getStore().add(r); 70 this.paramGrid.getStore().add(r);
72 this.paramGrid.getSelectionModel().select(this.paramGrid.getStore().getCount() - 1); 71 this.paramGrid.getSelectionModel().select(this.paramGrid.getStore().getCount() - 1);
73 // var pos = this.paramGrid.store.getCount(); 72 // var pos = this.paramGrid.store.getCount();
@@ -86,6 +85,88 @@ Ext.define('amdaUI.StatisticsUI', @@ -86,6 +85,88 @@ Ext.define('amdaUI.StatisticsUI',
86 paramArgsPlug.show('statistics-param-arguments-plugin', record); 85 paramArgsPlug.show('statistics-param-arguments-plugin', record);
87 }, 86 },
88 87
  88 + saveRequest : function()
  89 + {
  90 + var me = this;
  91 +
  92 + if (!this.updateObject()) {
  93 + return;
  94 + }
  95 +
  96 + var statisticModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.statistics.id);
  97 +
  98 + if ((this.object.get('id') != '') && (statisticModule.linkedNode.get('text') == this.object.get('name'))) {
  99 + this.saveProcess(false);
  100 + return;
  101 + }
  102 +
  103 + statisticModule.linkedNode.isValidName(this.fieldName.getValue(), function (res) {
  104 + if (!res)
  105 + {
  106 + me.fieldName.validFlag = 'Error during object validation';
  107 + myDesktopApp.errorMsg(me.fieldName.validFlag);
  108 + me.fieldName.validate();
  109 + return;
  110 + }
  111 +
  112 + if (!res.valid)
  113 + {
  114 + if (res.error)
  115 + {
  116 + if (res.error.search('subtree') != -1) {
  117 + Ext.MessageBox.show({title:'Warning',
  118 + msg: res.error+'<br/>Do you want to overwrite it?',
  119 + width: 300,
  120 + buttons: Ext.MessageBox.OKCANCEL,
  121 + fn : function(btn) {
  122 + if (btn == 'cancel') return;
  123 + this.fieldName.clearInvalid();
  124 + this.saveProcess(true);
  125 + },
  126 + icon: Ext.MessageBox.WARNING,
  127 + scope : me
  128 + });
  129 + me.fieldName.validFlag = true;
  130 + }
  131 + else
  132 + me.fieldName.validFlag = res.error;
  133 + }
  134 + else
  135 + {
  136 + me.fieldName.validFlag = 'Invalid object name';
  137 + myDesktopApp.errorMsg(me.fieldName.validFlag);
  138 + }
  139 + me.fieldName.validate();
  140 + return;
  141 + }
  142 +
  143 + me.fieldName.validFlag = true;
  144 + me.fieldName.validate();
  145 + me.saveProcess(false);
  146 + });
  147 + },
  148 +
  149 + saveProcess: function(toRename) {
  150 + var statisticModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.statistics.id);
  151 + if (this.object.isModified('name')) {
  152 + if (this.object.get('id'))
  153 + {
  154 + var contextNode = statisticModule.linkedNode.parentNode;
  155 + statisticModule.createLinkedNode();
  156 + statisticModule.linkedNode.set('contextNode',contextNode);
  157 + statisticModule.createObject(this.object.getJsonValues());
  158 + var statisticObj = statisticModule.linkedNode.get('object');
  159 + this.object = statisticObj;
  160 + if (toRename) statisticModule.linkedNode.toRename = true;
  161 + }
  162 + statisticModule.linkedNode.create();
  163 + }
  164 + else {
  165 + statisticModule.linkedNode.set('contextNode',statisticModule.contextNode);
  166 + statisticModule.linkedNode.update();
  167 + }
  168 + },
  169 +
89 addTT: function (TTname, TTid) 170 addTT: function (TTname, TTid)
90 { 171 {
91 this.timeSelector.addTT(TTname, TTid); 172 this.timeSelector.addTT(TTname, TTid);
@@ -181,7 +262,7 @@ Ext.define(&#39;amdaUI.StatisticsUI&#39;, @@ -181,7 +262,7 @@ Ext.define(&#39;amdaUI.StatisticsUI&#39;,
181 init: function (config) 262 init: function (config)
182 { 263 {
183 this.fieldName = new Ext.form.field.Text({ 264 this.fieldName = new Ext.form.field.Text({
184 - fieldLabel: 'Catalog Name', 265 + fieldLabel: 'Request Name',
185 allowBlank: false, 266 allowBlank: false,
186 stripCharsRe: /(^\s+|\s+$)/g, 267 stripCharsRe: /(^\s+|\s+$)/g,
187 emptyText: 'Please no spaces!', 268 emptyText: 'Please no spaces!',
@@ -195,25 +276,15 @@ Ext.define(&#39;amdaUI.StatisticsUI&#39;, @@ -195,25 +276,15 @@ Ext.define(&#39;amdaUI.StatisticsUI&#39;,
195 } 276 }
196 }); 277 });
197 278
198 - var ttStore = Ext.create('Ext.data.Store',  
199 - {  
200 - fields: ['name', 'hidden_id']  
201 - });  
202 -  
203 this.timeSelector = new amdaUI.TimeSelectorUI({id: 'statisticsTimeSelector', flex: 1}); 279 this.timeSelector = new amdaUI.TimeSelectorUI({id: 'statisticsTimeSelector', flex: 1});
204 280
205 - var store = Ext.create('Ext.data.Store',  
206 - {  
207 - fields: ['name', 'function']  
208 - });  
209 -  
210 this.paramGrid = Ext.create('Ext.grid.Panel', 281 this.paramGrid = Ext.create('Ext.grid.Panel',
211 { 282 {
212 title: 'Select Parameter & Apply Function', 283 title: 'Select Parameter & Apply Function',
213 selType: 'rowmodel', 284 selType: 'rowmodel',
214 flex: 2, 285 flex: 2,
215 // height :250, 286 // height :250,
216 - store: store, 287 + store: Ext.create('Ext.data.Store', {model: 'amdaModel.StatisticParam'}),
217 columns: [ 288 columns: [
218 {xtype: 'rownumberer'}, 289 {xtype: 'rownumberer'},
219 { 290 {
@@ -408,7 +479,7 @@ Ext.define(&#39;amdaUI.StatisticsUI&#39;, @@ -408,7 +479,7 @@ Ext.define(&#39;amdaUI.StatisticsUI&#39;,
408 items: [this.paramGrid], 479 items: [this.paramGrid],
409 fbar: [{ 480 fbar: [{
410 type: 'button', 481 type: 'button',
411 - text: 'Generate Catalog', 482 + text: 'Generate',
412 scope: this, 483 scope: this,
413 handler: function () 484 handler: function ()
414 { 485 {
@@ -428,7 +499,16 @@ Ext.define(&#39;amdaUI.StatisticsUI&#39;, @@ -428,7 +499,16 @@ Ext.define(&#39;amdaUI.StatisticsUI&#39;,
428 this.paramGrid.store.removeAll(); 499 this.paramGrid.store.removeAll();
429 this.timeSelector.TTGrid.store.removeAll(); 500 this.timeSelector.TTGrid.store.removeAll();
430 } 501 }
431 - }] 502 + },
  503 + {
  504 + text: 'Save',
  505 + id: 'save-statistic',
  506 + scope: this,
  507 + handler: function () {
  508 + this.saveRequest();
  509 + }
  510 + }
  511 + ]
432 }, 512 },
433 { 513 {
434 xtype: 'form', 514 xtype: 'form',
js/app/views/TabResultUI.js
@@ -31,7 +31,7 @@ Ext.define(&#39;amdaUI.TabResultUI&#39;, { @@ -31,7 +31,7 @@ Ext.define(&#39;amdaUI.TabResultUI&#39;, {
31 break; 31 break;
32 case 'download': var title = 'Download Results'; 32 case 'download': var title = 'Download Results';
33 break; 33 break;
34 - case 'statistics': var title = 'Statistics Results'; 34 + case 'statistic': var title = 'Statistics Results';
35 break; 35 break;
36 default: 36 default:
37 } 37 }
@@ -319,7 +319,7 @@ Ext.define(&#39;amdaUI.ResultItem&#39;, { @@ -319,7 +319,7 @@ Ext.define(&#39;amdaUI.ResultItem&#39;, {
319 case 'condition' : 319 case 'condition' :
320 Ext.apply(this, configTT); 320 Ext.apply(this, configTT);
321 break; 321 break;
322 - case 'statistics' : 322 + case 'statistic' :
323 Ext.apply(this, configCat); 323 Ext.apply(this, configCat);
324 break; 324 break;
325 case 'request' : 325 case 'request' :
php/classes/AmdaAction.php
@@ -10,7 +10,7 @@ class AmdaAction @@ -10,7 +10,7 @@ class AmdaAction
10 'remoteSimuParam' => 'RemoteParams.xml', 'derivedParam' => 'WsParams.xml', 'myDataParam' => 'WsParams.xml', 10 'remoteSimuParam' => 'RemoteParams.xml', 'derivedParam' => 'WsParams.xml', 'myDataParam' => 'WsParams.xml',
11 'timeTable' => 'Tt.xml', 'catalog' => 'Tt.xml', 'alias' => 'Alias.xml', 11 'timeTable' => 'Tt.xml', 'catalog' => 'Tt.xml', 'alias' => 'Alias.xml',
12 'myData' => 'Files.xml', 12 'myData' => 'Files.xml',
13 - 'request' => 'Request.xml', 'condition' => 'Request.xml', 'download' => 'Request.xml', 13 + 'request' => 'Request.xml', 'condition' => 'Request.xml', 'download' => 'Request.xml', 'statistic' => 'Request.xml',
14 'bkgWorks' => 'jobs.xml'); 14 'bkgWorks' => 'jobs.xml');
15 15
16 private $user, $amdaStat; 16 private $user, $amdaStat;
@@ -172,6 +172,7 @@ class AmdaAction @@ -172,6 +172,7 @@ class AmdaAction
172 case 'download': 172 case 'download':
173 case 'condition': 173 case 'condition':
174 case 'request': 174 case 'request':
  175 + case 'statistic':
175 $objectMgr = new RequestMgr($nodeType); 176 $objectMgr = new RequestMgr($nodeType);
176 $info = $objectMgr->getObjectInfo($id); 177 $info = $objectMgr->getObjectInfo($id);
177 break; 178 break;
@@ -735,6 +736,7 @@ class AmdaAction @@ -735,6 +736,7 @@ class AmdaAction
735 case 'condition' : 736 case 'condition' :
736 case 'request' : 737 case 'request' :
737 case 'download' : 738 case 'download' :
  739 + case 'statistic':
738 $objectMgr = new RequestMgr($nodeType); 740 $objectMgr = new RequestMgr($nodeType);
739 break; 741 break;
740 case 'bkgWorks' : 742 case 'bkgWorks' :
@@ -769,6 +771,7 @@ class AmdaAction @@ -769,6 +771,7 @@ class AmdaAction
769 case 'condition' : 771 case 'condition' :
770 case 'request' : 772 case 'request' :
771 case 'download' : 773 case 'download' :
  774 + case 'statistic' :
772 $objectMgr = new RequestMgr($obj->nodeType); 775 $objectMgr = new RequestMgr($obj->nodeType);
773 break; 776 break;
774 case 'alias' : 777 case 'alias' :
@@ -808,6 +811,7 @@ class AmdaAction @@ -808,6 +811,7 @@ class AmdaAction
808 case 'condition' : 811 case 'condition' :
809 case 'request' : 812 case 'request' :
810 case 'download' : 813 case 'download' :
  814 + case 'statistic' :
811 $objectMgr = new RequestMgr($obj->nodeType); 815 $objectMgr = new RequestMgr($obj->nodeType);
812 break; 816 break;
813 case 'alias' : 817 case 'alias' :
@@ -842,6 +846,7 @@ class AmdaAction @@ -842,6 +846,7 @@ class AmdaAction
842 case 'condition' : 846 case 'condition' :
843 case 'request' : 847 case 'request' :
844 case 'download' : 848 case 'download' :
  849 + case 'statistic' :
845 $objectMgr = new RequestMgr($obj->nodeType); 850 $objectMgr = new RequestMgr($obj->nodeType);
846 break; 851 break;
847 case 'alias' : 852 case 'alias' :
@@ -873,6 +878,7 @@ class AmdaAction @@ -873,6 +878,7 @@ class AmdaAction
873 case 'condition' : 878 case 'condition' :
874 case 'request' : 879 case 'request' :
875 case 'download' : 880 case 'download' :
  881 + case 'statistic' :
876 $objectMgr = new RequestMgr($obj->nodeType); 882 $objectMgr = new RequestMgr($obj->nodeType);
877 break; 883 break;
878 default: 884 default:
@@ -900,6 +906,7 @@ class AmdaAction @@ -900,6 +906,7 @@ class AmdaAction
900 case 'condition' : 906 case 'condition' :
901 case 'request' : 907 case 'request' :
902 case 'download' : 908 case 'download' :
  909 + case 'statistic' :
903 $objectMgr = new RequestMgr($obj->nodeType); 910 $objectMgr = new RequestMgr($obj->nodeType);
904 break; 911 break;
905 default: 912 default:
php/classes/AmdaStats.php
@@ -7,13 +7,13 @@ @@ -7,13 +7,13 @@
7 class AmdaStats { 7 class AmdaStats {
8 8
9 public $statXml; 9 public $statXml;
10 - public $tasks = array('plot', 'mining', 'print', 'statistics'); 10 + public $tasks = array('plot', 'mining', 'print', 'statistic');
11 public $tasksWs = array('ws_print', 'ws_plot'); 11 public $tasksWs = array('ws_print', 'ws_plot');
12 public $tasksAdd = array('ttoper', 'samp', 'upload', 'create', 'images'); 12 public $tasksAdd = array('ttoper', 'samp', 'upload', 'create', 'images');
13 public $usersToExclude = array('bouchemit'); 13 public $usersToExclude = array('bouchemit');
14 public $success = true; 14 public $success = true;
15 private $user = null; 15 private $user = null;
16 - private $task = array('request'=>'plot','condition'=>'mining', 'download'=>'print','statistics'=>'statistics', 16 + private $task = array('request'=>'plot','condition'=>'mining', 'download'=>'print','statistic'=>'statistics',
17 'getparameter'=>'ws_print', 'getdataset' => 'ws_print', 'getorbites' => 'ws_print', 'getplot' => 'ws_plot'); 17 'getparameter'=>'ws_print', 'getdataset' => 'ws_print', 'getorbites' => 'ws_print', 'getplot' => 'ws_plot');
18 18
19 public function __construct($user) { 19 public function __construct($user) {
php/classes/RequestMgr.php
@@ -9,7 +9,7 @@ class RequestMgr extends AmdaObjectMgr @@ -9,7 +9,7 @@ class RequestMgr extends AmdaObjectMgr
9 public $obj; 9 public $obj;
10 protected $type; 10 protected $type;
11 protected $jobXml, $jobXmlName; 11 protected $jobXml, $jobXmlName;
12 - protected $types = array('request', 'download', 'condition'); 12 + protected $types = array('request', 'download', 'condition', 'statistic');
13 13
14 function __construct($type) 14 function __construct($type)
15 { 15 {
@@ -38,6 +38,10 @@ class RequestMgr extends AmdaObjectMgr @@ -38,6 +38,10 @@ class RequestMgr extends AmdaObjectMgr
38 { 38 {
39 $this->id_prefix = 'down_'; 39 $this->id_prefix = 'down_';
40 } 40 }
  41 + else if ($type == 'statistic')
  42 + {
  43 + $this->id_prefix = 'stat_';
  44 + }
41 else 45 else
42 { 46 {
43 $this->id_prefix = 'cond_'; 47 $this->id_prefix = 'cond_';
@@ -298,7 +302,7 @@ class RequestMgr extends AmdaObjectMgr @@ -298,7 +302,7 @@ class RequestMgr extends AmdaObjectMgr
298 if (count($argsTab) > 0) $args[] = $argsTab; 302 if (count($argsTab) > 0) $args[] = $argsTab;
299 303
300 break; 304 break;
301 - case 'statistics' : 305 + case 'statistic' :
302 return array('success' => true); 306 return array('success' => true);
303 break; 307 break;
304 default : 308 default :
@@ -421,6 +425,9 @@ class RequestMgr extends AmdaObjectMgr @@ -421,6 +425,9 @@ class RequestMgr extends AmdaObjectMgr
421 $info .= "Empty"; 425 $info .= "Empty";
422 } 426 }
423 break; 427 break;
  428 + case 'statistic':
  429 + $info .= "Statistic: TODO";
  430 + break;
424 default: 431 default:
425 $info .= "<b>ERROR:</b> Unknown request type"; 432 $info .= "<b>ERROR:</b> Unknown request type";
426 } 433 }