Commit 690e0a87bdd5554af58c9c26f3f5cc870b1ae20d
1 parent
e39d539f
Exists in
master
and in
111 other branches
Add sum in table range support
Showing
9 changed files
with
284 additions
and
55 deletions
Show diff stats
generic_data/ParamTemplate/ParamTemplateList.xml
1 | 1 | <?xml version="1.0"?> |
2 | 2 | |
3 | 3 | <paramTemplateList> |
4 | + <paramTemplate paramId='sum_into_table_range' fileName='sum_into_table_range_##paramid##_##relateddim##_##min##_##max##'> | |
5 | + <arguments> | |
6 | + <argument key='min' name='Min.' type='float' default='0'/> | |
7 | + <argument key='max' name='Max.' type='float' default='0'/> | |
8 | + <argument key='paramid' name='Parameter Id' type='string' default=''/> | |
9 | + <argument key='relateddim' name='Related Id' type='int' default='0'/> | |
10 | + </arguments> | |
11 | + </paramTemplate> | |
4 | 12 | <paramTemplate paramId='bmorsch_mso' fileName='bmorsch_mso_##sampling##_##orbit##'> |
5 | 13 | <arguments> |
6 | 14 | <argument key='sampling' name='Sampling Time' type='float' default='60'/> | ... | ... |
generic_data/ParamTemplate/sum_into_table_range_##paramid##_##relateddim##_##min##_##max##.xml
0 → 100644
... | ... | @@ -0,0 +1,8 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<param xml:id="sum_into_table_range_##paramid##_##relateddim##_##min##_##max##"> | |
3 | + <get> | |
4 | + <amdaParam name='##paramid##'/> | |
5 | + </get> | |
6 | + <process description="sum_into_table_range(##paramid##, ##relateddim##, ##min##, ##max##)">#sum_into_table_range($##paramid##;##relateddim##;##min##;##max##)</process> | |
7 | + <output/> | |
8 | +</param> | ... | ... |
js/app/models/PlotObjects/PlotPanelObject.js
... | ... | @@ -284,13 +284,22 @@ Ext.define('amdaPlotObj.PlotPanelObject', { |
284 | 284 | var emptyPanel = (this.params().getCount() == 0); |
285 | 285 | |
286 | 286 | var recs = this.params().add({id : this.get('last-param-id')}); |
287 | + | |
287 | 288 | recs[0].set('paramid', paramId); |
288 | 289 | |
289 | 290 | if (paramComponents) { |
290 | - if (paramComponents['index1']) | |
291 | - recs[0].set('dim1', paramComponents['index1']); | |
292 | - if (paramComponents['index2']) | |
293 | - recs[0].set('dim2', paramComponents['index2']); | |
291 | + if (paramComponents['index1']) { | |
292 | + recs[0].set('dim1-is-range', false); | |
293 | + recs[0].set('dim1-min-range', 0.); | |
294 | + recs[0].set('dim1-max-range', 0.); | |
295 | + recs[0].set('dim1-index', paramComponents['index1']); | |
296 | + } | |
297 | + if (paramComponents['index2']) { | |
298 | + recs[0].set('dim2-is-range', false); | |
299 | + recs[0].set('dim2-min-range', 0.); | |
300 | + recs[0].set('dim2-max-range', 0.); | |
301 | + recs[0].set('dim2-index', paramComponents['index2']); | |
302 | + } | |
294 | 303 | } |
295 | 304 | |
296 | 305 | var me = this; | ... | ... |
js/app/models/RequestParamObject.js
... | ... | @@ -22,8 +22,14 @@ Ext.define('amdaModel.RequestParamObject', { |
22 | 22 | fields : [ |
23 | 23 | {name: 'type', type: 'int'}, |
24 | 24 | {name: 'paramid', type: 'string'}, |
25 | - {name: 'dim1', type: 'string'}, | |
26 | - {name: 'dim2', type: 'string'}, | |
25 | + {name: 'dim1-is-range', type: 'bool', defaultValue: false}, | |
26 | + {name: 'dim1-min-range', type: 'float', defaultValue: 0.}, | |
27 | + {name: 'dim1-max-range', type: 'float', defaultValue: 0.}, | |
28 | + {name: 'dim1-index', type: 'string', defaultValue: '*'}, | |
29 | + {name: 'dim2-is-range', type: 'bool', defaultValue: false}, | |
30 | + {name: 'dim2-min-range', type: 'float', defaultValue: 0.}, | |
31 | + {name: 'dim2-max-range', type: 'float', defaultValue: 0.}, | |
32 | + {name: 'dim2-index', type: 'string', defaultValue: '*'}, | |
27 | 33 | {name: 'template_args', type: 'auto', defaultValue: null} |
28 | 34 | ], |
29 | 35 | |
... | ... | @@ -35,15 +41,31 @@ Ext.define('amdaModel.RequestParamObject', { |
35 | 41 | break; |
36 | 42 | case 1: |
37 | 43 | //Tab1D |
38 | - if ((this.get('dim1') != '') && (this.get('dim1') != '*')) | |
39 | - paramIndexes = '('+this.get('dim1')+')'; | |
40 | - else if ((this.get('dim2') != '') && (this.get('dim2') != '*')) | |
41 | - paramIndexes = '('+this.get('dim2')+')'; | |
44 | + if (this.get('dim1-is-range')) { | |
45 | + paramIndexes = '(range[' + this.get('dim1-min-range') + ',' + this.get('dim1-max-range') + '])'; | |
46 | + } | |
47 | + else if (this.get('dim2-min-range')) { | |
48 | + paramIndexes = '(range[' + this.get('dim2-min-range') + ',' + this.get('dim2-max-range') + '])'; | |
49 | + } | |
50 | + else { | |
51 | + if ((this.get('dim1-index') != '') && (this.get('dim1-index') != '*')) | |
52 | + paramIndexes = '('+this.get('dim1-index')+')'; | |
53 | + else if ((this.get('dim2-index') != '') && (this.get('dim2-index') != '*')) | |
54 | + paramIndexes = '('+this.get('dim2-index')+')'; | |
55 | + } | |
42 | 56 | break; |
43 | 57 | case 2: |
44 | 58 | //Tab2D |
45 | - var dim1 = this.get('dim1') != '' ? this.get('dim1') : "*"; | |
46 | - var dim2 = this.get('dim2') != '' ? this.get('dim2') : "*"; | |
59 | + var dim1 = ''; | |
60 | + if (this.get('dim1-is-range')) | |
61 | + dim1 = 'range[' + this.get('dim1-min-range') + ',' + this.get('dim1-max-range') + ']'; | |
62 | + else | |
63 | + dim1 = this.get('dim1-index') != '' ? this.get('dim1-index') : "*"; | |
64 | + var dim2 = ''; | |
65 | + if (this.get('dim2-min-range')) | |
66 | + dim2 = 'range[' + this.get('dim2-min-range') + ',' + this.get('dim2-max-range') + ']'; | |
67 | + else | |
68 | + dim2 = this.get('dim2-index') != '' ? this.get('dim2-index') : "*"; | |
47 | 69 | if ((dim1 != '*') || (dim2 != '*')) |
48 | 70 | paramIndexes = '('+dim1+','+dim2+')'; |
49 | 71 | } |
... | ... | @@ -66,8 +88,17 @@ Ext.define('amdaModel.RequestParamObject', { |
66 | 88 | paramValues['id'] = this.get('id'); |
67 | 89 | paramValues['paramid'] = this.get('paramid'); |
68 | 90 | paramValues['name'] = this.get('name'); |
69 | - paramValues['dim1'] = this.get('dim1'); | |
70 | - paramValues['dim2'] = this.get('dim2'); | |
91 | + | |
92 | + paramValues['dim1-is-range'] = this.get('dim1-is-range'); | |
93 | + paramValues['dim1-min-range'] = this.get('dim1-min-range'); | |
94 | + paramValues['dim1-max-range'] = this.get('dim1-max-range'); | |
95 | + paramValues['dim1-index'] = this.get('dim1-index'); | |
96 | + | |
97 | + paramValues['dim2-is-range'] = this.get('dim2-is-range'); | |
98 | + paramValues['dim2-min-range'] = this.get('dim2-min-range'); | |
99 | + paramValues['dim2-max-range'] = this.get('dim2-max-range'); | |
100 | + paramValues['dim2-index'] = this.get('dim2-index'); | |
101 | + | |
71 | 102 | paramValues['type'] = this.get('type'); |
72 | 103 | |
73 | 104 | if (this.get('template_args') != null) { | ... | ... |
js/app/views/DownloadUI.js
... | ... | @@ -88,23 +88,33 @@ Ext.define('amdaUI.DownloadUI', { |
88 | 88 | { |
89 | 89 | // adding the parameter to the paramGrid |
90 | 90 | |
91 | - var type = 0; | |
92 | - var dim1 = ''; | |
93 | - var dim2 = ''; | |
91 | + var paramObj = { | |
92 | + paramid: paramId, | |
93 | + type: 0, | |
94 | + 'dim1-is-range': false, | |
95 | + 'dim1-min-range': 0., | |
96 | + 'dim1-max-range': 0., | |
97 | + 'dim1-index': '*', | |
98 | + 'dim2-is-range': false, | |
99 | + 'dim2-min-range': 0., | |
100 | + 'dim2-max-range': 0., | |
101 | + 'dim2-index': '*', | |
102 | + template_args: {} | |
103 | + }; | |
94 | 104 | |
95 | 105 | if (components) { |
96 | 106 | if (components['index1']) { |
97 | - dim1 = components['index1']; | |
98 | - ++type; | |
107 | + paramObj['dim1-index'] = components['index1']; | |
108 | + ++paramObj['type']; | |
99 | 109 | } |
100 | 110 | |
101 | 111 | if (components['index2']) { |
102 | - dim2 = components['index2']; | |
103 | - ++type; | |
112 | + paramObj['dim2-index'] = components['index2']; | |
113 | + ++paramObj['type']; | |
104 | 114 | } |
105 | 115 | } |
106 | 116 | |
107 | - var r = Ext.create('amdaModel.DownloadParam', {paramid: paramId, type: type, dim1: dim1, dim2: dim2, template_args: {} }); | |
117 | + var r = Ext.create('amdaModel.DownloadParam', paramObj); | |
108 | 118 | var pos = this.paramGrid.store.getCount(); |
109 | 119 | this.paramGrid.store.insert(pos,r); |
110 | 120 | this.paramGrid.getView().refresh(); |
... | ... | @@ -122,7 +132,21 @@ Ext.define('amdaUI.DownloadUI', { |
122 | 132 | Ext.Array.each(arrayParams,function(item){ |
123 | 133 | if (Ext.isObject(item)) { |
124 | 134 | // for Parameter Name in Download Module |
125 | - var r = Ext.create('amdaModel.DownloadParam', { paramid: item.get('paramid'), type: item.get('type'), dim1: item.get('dim1'), dim2: item.get('dim2')}); | |
135 | + var paramObj = { | |
136 | + paramid: paramId, | |
137 | + type: 0, | |
138 | + 'dim1-is-range': false, | |
139 | + 'dim1-min-range': 0., | |
140 | + 'dim1-max-range': 0., | |
141 | + 'dim1-index': item.get('dim1'), | |
142 | + 'dim2-is-range': false, | |
143 | + 'dim2-min-range': 0., | |
144 | + 'dim2-max-range': 0., | |
145 | + 'dim2-index': item.get('dim2'), | |
146 | + template_args: {} | |
147 | + }; | |
148 | + | |
149 | + var r = Ext.create('amdaModel.DownloadParam', paramObj); | |
126 | 150 | } |
127 | 151 | else { |
128 | 152 | // for Download By Request in Operations menu | ... | ... |
js/app/views/ParamArgumentsPlug.js
... | ... | @@ -41,6 +41,20 @@ Ext.define('amdaUI.ParamArgumentsPlug', { |
41 | 41 | init: function(cmp) { |
42 | 42 | this.hostCmp = cmp; |
43 | 43 | }, |
44 | + | |
45 | + computeHeight: function() { | |
46 | + if (!this.paramArgs) | |
47 | + return 0; | |
48 | + var maxPos = 0; | |
49 | + this.paramArgs.items.each(function(item) { | |
50 | + if (!item.isVisible()) | |
51 | + return; | |
52 | + var crtPos = item.getPosition(true); | |
53 | + if (maxPos < crtPos[1] + item.getHeight()) | |
54 | + maxPos = crtPos[1] + item.getHeight(); | |
55 | + }); | |
56 | + return maxPos + 75; | |
57 | + }, | |
44 | 58 | |
45 | 59 | /** |
46 | 60 | * creation of the window |
... | ... | @@ -91,7 +105,7 @@ Ext.define('amdaUI.ParamArgumentsPlug', { |
91 | 105 | var workingParamObject = this.paramObject.copy(); |
92 | 106 | var me = this; |
93 | 107 | this.paramArgs.editParameter(workingParamObject, this.hostCmp, function() { |
94 | - me.win.setHeight(me.paramArgs.items.getCount() * 30 + 75); | |
108 | + me.win.setHeight(me.computeHeight()); | |
95 | 109 | }); |
96 | 110 | |
97 | 111 | this.hostCmp.setDisabled(true); |
... | ... | @@ -104,6 +118,11 @@ Ext.define('amdaUI.ParamArgumentsPlug', { |
104 | 118 | this.win.close(); |
105 | 119 | }, |
106 | 120 | |
121 | + onModifyHeight : function(pluginOwner) { | |
122 | + if (pluginOwner && pluginOwner.win) | |
123 | + pluginOwner.win.setHeight(pluginOwner.computeHeight()); | |
124 | + }, | |
125 | + | |
107 | 126 | /** |
108 | 127 | * Main form |
109 | 128 | */ |
... | ... | @@ -111,6 +130,9 @@ Ext.define('amdaUI.ParamArgumentsPlug', { |
111 | 130 | this.paramArgs = Ext.create('amdaUI.ParamArgumentsUI', { |
112 | 131 | }); |
113 | 132 | |
133 | + this.paramArgs.onModifyHeight = this.onModifyHeight; | |
134 | + this.paramArgs.pluginOwner = this; | |
135 | + | |
114 | 136 | var me = this; |
115 | 137 | this.form = new Ext.form.FormPanel( { |
116 | 138 | frame: true, | ... | ... |
js/app/views/ParamArgumentsUI.js
... | ... | @@ -17,6 +17,8 @@ Ext.define('amdaUI.ParamArgumentsUI', { |
17 | 17 | |
18 | 18 | paramRequestObject: null, |
19 | 19 | onChange: null, |
20 | + onModifyHeight: null, | |
21 | + pluginOwner: null, | |
20 | 22 | |
21 | 23 | // -1 -> unknown, 0 -> scalar, 1 -> Tab1D, 2 -> Tab2D |
22 | 24 | paramType: 0, |
... | ... | @@ -90,7 +92,21 @@ Ext.define('amdaUI.ParamArgumentsUI', { |
90 | 92 | if (this.paramRequestObject.get('template_args') && this.paramRequestObject.get('template_args')[arg_key]) |
91 | 93 | item.setValue(this.paramRequestObject.get('template_args')[arg_key]); |
92 | 94 | } |
93 | - else if (this.paramRequestObject.get(item.argId)) | |
95 | + else if (item.argId == 'dim1' || item.argId == 'dim2') { | |
96 | + item.setValue(this.paramRequestObject.get(item.argId+'-index')); | |
97 | + var minRangeField = this.down('textfield[name=range_min_' + item.argId + ']'); | |
98 | + var maxRangeField = this.down('textfield[name=range_max_' + item.argId + ']'); | |
99 | + if (minRangeField && maxRangeField) { | |
100 | + minRangeField.setValue(this.paramRequestObject.get(item.argId+'-min-range')); | |
101 | + maxRangeField.setValue(this.paramRequestObject.get(item.argId+'-max-range')); | |
102 | + var isRangeField = minRangeField.up(); | |
103 | + if (this.paramRequestObject.get(item.argId+'-is-range')) | |
104 | + isRangeField.expand(); | |
105 | + else | |
106 | + isRangeField.collapse(); | |
107 | + } | |
108 | + } | |
109 | + else | |
94 | 110 | item.setValue(this.paramRequestObject.get(item.argId)); |
95 | 111 | }, this); |
96 | 112 | }, |
... | ... | @@ -115,7 +131,8 @@ Ext.define('amdaUI.ParamArgumentsUI', { |
115 | 131 | |
116 | 132 | resetValues: function() { |
117 | 133 | this.items.each(function (item) { |
118 | - item.reset(); | |
134 | + if (item.reset) | |
135 | + item.reset(); | |
119 | 136 | }); |
120 | 137 | }, |
121 | 138 | |
... | ... | @@ -131,11 +148,11 @@ Ext.define('amdaUI.ParamArgumentsUI', { |
131 | 148 | this.paramType = -1; |
132 | 149 | if (result.data && result.data.dimensions) { |
133 | 150 | this.paramType = 0; |
134 | - if (result.data.dimensions.dim1 && (parseInt(result.data.dimensions.dim1) > 1)) { | |
151 | + if (result.data.dimensions.dim1 && (parseInt(result.data.dimensions.dim1) > 1) || this.getRelatedTableFromDim('dim1',result.data.tables)) { | |
135 | 152 | this.buildDimIndexSelection("dim1", result.data, uiScope); |
136 | 153 | ++this.paramType; |
137 | 154 | } |
138 | - if (result.data.dimensions.dim2 && (parseInt(result.data.dimensions.dim2) > 1)) { | |
155 | + if (result.data.dimensions.dim2 && (parseInt(result.data.dimensions.dim2) > 1) || this.getRelatedTableFromDim('dim2',result.data.tables)) { | |
139 | 156 | this.buildDimIndexSelection("dim2", result.data, uiScope); |
140 | 157 | ++this.paramType; |
141 | 158 | } |
... | ... | @@ -150,30 +167,36 @@ Ext.define('amdaUI.ParamArgumentsUI', { |
150 | 167 | this.resetArguments(false); |
151 | 168 | }, |
152 | 169 | |
153 | - buildDimIndexSelection: function(relatedDim, data, uiScope) { | |
154 | - //Check if this dimension is attached to a table | |
155 | - var relatedTable = null; | |
156 | - if (data.tables) { | |
157 | - Ext.each(data.tables, function(table, index) { | |
170 | + getRelatedTableFromDim : function(relatedDim, tables) { | |
171 | + var relatedTable = null; | |
172 | + if (tables) { | |
173 | + Ext.each(tables, function(table, index) { | |
158 | 174 | if (table.relatedDim == relatedDim) |
159 | 175 | relatedTable = table; |
160 | 176 | }, this); |
161 | 177 | } |
162 | - | |
178 | + return relatedTable; | |
179 | + }, | |
180 | + | |
181 | + buildDimIndexSelection: function(relatedDim, data, uiScope) { | |
182 | + //Check if this dimension is attached to a table | |
183 | + var relatedTable = this.getRelatedTableFromDim(relatedDim, data.tables); | |
184 | + | |
163 | 185 | var title = ''; |
164 | 186 | |
165 | 187 | var indexes = []; |
166 | 188 | indexes.push({'key' : '*', 'value' : 'All'}); |
167 | 189 | |
168 | 190 | if (relatedTable) { |
169 | - //If a table is defined for this dimension | |
191 | + //If it's not a variable table => enable channel selection | |
170 | 192 | title = relatedTable.name; |
171 | 193 | if (relatedTable.units != '') |
172 | 194 | title += ' (' + relatedTable.units + ')'; |
173 | 195 | |
174 | - Ext.Object.each(relatedTable.channels, function (index, channel) { | |
175 | - indexes.push({'key' : index.toString(), 'value' : index + ' : [' + channel.min + ', ' + channel.max + ']'}); | |
176 | - }); | |
196 | + if (!relatedTable.variable) | |
197 | + Ext.Object.each(relatedTable.channels, function (index, channel) { | |
198 | + indexes.push({'key' : index.toString(), 'value' : index + ' : [' + channel.min + ', ' + channel.max + ']'}); | |
199 | + }); | |
177 | 200 | } |
178 | 201 | else { |
179 | 202 | //Else, use components |
... | ... | @@ -205,9 +228,10 @@ Ext.define('amdaUI.ParamArgumentsUI', { |
205 | 228 | value: '*', |
206 | 229 | editable: false, |
207 | 230 | argId: relatedDim, |
231 | + hidden: (relatedTable ? relatedTable.variable : false), | |
208 | 232 | listeners: { |
209 | 233 | change: function(field, newValue, oldValue, eOpts) { |
210 | - this.paramRequestObject.set(relatedDim, newValue); | |
234 | + this.paramRequestObject.set(relatedDim+'-index', newValue); | |
211 | 235 | if (this.onChange != null) |
212 | 236 | this.onChange(uiScope, relatedDim, newValue, oldValue, false); |
213 | 237 | }, |
... | ... | @@ -218,6 +242,89 @@ Ext.define('amdaUI.ParamArgumentsUI', { |
218 | 242 | |
219 | 243 | this.add(indexesCombo); |
220 | 244 | |
245 | + if (relatedTable) { | |
246 | + var rangeItems = [ | |
247 | + { | |
248 | + xtype: 'numberfield', | |
249 | + name: 'range_min_'+relatedDim, | |
250 | + fieldLabel: 'Min.', | |
251 | + decimalPrecision : 3, | |
252 | + value: 0., | |
253 | + listeners: { | |
254 | + change: function(field, newValue, oldValue, eOpts) { | |
255 | + this.paramRequestObject.set(relatedDim+'-min-range', newValue); | |
256 | + if (this.onChange != null) | |
257 | + this.onChange(uiScope, relatedDim, newValue, oldValue, false); | |
258 | + }, | |
259 | + scope: this | |
260 | + } | |
261 | + }, | |
262 | + { | |
263 | + xtype: 'numberfield', | |
264 | + name: 'range_max_'+relatedDim, | |
265 | + fieldLabel: 'Max.', | |
266 | + decimalPrecision : 3, | |
267 | + value: 0., | |
268 | + listeners: { | |
269 | + change: function(field, newValue, oldValue, eOpts) { | |
270 | + this.paramRequestObject.set(relatedDim+'-max-range', newValue); | |
271 | + if (this.onChange != null) | |
272 | + this.onChange(uiScope, relatedDim, newValue, oldValue, false); | |
273 | + }, | |
274 | + scope: this | |
275 | + } | |
276 | + } | |
277 | + ]; | |
278 | + | |
279 | + var sumRangeFieldSet = Ext.create('Ext.form.FieldSet', { | |
280 | + title: relatedTable.variable ? title + " - Sum. in range" : "Sum. in range", | |
281 | + collapsed: true, | |
282 | + checkboxName: 'range_checkbox_'+relatedDim, | |
283 | + checkboxToggle: true, | |
284 | + name: 'range_fieldset_'+relatedDim, | |
285 | + layout: { | |
286 | + type: 'vbox', | |
287 | + pack: 'start', | |
288 | + align: 'stretch' | |
289 | + }, | |
290 | + items: rangeItems, | |
291 | + listeners: { | |
292 | + expand: function(fieldset, eOpts) { | |
293 | + | |
294 | + if (indexesCombo.getValue() == "*") { | |
295 | + Ext.Object.each(relatedTable.channels, function (index, channel) { | |
296 | + //ToDo | |
297 | + }); | |
298 | + } | |
299 | + else | |
300 | + { | |
301 | + //ToDo | |
302 | + } | |
303 | + indexesCombo.setDisabled(true); | |
304 | + | |
305 | + this.paramRequestObject.set(relatedDim+'-is-range', true); | |
306 | + if (this.onChange != null) | |
307 | + this.onChange(uiScope, relatedDim, true, false, false); | |
308 | + if (this.onModifyHeight) | |
309 | + this.onModifyHeight(this.pluginOwner); | |
310 | + | |
311 | + }, | |
312 | + collapse: function(fieldset, eOpts) { | |
313 | + indexesCombo.setDisabled(false); | |
314 | + | |
315 | + this.paramRequestObject.set(relatedDim+'-is-range', false); | |
316 | + if (this.onChange != null) | |
317 | + this.onChange(uiScope, relatedDim, false, true, false); | |
318 | + if (this.onModifyHeight) | |
319 | + this.onModifyHeight(this.pluginOwner); | |
320 | + }, | |
321 | + scope: this | |
322 | + } | |
323 | + }); | |
324 | + | |
325 | + this.add(sumRangeFieldSet); | |
326 | + } | |
327 | + | |
221 | 328 | return indexesCombo; |
222 | 329 | }, |
223 | 330 | ... | ... |
js/app/views/ParameterUI.js
... | ... | @@ -54,25 +54,35 @@ Ext.define('amdaUI.ParameterUI', { |
54 | 54 | }, |
55 | 55 | |
56 | 56 | editParameterArgs: function(name, components) { |
57 | - var type = 0; | |
58 | - var dim1 = ''; | |
59 | - var dim2 = ''; | |
57 | + var paramObj = { | |
58 | + paramid: name, | |
59 | + type: 0, | |
60 | + 'dim1-is-range': false, | |
61 | + 'dim1-min-range': 0., | |
62 | + 'dim1-max-range': 0., | |
63 | + 'dim1-index': '*', | |
64 | + 'dim2-is-range': false, | |
65 | + 'dim2-min-range': 0., | |
66 | + 'dim2-max-range': 0., | |
67 | + 'dim2-index': '*', | |
68 | + template_args: {} | |
69 | + }; | |
60 | 70 | |
61 | 71 | if (components) { |
62 | 72 | if (components['index1']) { |
63 | - dim1 = components['index1']; | |
64 | - ++type; | |
73 | + paramObj['dim1-index'] = components['index1']; | |
74 | + ++paramObj['type']; | |
65 | 75 | } |
66 | 76 | |
67 | 77 | if (components['index2']) { |
68 | - dim2 = components['index2']; | |
69 | - ++type; | |
78 | + paramObj['dim2-index'] = components['index2']; | |
79 | + ++paramObj['type']; | |
70 | 80 | } |
71 | 81 | } |
72 | 82 | |
73 | 83 | var paramArgsPlug = this.getPlugin('derived-param-arguments-plugin'); |
74 | 84 | if (paramArgsPlug) { |
75 | - var workinRequestParamObject = Ext.create('amdaModel.RequestParamObject', {paramid: name, type: type, dim1: dim1, dim2: dim2, template_args: {} }); | |
85 | + var workinRequestParamObject = Ext.create('amdaModel.RequestParamObject', paramObj); | |
76 | 86 | paramArgsPlug.show('derived-param-arguments-plugin', workinRequestParamObject); |
77 | 87 | } |
78 | 88 | }, | ... | ... |
js/app/views/SearchUI.js
... | ... | @@ -59,25 +59,35 @@ Ext.define('amdaUI.SearchUI', { |
59 | 59 | }, |
60 | 60 | |
61 | 61 | editParameterArgs: function(name, components) { |
62 | - var type = 0; | |
63 | - var dim1 = ''; | |
64 | - var dim2 = ''; | |
62 | + var paramObj = { | |
63 | + paramid: name, | |
64 | + type: 0, | |
65 | + 'dim1-is-range': false, | |
66 | + 'dim1-min-range': 0., | |
67 | + 'dim1-max-range': 0., | |
68 | + 'dim1-index': '*', | |
69 | + 'dim2-is-range': false, | |
70 | + 'dim2-min-range': 0., | |
71 | + 'dim2-max-range': 0., | |
72 | + 'dim2-index': '*', | |
73 | + template_args: {} | |
74 | + }; | |
65 | 75 | |
66 | 76 | if (components) { |
67 | 77 | if (components['index1']) { |
68 | - dim1 = components['index1']; | |
69 | - ++type; | |
78 | + paramObj['dim1-index'] = components['index1']; | |
79 | + ++paramObj['type']; | |
70 | 80 | } |
71 | 81 | |
72 | 82 | if (components['index2']) { |
73 | - dim2 = components['index2']; | |
74 | - ++type; | |
83 | + paramObj['dim2-index'] = components['index2']; | |
84 | + ++paramObj['type']; | |
75 | 85 | } |
76 | 86 | } |
77 | 87 | |
78 | 88 | var paramArgsPlug = this.getPlugin('search-param-components-plugin'); |
79 | 89 | if (paramArgsPlug) { |
80 | - var workinRequestParamObject = Ext.create('amdaModel.RequestParamObject', {paramid: name, type: type, dim1: dim1, dim2: dim2, template_args: {} }); | |
90 | + var workinRequestParamObject = Ext.create('amdaModel.RequestParamObject', paramObj); | |
81 | 91 | paramArgsPlug.show('search-param-components-plugin', workinRequestParamObject); |
82 | 92 | } |
83 | 93 | }, | ... | ... |