Commit d2da5141f3709d9cfdffd86d118b2b4aea67074e

Authored by Renato De Donato
1 parent 4998f64a

async 0

controllets/datalet-selection-controllet/datalet-selection-controllet.html
... ... @@ -300,6 +300,16 @@
300 300 value : undefined
301 301 },
302 302  
  303 + loadPreview : {
  304 + type : Boolean,
  305 + value : false
  306 + },
  307 +
  308 + type : {
  309 + type : String,
  310 + value : undefined
  311 + },
  312 +
303 313 inputs : {
304 314 type : Array,
305 315 value : []
... ... @@ -351,14 +361,9 @@
351 361 'items-vslider-controllet_selected-datalet': '_selectDatalet',
352 362 // 'tree-view-controllet_selected-fields': '_updateSelectedFields'
353 363 'change': '_loadDataletBlur'
  364 + //change name
354 365 },
355 366  
356   -// aaaaaaaaaa : function() {
357   -// console.log("AAAAAAAAAAAAAAAAAAAAAAAA");
358   -// },
359   -
360   -// change in highchart e chart a gruppi
361   -
362 367 ready : function() {//console.log(this.dataletPreset);
363 368 this._resize();
364 369 $(this.$.datalet_selection_inputs).perfectScrollbar();
... ... @@ -380,13 +385,6 @@
380 385 var that = this;
381 386 window.addEventListener("resize", function() { that._resize(); });
382 387  
383   -// var inputs = document.getElementsByTagName("paper-dropdown-menu");
384   -// console.log(inputs);
385   -// for(var i in inputs)
386   -// console.log(i);
387   -// for(var i=0; i < inputs.length; i++)
388   -// console.log($(inputs[i]).children("paper-menu"));
389   -
390 388 this._translate();
391 389 },
392 390  
... ... @@ -411,20 +409,19 @@
411 409 this.$.add_button.setAttribute("disabled", "true");
412 410  
413 411 this.selectedDatalet = e.detail.datalet;
414   - this.inputs = [];
415   - this.labels = [];
416 412  
417   - if(this.selectedDatalet){
  413 + this.$.datalet_selection_datalet_placeholder.innerHTML = "";
  414 +
  415 + if(!this.selectedDatalet){
  416 + this.type = undefined;
  417 + this.inputs = [];
  418 + this.labels = [];
  419 + this.loadPreview = false;
  420 + }
  421 + else{
418 422 this.$.selectedDatalet_request.url = this.deepUrl + e.detail.datalet + "-datalet";
419 423 this.$.selectedDatalet_request.generateRequest();
420 424 }
421   -// else {
422   -// this.inputs = [];
423   -// this.labels = [];
424   -// }
425   -
426   -// this.$.datalet_selection_datalet_placeholder.innerHTML = "";
427   -// this.selectedFields = [];
428 425 },
429 426  
430 427 _preselectDatalet : function() {
... ... @@ -449,27 +446,36 @@
449 446 },
450 447  
451 448 _handleSelectedDatalet : function(e){
452   - this.$.datalet_selection_datalet_placeholder.innerHTML = "";
453 449  
454   - var inputs = e.detail.response.idm.inputs.input;
455   - var labels = e.detail.response.idm.inputs.layouts.input;
  450 + if(this.type != e.detail.response.type) {
456 451  
457   - if(inputs.constructor == Object) {//not Array && inputs.input.selection == "*"
458   - var name = inputs.name;
459   - var description = inputs.description;
460   - var selection = inputs.selection;
461   - inputs = [];
462   - for(var i in this.fields)
463   - inputs.push({name: name + " " + i, description: description, selection: selection});
464   - }
  452 + this.inputs = [];
  453 + this.labels = [];
465 454  
466   - this.inputs = inputs;
467   - this.labels = labels;
  455 + var inputs = e.detail.response.idm.inputs.input;
468 456  
469   -// if(this.inputs[0].selection == "*")
470   -// this.selectedFields = [];
471   -// else
472   - this.selectedFields = new Array(inputs.length);
  457 + if (inputs.constructor == Object) {//not Array && inputs.input.selection == "*"
  458 + var name = inputs.name;
  459 + var description = inputs.description;
  460 + var selection = inputs.selection;
  461 + inputs = [];
  462 + for (var i in this.fields)
  463 + inputs.push({name: name + " " + i, description: description, selection: selection});
  464 + }
  465 +
  466 + this.async(function(){
  467 + this.type = e.detail.response.type;
  468 + this.inputs = inputs;
  469 + this.labels = e.detail.response.idm.inputs.layouts.input;
  470 +
  471 + this.selectedFields = new Array(inputs.length);
  472 + },0);
  473 +
  474 + this.loadPreview = false;
  475 + }
  476 +
  477 + else if (this.loadPreview)
  478 + this._loadDatalet(this.selectedFields);
473 479 },
474 480  
475 481 _addInput : function(e){
... ... @@ -504,7 +510,7 @@
504 510 // this.params[labels[i].label] = labels[i].value;
505 511 // }
506 512 // }
507   -
  513 + this.loadPreview = true
508 514 this._loadDatalet(selectedFields);
509 515 }
510 516  
... ... @@ -520,19 +526,6 @@
520 526 for (var i = 0; i < labels.length; i++)
521 527 this.params[labels[i].label] = labels[i].value;
522 528  
523   -// console.log(e.target);
524   -
525   - /*var dataletParams ={
526   - component : this.selectedDatalet+"-datalet",
527   - params : this.params,
528   - fields : this.selectedFields,
529   - placeHolder : this.$.datalet_selection_datalet_placeholder
530   - };
531   -
532   - ComponentService.deep_url = this.deepUrl;
533   - ComponentService.getComponent(dataletParams);*/
534   -
535   -// this.async(function(){this.$.add_button.removeAttribute("disabled");}, 1111);
536 529 if(this.$.datalet_selection_datalet_placeholder.children[1])
537 530 this.$.datalet_selection_datalet_placeholder.children[1].behavior.setParameters(this.params);
538 531 },
... ... @@ -553,7 +546,6 @@
553 546 // }
554 547 }
555 548  
556   -// console.log(this.params);
557 549  
558 550 var dataletParams ={
559 551 component : this.selectedDatalet+"-datalet",
... ... @@ -575,7 +567,6 @@
575 567 if(this.selectedFields[i])
576 568 selectedFields.push(this.selectedFields[i]);
577 569  
578   -// console.log(this.$.datalet_selection_datalet_placeholder.children[1].behavior.data);
579 570  
580 571 var data = {
581 572 dataUrl : this.dataUrl,
... ... @@ -586,7 +577,6 @@
586 577 staticData : JSON.stringify(this.$.datalet_selection_datalet_placeholder.children[1].behavior.data)
587 578 }
588 579  
589   -// console.log(data);
590 580 this.fire('data-sevc-controllet.dataletCreated', {data : data});
591 581  
592 582 },
... ...
controllets/dataset-selection-controllet/dataset-selection-controllet.html
... ... @@ -261,7 +261,8 @@
261 261  
262 262 _translate : function(){
263 263 document.l10n.formatValue('availableDatasets').then(s => $("#_datasets")[0].setAttribute("label", s));
264   - document.l10n.formatValue('suggestedDatasets').then(s => $("#s_datasets")[0].setAttribute("label", s));
  264 + if(this.isSuggested)
  265 + document.l10n.formatValue('suggestedDatasets').then(s => $("#s_datasets")[0].setAttribute("label", s));
265 266 document.l10n.formatValue('selectedUrl').then(s => this.$.selected_url.setAttribute("label", s));
266 267 },
267 268  
... ...