Commit d2da5141f3709d9cfdffd86d118b2b4aea67074e
1 parent
4998f64a
async 0
Showing
2 changed files
with
49 additions
and
58 deletions
controllets/datalet-selection-controllet/datalet-selection-controllet.html
@@ -300,6 +300,16 @@ | @@ -300,6 +300,16 @@ | ||
300 | value : undefined | 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 | inputs : { | 313 | inputs : { |
304 | type : Array, | 314 | type : Array, |
305 | value : [] | 315 | value : [] |
@@ -351,14 +361,9 @@ | @@ -351,14 +361,9 @@ | ||
351 | 'items-vslider-controllet_selected-datalet': '_selectDatalet', | 361 | 'items-vslider-controllet_selected-datalet': '_selectDatalet', |
352 | // 'tree-view-controllet_selected-fields': '_updateSelectedFields' | 362 | // 'tree-view-controllet_selected-fields': '_updateSelectedFields' |
353 | 'change': '_loadDataletBlur' | 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 | ready : function() {//console.log(this.dataletPreset); | 367 | ready : function() {//console.log(this.dataletPreset); |
363 | this._resize(); | 368 | this._resize(); |
364 | $(this.$.datalet_selection_inputs).perfectScrollbar(); | 369 | $(this.$.datalet_selection_inputs).perfectScrollbar(); |
@@ -380,13 +385,6 @@ | @@ -380,13 +385,6 @@ | ||
380 | var that = this; | 385 | var that = this; |
381 | window.addEventListener("resize", function() { that._resize(); }); | 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 | this._translate(); | 388 | this._translate(); |
391 | }, | 389 | }, |
392 | 390 | ||
@@ -411,20 +409,19 @@ | @@ -411,20 +409,19 @@ | ||
411 | this.$.add_button.setAttribute("disabled", "true"); | 409 | this.$.add_button.setAttribute("disabled", "true"); |
412 | 410 | ||
413 | this.selectedDatalet = e.detail.datalet; | 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 | this.$.selectedDatalet_request.url = this.deepUrl + e.detail.datalet + "-datalet"; | 422 | this.$.selectedDatalet_request.url = this.deepUrl + e.detail.datalet + "-datalet"; |
419 | this.$.selectedDatalet_request.generateRequest(); | 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 | _preselectDatalet : function() { | 427 | _preselectDatalet : function() { |
@@ -449,27 +446,36 @@ | @@ -449,27 +446,36 @@ | ||
449 | }, | 446 | }, |
450 | 447 | ||
451 | _handleSelectedDatalet : function(e){ | 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 | _addInput : function(e){ | 481 | _addInput : function(e){ |
@@ -504,7 +510,7 @@ | @@ -504,7 +510,7 @@ | ||
504 | // this.params[labels[i].label] = labels[i].value; | 510 | // this.params[labels[i].label] = labels[i].value; |
505 | // } | 511 | // } |
506 | // } | 512 | // } |
507 | - | 513 | + this.loadPreview = true |
508 | this._loadDatalet(selectedFields); | 514 | this._loadDatalet(selectedFields); |
509 | } | 515 | } |
510 | 516 | ||
@@ -520,19 +526,6 @@ | @@ -520,19 +526,6 @@ | ||
520 | for (var i = 0; i < labels.length; i++) | 526 | for (var i = 0; i < labels.length; i++) |
521 | this.params[labels[i].label] = labels[i].value; | 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 | if(this.$.datalet_selection_datalet_placeholder.children[1]) | 529 | if(this.$.datalet_selection_datalet_placeholder.children[1]) |
537 | this.$.datalet_selection_datalet_placeholder.children[1].behavior.setParameters(this.params); | 530 | this.$.datalet_selection_datalet_placeholder.children[1].behavior.setParameters(this.params); |
538 | }, | 531 | }, |
@@ -553,7 +546,6 @@ | @@ -553,7 +546,6 @@ | ||
553 | // } | 546 | // } |
554 | } | 547 | } |
555 | 548 | ||
556 | -// console.log(this.params); | ||
557 | 549 | ||
558 | var dataletParams ={ | 550 | var dataletParams ={ |
559 | component : this.selectedDatalet+"-datalet", | 551 | component : this.selectedDatalet+"-datalet", |
@@ -575,7 +567,6 @@ | @@ -575,7 +567,6 @@ | ||
575 | if(this.selectedFields[i]) | 567 | if(this.selectedFields[i]) |
576 | selectedFields.push(this.selectedFields[i]); | 568 | selectedFields.push(this.selectedFields[i]); |
577 | 569 | ||
578 | -// console.log(this.$.datalet_selection_datalet_placeholder.children[1].behavior.data); | ||
579 | 570 | ||
580 | var data = { | 571 | var data = { |
581 | dataUrl : this.dataUrl, | 572 | dataUrl : this.dataUrl, |
@@ -586,7 +577,6 @@ | @@ -586,7 +577,6 @@ | ||
586 | staticData : JSON.stringify(this.$.datalet_selection_datalet_placeholder.children[1].behavior.data) | 577 | staticData : JSON.stringify(this.$.datalet_selection_datalet_placeholder.children[1].behavior.data) |
587 | } | 578 | } |
588 | 579 | ||
589 | -// console.log(data); | ||
590 | this.fire('data-sevc-controllet.dataletCreated', {data : data}); | 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,7 +261,8 @@ | ||
261 | 261 | ||
262 | _translate : function(){ | 262 | _translate : function(){ |
263 | document.l10n.formatValue('availableDatasets').then(s => $("#_datasets")[0].setAttribute("label", s)); | 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 | document.l10n.formatValue('selectedUrl').then(s => this.$.selected_url.setAttribute("label", s)); | 266 | document.l10n.formatValue('selectedUrl').then(s => this.$.selected_url.setAttribute("label", s)); |
266 | }, | 267 | }, |
267 | 268 |