Commit 909cd28aab9825a4d92f0e87c27071076271bc25
Merge branch 'master' of http://service.routetopa.eu:7480/WebCompDev/COMPONENTS
Showing
5 changed files
with
136 additions
and
28 deletions
controllets/items-vslider-controllet/items-vslider-controllet.html
@@ -185,10 +185,10 @@ | @@ -185,10 +185,10 @@ | ||
185 | }, | 185 | }, |
186 | 186 | ||
187 | attached : function() { | 187 | attached : function() { |
188 | - if(this.preselectedDatalet){ | ||
189 | - this._preselectDatalet(); | ||
190 | - this.preselectedDatalet = undefined; | ||
191 | - } | 188 | +// if(this.preselectedDatalet){ |
189 | +// this._preselectDatalet(); | ||
190 | +// this.preselectedDatalet = undefined; | ||
191 | +// } | ||
192 | 192 | ||
193 | this._translate(); | 193 | this._translate(); |
194 | }, | 194 | }, |
@@ -279,12 +279,23 @@ | @@ -279,12 +279,23 @@ | ||
279 | }, | 279 | }, |
280 | 280 | ||
281 | _preselectDatalet : function(){ | 281 | _preselectDatalet : function(){ |
282 | +// this.async(function() { | ||
282 | var dataletCard = document.getElementById(this.preselectedDatalet); | 283 | var dataletCard = document.getElementById(this.preselectedDatalet); |
284 | +// console.log(dataletCard); | ||
285 | +// console.log(this.preselectedDatalet); | ||
286 | +// var id = "#"+this.preselectedDatalet; | ||
287 | +// var dataletCard = $(id); | ||
288 | +// var dataletCard = this.$$("#datatable"); | ||
289 | +// console.log(dataletCard); | ||
290 | + | ||
283 | dataletCard.elevation = "5"; | 291 | dataletCard.elevation = "5"; |
284 | dataletCard.getElementsByClassName("legend")[0].className = dataletCard.getElementsByClassName("legend")[0].className + " selected"; | 292 | dataletCard.getElementsByClassName("legend")[0].className = dataletCard.getElementsByClassName("legend")[0].className + " selected"; |
293 | + | ||
294 | +// dataletCard.find(".legend")[0].className += " selected"; | ||
285 | this.selectedDatalet = this.preselectedDatalet; | 295 | this.selectedDatalet = this.preselectedDatalet; |
286 | 296 | ||
287 | this.fire('items-vslider-controllet_selected-datalet', {datalet: this.selectedDatalet}); | 297 | this.fire('items-vslider-controllet_selected-datalet', {datalet: this.selectedDatalet}); |
298 | +// }, 500); | ||
288 | }, | 299 | }, |
289 | 300 | ||
290 | _getImageUrl : function(index){ | 301 | _getImageUrl : function(index){ |
controllets/select-visualization-controllet/select-datalet-inputs.html
@@ -187,15 +187,68 @@ | @@ -187,15 +187,68 @@ | ||
187 | }, | 187 | }, |
188 | 188 | ||
189 | _preselectInputs : function(fields, aggregators, orders) { | 189 | _preselectInputs : function(fields, aggregators, orders) { |
190 | + aggregators = JSON.parse(aggregators); | ||
191 | + orders = JSON.parse(orders); | ||
192 | + | ||
193 | + this.selectedFields = this._copy(fields); | ||
194 | + | ||
190 | var ddls = this.$.inputs_container.querySelectorAll("paper-dropdown-menu"); | 195 | var ddls = this.$.inputs_container.querySelectorAll("paper-dropdown-menu"); |
191 | 196 | ||
192 | -// this.async(function () { | ||
193 | - for (var i = 0; i < fields.length; i++) { | ||
194 | - var menu = $(ddls[i]).find("paper-menu")[0]; | ||
195 | - menu.select(i+1); | 197 | + for (var i = 0; i < fields.length; i++) |
198 | + $(ddls[i]).find("paper-menu")[0].select(i+1); | ||
199 | + | ||
200 | + if(orders.length > 0) { | ||
201 | + this.orders = this._copy(orders);//wrong | ||
202 | + } | ||
203 | + | ||
204 | + if(aggregators.length > 0) { | ||
205 | + | ||
206 | + this.$.group_by.removeAttribute("disabled"); | ||
207 | + this._showExpertMode(); | ||
208 | + | ||
209 | + var groupableFields = []; | ||
210 | + for (var i = 0; i < this.selectedFields.length; i++) { | ||
211 | + if(this.selectedFields[i]) | ||
212 | + groupableFields.push(this.selectedFields[i]); | ||
213 | + } | ||
214 | + this.groupableFields = this._copy(groupableFields); | ||
215 | + this.aggregateFields = []; | ||
216 | + | ||
217 | + var index = this.groupableFields.indexOf(aggregators[0].field); | ||
218 | + | ||
219 | + this.async(function () { | ||
220 | + var menu = $(this.$.group_by).find("paper-menu")[0]; | ||
221 | + menu.select(index); | ||
222 | + }, 0); | ||
223 | + | ||
224 | + var aggregateFields = []; | ||
225 | + for (var i = 0; i < this.groupableFields.length; i++) { | ||
226 | + if (i != index && this.groupableFields[i]) | ||
227 | + aggregateFields.push(this.groupableFields[i]); | ||
228 | + } | ||
229 | + this.aggregateFields = this._copy(aggregateFields); | ||
230 | + | ||
231 | + this.async(function() { | ||
232 | + var ddls = document.getElementsByTagName("paper-dropdown-menu"); | ||
233 | + var j = 1; | ||
234 | + for (var i = 0; i < ddls.length; i++){ | ||
235 | + var id = ddls[i].id; | ||
236 | + if(id.indexOf("calculate") > -1) { | ||
237 | + var ii = this.functions.indexOf(aggregators[j].operation); | ||
238 | + j++; | ||
239 | + $(ddls[i]).find("paper-menu")[0].select(-1); | ||
240 | + $(ddls[i]).find("paper-menu")[0].select(ii); | ||
241 | + } | ||
242 | + } | ||
243 | + | ||
244 | +// this._setAggregators(); | ||
245 | + this.aggregators = this._copy(aggregators); | ||
246 | + | ||
247 | + this.fireReady(); | ||
248 | + }, 0); | ||
196 | } | 249 | } |
197 | - this.selectedFields = this._copy(fields); | ||
198 | -// }, 2); | 250 | + else |
251 | + this.fireReady(); | ||
199 | }, | 252 | }, |
200 | 253 | ||
201 | getSelectedFields : function () { | 254 | getSelectedFields : function () { |
controllets/select-visualization-controllet/select-datalet-inputs_series.html
@@ -188,15 +188,55 @@ | @@ -188,15 +188,55 @@ | ||
188 | }, | 188 | }, |
189 | 189 | ||
190 | _preselectInputs : function(fields, aggregators, orders) { | 190 | _preselectInputs : function(fields, aggregators, orders) { |
191 | + aggregators = JSON.parse(aggregators); | ||
192 | + orders = JSON.parse(orders); | ||
193 | + | ||
194 | + //fields = [f1 gb(opt) f2] --> si puรฒ cambiare in f1 f2 gb ??? | ||
195 | + | ||
196 | + this.selectedFields = this._copy(fields); | ||
197 | + | ||
191 | var ddls = this.$.inputs_series_container.querySelectorAll("paper-dropdown-menu"); | 198 | var ddls = this.$.inputs_series_container.querySelectorAll("paper-dropdown-menu"); |
192 | 199 | ||
193 | -// this.async(function () { | ||
194 | - for (var i = 0; i < fields.length; i++) { | ||
195 | - var menu = $(ddls[i]).find("paper-menu")[0]; | ||
196 | - menu.select(i+1); | 200 | + $(ddls[0]).find("paper-menu")[0].select(1); |
201 | + $(ddls[1]).find("paper-menu")[0].select(2); | ||
202 | + | ||
203 | + if(orders.length > 0) { | ||
204 | + this.orders = this._copy(orders);//wrong | ||
205 | + } | ||
206 | + | ||
207 | + if(aggregators.length > 0) { | ||
208 | + this.selectedFields = [fields[0], fields[2]]; | ||
209 | + | ||
210 | + this.$.group_by.removeAttribute("disabled"); | ||
211 | + $("#calculate_0")[0].removeAttribute("disabled"); | ||
212 | + $("#gb")[0].removeAttribute("disabled"); | ||
213 | + this._showExpertMode(); | ||
214 | + | ||
215 | + var groupableFields = []; | ||
216 | + for (var i = 0; i < this.fields.length; i++) { | ||
217 | + if(this.fields[i] != this.selectedFields[1]) | ||
218 | + groupableFields.push(this.fields[i]); | ||
197 | } | 219 | } |
198 | - this.selectedFields = this._copy(fields); | ||
199 | -// }, 0); | 220 | + this.groupableFields = this._copy(groupableFields); |
221 | + this.aggregateFields = [this.selectedFields[1]]; | ||
222 | + | ||
223 | + $(ddls[0]).find("paper-menu")[0].select(1); | ||
224 | + $(ddls[1]).find("paper-menu")[0].select(3); | ||
225 | + | ||
226 | + this.async(function () { | ||
227 | + var i = this.functions.indexOf(aggregators[2].operation); | ||
228 | + | ||
229 | + $(this.$.group_by).find("paper-menu")[0].select(2); | ||
230 | + $("#calculate_0").find("paper-menu")[0].select(i); | ||
231 | + | ||
232 | +// this._setAggregators();//if dont --> $("#gb")[0].removeAttribute("disabled"); | ||
233 | + this.aggregators = this._copy(aggregators); | ||
234 | + | ||
235 | + this.fireReady(); | ||
236 | + }, 0); | ||
237 | + } | ||
238 | + else | ||
239 | + this.fireReady(); | ||
200 | }, | 240 | }, |
201 | 241 | ||
202 | getSelectedFields : function () { | 242 | getSelectedFields : function () { |
controllets/select-visualization-controllet/select-datalet-options.html
@@ -228,7 +228,7 @@ | @@ -228,7 +228,7 @@ | ||
228 | // this.params["description"] = ""; | 228 | // this.params["description"] = ""; |
229 | }, | 229 | }, |
230 | 230 | ||
231 | - ceckOptions : function(options) { | 231 | + checkOptions : function(options) { |
232 | if(options.length != this.options.length) | 232 | if(options.length != this.options.length) |
233 | this.setOptions(options); | 233 | this.setOptions(options); |
234 | }, | 234 | }, |
controllets/select-visualization-controllet/select-visualization-controllet.html
@@ -236,8 +236,10 @@ | @@ -236,8 +236,10 @@ | ||
236 | }, | 236 | }, |
237 | 237 | ||
238 | show : function() {//show --> preselect | 238 | show : function() {//show --> preselect |
239 | - if(this.preselectedDatalet) | 239 | +// if(this.preselectedDatalet) |
240 | + if(this.dataletPreset) | ||
240 | this._preselectDatalet(); | 241 | this._preselectDatalet(); |
242 | + | ||
241 | // if (this.$.datalet_selection_datalet_placeholder.innerHTML == "") { | 243 | // if (this.$.datalet_selection_datalet_placeholder.innerHTML == "") { |
242 | // var inputs = this._getInputs(); | 244 | // var inputs = this._getInputs(); |
243 | // inputs.fireReady(); | 245 | // inputs.fireReady(); |
@@ -286,7 +288,7 @@ | @@ -286,7 +288,7 @@ | ||
286 | this.$.options.setOptions(e.detail.response.idm.inputs.layouts.input); | 288 | this.$.options.setOptions(e.detail.response.idm.inputs.layouts.input); |
287 | } | 289 | } |
288 | else { | 290 | else { |
289 | - this.$.options.ceckOptions(e.detail.response.idm.inputs.layouts.input); | 291 | + this.$.options.checkOptions(e.detail.response.idm.inputs.layouts.input); |
290 | } | 292 | } |
291 | 293 | ||
292 | this.async(function () { | 294 | this.async(function () { |
@@ -300,16 +302,18 @@ | @@ -300,16 +302,18 @@ | ||
300 | // }, 1); | 302 | // }, 1); |
301 | }, | 303 | }, |
302 | 304 | ||
303 | - _preselectDatalet : function() { | ||
304 | - var inputs = this._getInputs(); | ||
305 | - inputs._preselectInputs(this.fields, this.dataletPreset["aggregators"], this.dataletPreset["orders"]); | ||
306 | - this.$.options._preselectOptions(this.dataletPreset); | ||
307 | - this.dataletPreset = undefined; | 305 | + _preselectDatalet : function() {console.log("preselzionando si impara"); |
306 | + this.$.vslider._preselectDatalet(); | ||
308 | 307 | ||
309 | -// this.async(function () { | ||
310 | -// var inputs = this._getInputs(); | ||
311 | -// inputs.fireReady(); | ||
312 | -// }, 500); | 308 | + this.async(function () { |
309 | + this.$.options._preselectOptions(this.dataletPreset); | ||
310 | + }, 100); | ||
311 | + | ||
312 | + this.async(function () { | ||
313 | + var inputs = this._getInputs(); | ||
314 | + inputs._preselectInputs(this.fields, this.dataletPreset["aggregators"], this.dataletPreset["orders"]); | ||
315 | + this.dataletPreset = undefined; | ||
316 | + }, 200); | ||
313 | }, | 317 | }, |
314 | 318 | ||
315 | _tryLoadDatalet : function(){ | 319 | _tryLoadDatalet : function(){ |