Commit e8219f9ac5479bd75f639329ccef2f1d84951f08

Authored by Renato De Donato
1 parent 8297d859

datalet-mod

controllets/data-sevc-controllet/data-sevc-controllet.html
... ... @@ -36,7 +36,7 @@
36 36  
37 37 <neon-animatable>
38 38  
39   - <datalet-selection-controllet id="datalet_selection" deep-url={{deepUrl}} datalets-list-url={{dataletsListUrl}} data-url={{dataUrl}} preselected-datalet={{selectedDatalet}}></datalet-selection-controllet>
  39 + <datalet-selection-controllet id="datalet_selection" deep-url={{deepUrl}} datalets-list-url={{dataletsListUrl}} data-url={{dataUrl}} preselected-datalet={{selectedDatalet}} datalet-preset={{dataletPreset}}></datalet-selection-controllet>
40 40  
41 41 </neon-animatable>
42 42  
... ...
controllets/datalet-selection-controllet/datalet-selection-controllet.html
... ... @@ -224,18 +224,18 @@
224 224 <div class="input_header"><span data-l10n-id="baseInfo"></span></div>
225 225  
226 226 <div class="inputs">
227   - <paper-input maxlength="32" label="title" class="base_input"></paper-input>
  227 + <paper-input maxlength="32" label="title" class="base_input" on-blur="_loadDataletBlur"></paper-input>
228 228 </div>
229 229  
230 230 <div class="inputs">
231   - <paper-textarea maxlength="100" label="description" class="base_input"></paper-textarea>
  231 + <paper-textarea maxlength="100" label="description" class="base_input" on-blur="_loadDataletBlur"></paper-textarea>
232 232 </div>
233 233  
234 234 <div class="input_header"><span data-l10n-id="layouts"></span></div>
235 235  
236 236 <template is="dom-repeat" items="{{labels}}" index-as="index">
237 237 <div class="inputs">
238   - <paper-input label={{item.name}}></paper-input>
  238 + <paper-input label={{item.name}} on-blur="_loadDataletBlur"></paper-input>
239 239 <div class="info_button">
240 240 <paper-icon-button id="info_button" on-click="_showInfo" icon="info-outline" title="{{item.name}} info"></paper-icon-button>
241 241 </div>
... ... @@ -320,6 +320,11 @@
320 320 value : []
321 321 },
322 322  
  323 + dataletPreset : {
  324 + type : Object,
  325 + value : []
  326 + },
  327 +
323 328 // selectableFields : {
324 329 // type : Array,
325 330 // value : []
... ... @@ -347,7 +352,7 @@
347 352 // 'tree-view-controllet_selected-fields': '_updateSelectedFields'
348 353 },
349 354  
350   - ready : function() {
  355 + ready : function() {//console.log(this.dataletPreset);
351 356 this._resize();
352 357 $(this.$.datalet_selection_inputs).perfectScrollbar();
353 358 $(this.$.datalet_selection_labels).perfectScrollbar();
... ... @@ -424,6 +429,14 @@
424 429 $(inputs[i]).find("paper-menu")[0].select(i);
425 430  
426 431 //set info labels options
  432 + var labels = this.$.datalet_selection_labels.querySelectorAll("paper-textarea");
  433 + for (var i = 0; i < labels.length; i++)
  434 + labels[i].value = this.dataletPreset[labels[i].label];
  435 +
  436 + var labels = this.$.datalet_selection_labels.querySelectorAll("paper-input");
  437 + for (var i = 0; i < labels.length; i++)
  438 + labels[i].value = this.dataletPreset[labels[i].label];
  439 +
427 440  
428 441 this._loadDatalet(this.selectedFields);
429 442 },
... ... @@ -490,23 +503,47 @@
490 503  
491 504 },
492 505  
493   - _loadDatalet : function(selectedFields){
494   -// var params = {'data-url' : this.dataUrl};
  506 + _loadDataletBlur : function(){//da eliminare
  507 +
  508 + var labels = this.$.datalet_selection_labels.querySelectorAll("paper-textarea");
  509 + for (var i = 0; i < labels.length; i++)
  510 + this.params[labels[i].label] = labels[i].value;
495 511  
496 512 var labels = this.$.datalet_selection_labels.querySelectorAll("paper-input");
  513 + for (var i = 0; i < labels.length; i++)
  514 + this.params[labels[i].label] = labels[i].value;
  515 +
  516 + var dataletParams ={
  517 + component : this.selectedDatalet+"-datalet",
  518 + params : this.params,
  519 + fields : this.selectedFields,
  520 + placeHolder : this.$.datalet_selection_datalet_placeholder
  521 + };
  522 +
  523 + ComponentService.deep_url = this.deepUrl;
  524 + ComponentService.getComponent(dataletParams);
  525 +
  526 +// this.async(function(){this.$.add_button.removeAttribute("disabled");}, 1111);
  527 + },
  528 +
  529 + _loadDatalet : function(selectedFields){
  530 +
  531 + var labels = this.$.datalet_selection_labels.querySelectorAll("paper-textarea");
497 532 for (var i = 0; i < labels.length; i++) {
498   - if (labels[i].innerHTML.trim() != "") {
499   - this.params[labels[i].label] = labels[i].value;
500   - }
  533 +// if (labels[i].innerHTML.trim() != "") {
  534 + this.params[labels[i].label] = labels[i].value;
  535 +// }
501 536 }
502 537  
503   - var labels = this.$.datalet_selection_labels.querySelectorAll("paper-textarea");
  538 + var labels = this.$.datalet_selection_labels.querySelectorAll("paper-input");
504 539 for (var i = 0; i < labels.length; i++) {
505   - if (labels[i].innerHTML.trim() != "") {
  540 +// if (labels[i].innerHTML.trim() != "") {
506 541 this.params[labels[i].label] = labels[i].value;
507   - }
  542 +// }
508 543 }
509 544  
  545 +// console.log(this.params);
  546 +
510 547 var dataletParams ={
511 548 component : this.selectedDatalet+"-datalet",
512 549 params : this.params,
... ... @@ -527,7 +564,7 @@
527 564 if(this.selectedFields[i])
528 565 selectedFields.push(this.selectedFields[i]);
529 566  
530   -// console.log(this.params);
  567 + console.log(this.params);
531 568  
532 569 var data = {
533 570 dataUrl : this.dataUrl,
... ...