Commit b1a45580ae04ca46347a961c5612d38eb9a90879

Authored by Benjamin Renard
1 parent 29dfb596

Add compatibility mode with previous version + fix some bugs

js/app/models/PlotObjects/PlotPanelObject.js
... ... @@ -179,6 +179,19 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
179 179  
180 180 loadParams: function(params)
181 181 {
  182 + /* Compatability mode */
  183 + Ext.each(params, function(param, index) {
  184 + if (param.hasOwnProperty('is-init')) {
  185 + return;
  186 + }
  187 + params[index]['dim1-sum-type'] = param['dim1-is-range'] ? 1 : 0;
  188 + params[index]['dim1-min-value'] = param['dim1-min-range'];
  189 + params[index]['dim1-max-value'] = param['dim1-max-range'];
  190 + params[index]['dim2-sum-type'] = param['dim2-is-range'] ? 1 : 0;
  191 + params[index]['dim2-min-value'] = param['dim2-min-range'];
  192 + params[index]['dim2-max-value'] = param['dim2-max-range'];
  193 + params[index]['is-init'] = true;
  194 + });
182 195 this.params().loadData(params);
183 196 },
184 197  
... ...
js/app/models/RequestParamObject.js
... ... @@ -56,10 +56,10 @@ Ext.define('amdaModel.RequestParamObject', {
56 56 /* Fields for dim2 */
57 57 {name: 'dim2-index', type: 'string', defaultValue: '*'},
58 58 {name: 'dim2-sum-type', type: 'int', defaultValue: 0}, /* Sum type. 0: None, 1: sum into values range, 2: sum between indexes */
59   - {name: 'dim1-min-value', type: 'float', defaultValue: 0.},
60   - {name: 'dim1-max-value', type: 'float', defaultValue: 0.},
61   - {name: 'dim1-min-index', type: 'int', defaultValue: 0},
62   - {name: 'dim1-max-index', type: 'int', defaultValue: 0},
  59 + {name: 'dim2-min-value', type: 'float', defaultValue: 0.},
  60 + {name: 'dim2-max-value', type: 'float', defaultValue: 0.},
  61 + {name: 'dim2-min-index', type: 'int', defaultValue: 0},
  62 + {name: 'dim2-max-index', type: 'int', defaultValue: 0},
63 63 /* Field for arguments of a templated parameter */
64 64 {name: 'template_args', type: 'auto', defaultValue: null},
65 65 /* ?? */
... ... @@ -141,35 +141,20 @@ Ext.define('amdaModel.RequestParamObject', {
141 141  
142 142 paramValues['dim1-index'] = this.get('dim1-index');
143 143 paramValues['dim1-sum-type'] = this.get('dim1-sum-type');
144   - switch (this.get('dim1-sum-type')) {
145   - case 1:
146   - // Between values
147   - paramValues['dim1-sum-min'] = this.get('dim1-min-value');
148   - paramValues['dim1-sum-max'] = this.get('dim1-max-value');
149   - break;
150   - case 2:
151   - // Between components indexes
152   - paramValues['dim1-sum-min'] = this.get('dim1-min-index');
153   - paramValues['dim1-sum-max'] = this.get('dim1-max-index');
154   - break;
155   - }
156   -
  144 + paramValues['dim1-min-value'] = this.get('dim1-min-value');
  145 + paramValues['dim1-max-value'] = this.get('dim1-max-value');
  146 + paramValues['dim1-min-index'] = this.get('dim1-min-index');
  147 + paramValues['dim1-max-index'] = this.get('dim1-max-index');
  148 +
157 149 paramValues['dim2-index'] = this.get('dim2-index');
158 150 paramValues['dim2-sum-type'] = this.get('dim2-sum-type');
159   - switch (this.get('dim2-sum-type')) {
160   - case 1:
161   - // Between values
162   - paramValues['dim2-sum-min'] = this.get('dim2-min-value');
163   - paramValues['dim2-sum-max'] = this.get('dim2-max-value');
164   - break;
165   - case 2:
166   - // Between components indexes
167   - paramValues['dim2-sum-min'] = this.get('dim2-min-index');
168   - paramValues['dim2-sum-max'] = this.get('dim2-max-index');
169   - break;
170   - }
  151 + paramValues['dim2-min-value'] = this.get('dim2-min-value');
  152 + paramValues['dim2-max-value'] = this.get('dim2-max-value');
  153 + paramValues['dim2-min-index'] = this.get('dim2-min-index');
  154 + paramValues['dim2-max-index'] = this.get('dim2-max-index');
171 155  
172 156 paramValues['type'] = this.get('type');
  157 + paramValues['is-init'] = this.get('is-init');
173 158  
174 159 if (this.get('template_args') != null) {
175 160 paramValues['template_args'] = new Object();
... ...