Blame view

controllets/datalet-selection-controllet/datalet-selection-controllet.html 20.6 KB
a31f0660   root   sevc-controllet i...
1
2
3
4
5
6
7
8
9
10
11
12
13
  <link rel="import" href="../../bower_components/polymer/polymer.html" />
  
  <link rel="import" href="../../bower_components/paper-material/paper-material.html" />
  
  <link rel="import" href="../../bower_components/paper-dropdown-menu/paper-dropdown-menu.html">
  <link rel="import" href="../../bower_components/paper-menu/paper-menu.html">
  <link rel="import" href="../../bower_components/paper-item/paper-item.html">
  
  <link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
  <link rel="import" href="../../bower_components/iron-icons/iron-icons.html">
  <link rel="import" href="../../bower_components/iron-icon/iron-icon.html">
  
  <link rel="import" href="../../bower_components/paper-input/paper-textarea.html">
3c812cc9   Renato De Donato   title-desciption ...
14
  <link rel="import" href="../../bower_components/paper-input/paper-input.html">
a31f0660   root   sevc-controllet i...
15
16
17
  
  <link rel="import" href="../../bower_components/paper-button/paper-button.html">
  
57ef9bf4   Renato De Donato   labels + info
18
19
  <link rel="import" href="../../bower_components/paper-dialog/paper-dialog.html">
  
a31f0660   root   sevc-controllet i...
20
21
  <link rel="import" href="../items-vslider-controllet/items-vslider-controllet.html" />
  
0f6424fe   root   update new data-s...
22
  <script src="../../../DEEPCLIENT/js/deepClient.js"></script>
a31f0660   root   sevc-controllet i...
23
24
25
26
27
28
  
  <dom-module id="datalet-selection-controllet">
  
      <template>
  
          <style is="custom-style">
e0e4a976   Renato De Donato   data-sevc-control...
29
30
31
32
33
              :host {
              --paper-dropdown-menu-icon: {
                   color: #2196F3;
               };
              }
a31f0660   root   sevc-controllet i...
34
35
36
37
38
  
              #datalet_selection_container {
                  display: flex;
                  font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
                  font-size: 16px;
0f6424fe   root   update new data-s...
39
                  margin-top: 8px;
a31f0660   root   sevc-controllet i...
40
41
42
43
44
45
              }
  
              #datalet_selection_inputs {
                  position: relative;
                  height: 100vh;
                  margin-left: 32px;
e0e4a976   Renato De Donato   data-sevc-control...
46
47
                  /*width: 344px;*/
                  min-width: 258px;
a31f0660   root   sevc-controllet i...
48
49
50
51
52
53
              }
  
              #datalet_selection_labels {
                  position: relative;
                  height: 100vh;
                  margin-left: 32px;
e0e4a976   Renato De Donato   data-sevc-control...
54
55
                  /*width: 344px;*/
                  min-width: 258px;
a31f0660   root   sevc-controllet i...
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
              }
  
              #datalet_selection_column {
                  position: relative;
                  width: 100%;
                  margin-left: 32px;
              }
  
              #datalet_selection_datalet {
                  position: relative;
                  height: 100vh;
                  width: 100%;
                  /*margin-left: 32px;*/
                  /*margin-top: 32px;*/
                  /*margin-bottom: 32px;*/
              }
  
              #datalet_selection_comment{
                  width: 100%;
e0e4a976   Renato De Donato   data-sevc-control...
75
                  /*height: 112px;*/
a31f0660   root   sevc-controllet i...
76
77
78
79
80
81
82
83
84
85
86
87
88
                  margin-bottom: 32px;
              }
  
              #datalet_selection_datalet_placeholder {
                  padding: 16px;
              }
  
              .inputs{
                  position: relative;
                  /*margin-left: 16px;*/
                  /*margin-right: 16px;*/
              }
  
e0e4a976   Renato De Donato   data-sevc-control...
89
90
91
92
              /*.input_name{*/
                  /*height: 16px;*/
                  /*padding: 16px;*/
                  /*/!*background-color: #B6B6B6;*!/*/
a31f0660   root   sevc-controllet i...
93
  
e0e4a976   Renato De Donato   data-sevc-control...
94
95
96
97
                  /*background-color: #2196F3;*/
                  /*color: #FFFFFF;*/
                  /*font-weight: 700;*/
              /*}*/
a31f0660   root   sevc-controllet i...
98
99
  
              .input_header{
e0e4a976   Renato De Donato   data-sevc-control...
100
101
102
                  height: 32px;
                  padding-top: 16px;
                  /*padding: 16px;*/
a31f0660   root   sevc-controllet i...
103
104
105
106
107
108
                  background-color: #B6B6B6;
                  text-align: center;
                  font-weight: 700;
              }
  
              .info_button {
e0e4a976   Renato De Donato   data-sevc-control...
109
                  /*background-color: red;*/
a31f0660   root   sevc-controllet i...
110
                  position: absolute;
e0e4a976   Renato De Donato   data-sevc-control...
111
                  top: 18px;
a31f0660   root   sevc-controllet i...
112
113
114
                  right: 0px;
              }
  
3c812cc9   Renato De Donato   title-desciption ...
115
              paper-input {
e0e4a976   Renato De Donato   data-sevc-control...
116
                  display: inline-block;
a31f0660   root   sevc-controllet i...
117
                  height: 48px;
e0e4a976   Renato De Donato   data-sevc-control...
118
119
120
121
                  /*padding: 0px 8px;*/
                  width: 210px;
                  padding-left: 8px;
                  padding-bottom: 8px;
a31f0660   root   sevc-controllet i...
122
123
124
                  --paper-input-container-focus-color: #2196F3;
              }
  
3c812cc9   Renato De Donato   title-desciption ...
125
126
127
128
129
130
131
132
133
134
135
136
137
138
              paper-input.base_input {
                  width: 242px;
              }
  
              paper-textarea {
                  /*height: 48px;*/
                  /*padding: 0px 8px;*/
                  width: 242px;
                  padding-left: 8px;
                  padding-bottom: 4px;
                  --paper-input-container-focus-color: #2196F3;
              }
  
              #datalet_selection_comment paper-input {
e0e4a976   Renato De Donato   data-sevc-control...
139
140
141
142
                  padding-bottom: 0px;
                  width: calc(100% - 16px);
              }
  
a31f0660   root   sevc-controllet i...
143
              paper-dropdown-menu {
e0e4a976   Renato De Donato   data-sevc-control...
144
                  /*display: inline-block;*/
a31f0660   root   sevc-controllet i...
145
                  height: 48px;
e0e4a976   Renato De Donato   data-sevc-control...
146
147
148
149
                  width: 210px;;
                  /*padding: 0px 8px;*/
                  padding-left: 8px;
                  padding-bottom: 8px;
a31f0660   root   sevc-controllet i...
150
151
152
153
154
155
156
157
158
                  --paper-input-container-focus-color: #2196F3;
              }
  
              paper-item.iron-selected {
                  background-color: #2196F3;
                  color: #FFFFFF;
              }
  
              paper-icon-button {
e0e4a976   Renato De Donato   data-sevc-control...
159
160
161
                  /*display: inline-block;*/
                  color: #2196F3;
                  /*color: #FFFFFF;*/
a31f0660   root   sevc-controllet i...
162
                  --paper-icon-button-ink-color: #2196F3;
e0e4a976   Renato De Donato   data-sevc-control...
163
                  margin: 0px;
a31f0660   root   sevc-controllet i...
164
165
166
167
168
169
170
171
172
                  /*padding: 0px;*/
              }
  
              paper-button {
                  /*display: block;*/
                  position: absolute;
                  bottom: 16px;
                  right: 11px;
  
a31f0660   root   sevc-controllet i...
173
174
175
176
177
178
179
180
181
182
                  height: 48px;
                  width: 172px;
                  background-color: #00BCD4;
                  color: white;
                  font-weight: 700;
                  padding: 16px;
              }
  
              paper-button:hover {
                  background-color: #00AABF;
3c812cc9   Renato De Donato   title-desciption ...
183
184
185
186
  
                  box-shadow: 0px 8px 12px #888;
                  -webkit-box-shadow: 0px 8px 12px #888;
                  -moz-box-shadow: 0px 8px 12px #888;
a31f0660   root   sevc-controllet i...
187
              }
0f6424fe   root   update new data-s...
188
189
190
191
  
              paper-button[disabled] {
                  background-color: #B6B6B6;
              }
57ef9bf4   Renato De Donato   labels + info
192
  
79ec939f   Renato De Donato   info position + a...
193
              #dialog_info_input {
57ef9bf4   Renato De Donato   labels + info
194
195
                  border: 2px solid #2196F3;
                  background-color: #E0E0E0;
3c812cc9   Renato De Donato   title-desciption ...
196
                  min-width: 248px;
57ef9bf4   Renato De Donato   labels + info
197
              }
a31f0660   root   sevc-controllet i...
198
199
          </style>
  
0f6424fe   root   update new data-s...
200
          <iron-ajax id="selectedDatalet_request" on-response="_handleSelectedDatalet"></iron-ajax>
a31f0660   root   sevc-controllet i...
201
202
  
          <div id="datalet_selection_container">
e0e4a976   Renato De Donato   data-sevc-control...
203
              <items-vslider-controllet id="vslider" datalets-list-url={{dataletsListUrl}} preselected-datalet={{preselectedDatalet}}></items-vslider-controllet>
a31f0660   root   sevc-controllet i...
204
  
a31f0660   root   sevc-controllet i...
205
              <paper-material id="datalet_selection_inputs" elevation="5">
97e0b0f8   Renato De Donato   google chart & lo...
206
                  <div class="input_header"><span data-l10n-id="inputs"></span></div>
e0e4a976   Renato De Donato   data-sevc-control...
207
                  <template is="dom-repeat" items="{{inputs}}" index-as="ddl_index">
a31f0660   root   sevc-controllet i...
208
                      <div class="inputs">
e0e4a976   Renato De Donato   data-sevc-control...
209
                          <paper-dropdown-menu id={{ddl_index}} label={{item.name}}>
a31f0660   root   sevc-controllet i...
210
                              <paper-menu class="dropdown-content">
e0e4a976   Renato De Donato   data-sevc-control...
211
212
                                  <template is="dom-repeat" items={{fields}}>
                                      <paper-item id={{index}} on-tap="_addInput">{{item}}</paper-item>
a31f0660   root   sevc-controllet i...
213
214
215
                                  </template>
                              </paper-menu>
                          </paper-dropdown-menu>
e0e4a976   Renato De Donato   data-sevc-control...
216
217
218
                          <div class="info_button">
                              <paper-icon-button id="info_button" on-click="_showInfo" icon="info-outline" title="{{item.name}} info"></paper-icon-button>
                          </div>
a31f0660   root   sevc-controllet i...
219
220
221
222
223
                      </div>
                  </template>
              </paper-material>
  
              <paper-material id="datalet_selection_labels" elevation="5">
3c812cc9   Renato De Donato   title-desciption ...
224
225
226
227
228
229
230
231
232
233
234
235
                  <div class="input_header"><span data-l10n-id="baseInfo"></span></div>
  
                  <div class="inputs">
                      <paper-input maxlength="32" label="title" class="base_input"></paper-input>
                  </div>
  
                  <div class="inputs">
                      <paper-textarea maxlength="100" label="description" class="base_input"></paper-textarea>
                  </div>
  
                  <div class="input_header"><span data-l10n-id="layouts"></span></div>
  
a31f0660   root   sevc-controllet i...
236
237
                  <template is="dom-repeat" items="{{labels}}" index-as="index">
                      <div class="inputs">
3c812cc9   Renato De Donato   title-desciption ...
238
                          <paper-input label={{item.name}}></paper-input>
e0e4a976   Renato De Donato   data-sevc-control...
239
240
                          <div class="info_button">
                              <paper-icon-button id="info_button" on-click="_showInfo" icon="info-outline" title="{{item.name}} info"></paper-icon-button>
a31f0660   root   sevc-controllet i...
241
                          </div>
a31f0660   root   sevc-controllet i...
242
243
244
245
246
247
                      </div>
                  </template>
              </paper-material>
  
  
              <div id="datalet_selection_column">
e0e4a976   Renato De Donato   data-sevc-control...
248
  
83faae2e   Renato De Donato   comment-modify
249
                  <!--<template is="dom-if" if={{modify}}>-->
3c812cc9   Renato De Donato   title-desciption ...
250
251
252
253
                      <!--<paper-material id="datalet_selection_comment" elevation="5">-->
                          <!--<div class="input_header"><span data-l10n-id="comment"></span></div>-->
                          <!--<paper-textarea id="comment" no-label-float maxlength="100" label="comment (max 100 characters)"></paper-textarea>-->
                      <!--</paper-material>-->
83faae2e   Renato De Donato   comment-modify
254
                  <!--</template>-->
a31f0660   root   sevc-controllet i...
255
256
  
                  <paper-material id="datalet_selection_datalet" elevation="5">
97e0b0f8   Renato De Donato   google chart & lo...
257
                      <div class="input_header"><span data-l10n-id="dataletPreview"></span></div>
a31f0660   root   sevc-controllet i...
258
259
260
261
                      <div id="datalet_selection_datalet_placeholder"></div>
  
                  </paper-material>
  
97e0b0f8   Renato De Donato   google chart & lo...
262
                  <paper-button id="add_button" disabled raised on-click="_addDatalet"><span data-l10n-id="addDatalet"></span></paper-button>
a31f0660   root   sevc-controllet i...
263
264
265
  
              </div>
  
79ec939f   Renato De Donato   info position + a...
266
              <paper-dialog id="dialog_info_input">
57ef9bf4   Renato De Donato   labels + info
267
268
269
270
                  <h2 id="dialog_name"></h2>
                  <p id="dialog_description"></p>
              </paper-dialog>
  
a31f0660   root   sevc-controllet i...
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
          </div>
  
      </template>
  
      <script>
  
          Polymer({
  
              is : 'datalet-selection-controllet',
  
              properties : {
  
                  deepUrl : {
                      type : String,
                      value : undefined
                  },
  
                  dataletsListUrl : {
                      type : String,
                      value : undefined
                  },
  
                  selectedDatalet : {
                      type  : String,
                      value : undefined
                  },
  
e0e4a976   Renato De Donato   data-sevc-control...
298
299
300
301
302
                  preselectedDatalet : {
                      type  : String,
                      value : undefined
                  },
  
a31f0660   root   sevc-controllet i...
303
304
305
306
307
308
309
310
311
312
313
314
                  inputs : {
                      type : Array,
                      value : []
                  },
  
                  labels : {
                      type : Array,
                      value : []
                  },
  
                  fields : {
                      type : Array,
0f6424fe   root   update new data-s...
315
316
317
318
319
320
321
322
                      value : []
                  },
  
                  selectedFields : {
                      type : Array,
                      value : []
                  },
  
e0e4a976   Renato De Donato   data-sevc-control...
323
324
325
326
  //                selectableFields : {
  //                    type : Array,
  //                    value : []
  //                },
a31f0660   root   sevc-controllet i...
327
328
329
  
                  dataUrl : {
                      type  : String,
0f6424fe   root   update new data-s...
330
                      value : undefined
e0e4a976   Renato De Donato   data-sevc-control...
331
332
                  },
  
57ef9bf4   Renato De Donato   labels + info
333
334
335
336
337
                  params:{
                      type: Object,
                      value: undefined
                  },
  
e0e4a976   Renato De Donato   data-sevc-control...
338
339
340
                  modify : {
                      type  : Boolean,
                      value : false
a31f0660   root   sevc-controllet i...
341
342
343
344
345
                  }
  
              },
  
              listeners: {
e0e4a976   Renato De Donato   data-sevc-control...
346
                  'items-vslider-controllet_selected-datalet': '_selectDatalet'
0f6424fe   root   update new data-s...
347
  //                'tree-view-controllet_selected-fields': '_updateSelectedFields'
a31f0660   root   sevc-controllet i...
348
349
350
351
352
353
354
              },
  
              ready : function() {
                  this._resize();
                  $(this.$.datalet_selection_inputs).perfectScrollbar();
                  $(this.$.datalet_selection_labels).perfectScrollbar();
                  $(this.$.datalet_selection_datalet).perfectScrollbar();
0f6424fe   root   update new data-s...
355
  
ed1bed76   Renato De Donato   fix bug-modify in...
356
357
358
                  this.params = {'data-url' : this.dataUrl};
  
                  //this.modify = true;//da eliminare in futuro
e0e4a976   Renato De Donato   data-sevc-control...
359
360
361
362
363
                  if(this.preselectedDatalet){
                      this.modify = true;
                      this._preselectDatalet();
                      this.preselectedDatalet = undefined;
                  }
a31f0660   root   sevc-controllet i...
364
365
366
367
368
369
              },
  
              attached : function() {
                  this._resize();
                  var that = this;
                  window.addEventListener("resize", function() { that._resize(); });
e0e4a976   Renato De Donato   data-sevc-control...
370
371
372
373
374
375
376
  
  //                var inputs = document.getElementsByTagName("paper-dropdown-menu");
  //                console.log(inputs);
  //                for(var i in inputs)
  //                    console.log(i);
  //                for(var i=0; i < inputs.length; i++)
  //                    console.log($(inputs[i]).children("paper-menu"));
97e0b0f8   Renato De Donato   google chart & lo...
377
378
  
                  this._translate();
97e0b0f8   Renato De Donato   google chart & lo...
379
380
              },
  
0f6424fe   root   update new data-s...
381
382
383
384
              setFields : function(fields) {
                  this.fields = fields;
              },
  
e0e4a976   Renato De Donato   data-sevc-control...
385
386
387
388
389
390
391
              reset : function() {
                  this.selectedDatalet = undefined;
                  this.inputs = [];
                  this.labels = [];
                  this.$.datalet_selection_datalet_placeholder.innerHTML = "";
              },
  
3c812cc9   Renato De Donato   title-desciption ...
392
393
394
395
396
397
              _translate : function(){
  //                document.l10n.formatValue('commentLabel').then(s => $("#comment")[0].setAttribute("label", s));
                  if(this.modify)
                      document.l10n.formatValue('modifyDatalet').then(s => this.$.add_button.innerText = s);
              },
  
e0e4a976   Renato De Donato   data-sevc-control...
398
              _selectDatalet : function(e){
0f6424fe   root   update new data-s...
399
400
                  this.$.add_button.setAttribute("disabled", "true");
  
a31f0660   root   sevc-controllet i...
401
                  this.selectedDatalet = e.detail.datalet;
0f6424fe   root   update new data-s...
402
403
404
                  this.inputs = [];
                  this.labels = [];
  
a31f0660   root   sevc-controllet i...
405
406
407
408
                  if(this.selectedDatalet){
                      this.$.selectedDatalet_request.url = this.deepUrl + e.detail.datalet + "-datalet";
                      this.$.selectedDatalet_request.generateRequest();
                  }
0f6424fe   root   update new data-s...
409
410
411
412
413
  //                else {
  //                    this.inputs = [];
  //                    this.labels = [];
  //                }
  
e0e4a976   Renato De Donato   data-sevc-control...
414
415
416
  //                this.$.datalet_selection_datalet_placeholder.innerHTML = "";
  //                this.selectedFields = [];
              },
0f6424fe   root   update new data-s...
417
  
e0e4a976   Renato De Donato   data-sevc-control...
418
              _preselectDatalet : function() {
e0e4a976   Renato De Donato   data-sevc-control...
419
420
421
422
423
424
425
                  this.selectedDatalet = this.preselectedDatalet;
                  this.selectedFields = this._copy(this.fields);
  
                  var inputs = document.getElementsByTagName("paper-dropdown-menu");
                  for(var i=0; i < inputs.length; i++)
                      $(inputs[i]).find("paper-menu")[0].select(i);
  
3c812cc9   Renato De Donato   title-desciption ...
426
427
                 //set info labels options
  
e0e4a976   Renato De Donato   data-sevc-control...
428
                  this._loadDatalet(this.selectedFields);
a31f0660   root   sevc-controllet i...
429
430
              },
  
0f6424fe   root   update new data-s...
431
              _handleSelectedDatalet : function(e){
e0e4a976   Renato De Donato   data-sevc-control...
432
                  this.$.datalet_selection_datalet_placeholder.innerHTML = "";
0f6424fe   root   update new data-s...
433
  
a31f0660   root   sevc-controllet i...
434
435
436
437
438
                  var inputs = e.detail.response.idm.inputs.input;
                  var labels = e.detail.response.idm.inputs.layouts.input;
  
                  if(inputs.constructor == Object) {//not Array && inputs.input.selection == "*"
                      var name = inputs.name;
0f6424fe   root   update new data-s...
439
440
                      var description = inputs.description;
                      var selection = inputs.selection;
a31f0660   root   sevc-controllet i...
441
442
                      inputs = [];
                      for(var i in this.fields)
0f6424fe   root   update new data-s...
443
                          inputs.push({name: name + " " + i, description: description, selection: selection});
a31f0660   root   sevc-controllet i...
444
445
446
447
                  }
  
                  this.inputs = inputs;
                  this.labels = labels;
a31f0660   root   sevc-controllet i...
448
  
e0e4a976   Renato De Donato   data-sevc-control...
449
450
451
452
  //                if(this.inputs[0].selection == "*")
  //                    this.selectedFields = [];
  //                else
                      this.selectedFields = new Array(inputs.length);
0f6424fe   root   update new data-s...
453
454
              },
  
e0e4a976   Renato De Donato   data-sevc-control...
455
              _addInput : function(e){
0f6424fe   root   update new data-s...
456
                  var selectedFields = this._copy(this.selectedFields);
0f6424fe   root   update new data-s...
457
  
e0e4a976   Renato De Donato   data-sevc-control...
458
                  var index = $(e.target).parents("paper-dropdown-menu")[0].id;
9579b866   Renato De Donato   firefox bug fix
459
                  selectedFields[index] = e.target.innerHTML.trim();
0f6424fe   root   update new data-s...
460
  
e0e4a976   Renato De Donato   data-sevc-control...
461
                  this.selectedFields = this._copy(selectedFields);
0f6424fe   root   update new data-s...
462
  
e0e4a976   Renato De Donato   data-sevc-control...
463
                  var load = true;
0f6424fe   root   update new data-s...
464
  
e0e4a976   Renato De Donato   data-sevc-control...
465
466
467
468
469
470
471
472
473
474
475
476
477
478
                  if(this.inputs[0].selection == "*"){
                      var temp = [];
                      for (var i = 0; i < selectedFields.length; i++)
                          if(selectedFields[i])
                             temp.push(selectedFields[i]);
                      selectedFields = temp;
                  }
                  else {
                      for (var i = 0; i < selectedFields.length; i++)
                          if (!selectedFields[i]) {
                              load = false;
                              break;
                          }
                  }
0f6424fe   root   update new data-s...
479
480
  
                  if(load){
ed1bed76   Renato De Donato   fix bug-modify in...
481
482
483
484
485
486
  //                    var labels = this.$.datalet_selection_labels.querySelectorAll("paper-textarea");
  //                    for (var i = 0; i < labels.length; i++) {
  //                        if (labels[i].innerHTML.trim() != "") {
  //                            this.params[labels[i].label] = labels[i].value;
  //                        }
  //                    }
97e0b0f8   Renato De Donato   google chart & lo...
487
                      
e0e4a976   Renato De Donato   data-sevc-control...
488
489
                      this._loadDatalet(selectedFields);
                  }
0f6424fe   root   update new data-s...
490
  
e0e4a976   Renato De Donato   data-sevc-control...
491
              },
0f6424fe   root   update new data-s...
492
  
e0e4a976   Renato De Donato   data-sevc-control...
493
              _loadDatalet : function(selectedFields){
57ef9bf4   Renato De Donato   labels + info
494
  //                var params = {'data-url' : this.dataUrl};
0f6424fe   root   update new data-s...
495
  
3c812cc9   Renato De Donato   title-desciption ...
496
                  var labels = this.$.datalet_selection_labels.querySelectorAll("paper-input");
ed1bed76   Renato De Donato   fix bug-modify in...
497
498
499
500
501
502
                  for (var i = 0; i < labels.length; i++) {
                      if (labels[i].innerHTML.trim() != "") {
                          this.params[labels[i].label] = labels[i].value;
                      }
                  }
  
3c812cc9   Renato De Donato   title-desciption ...
503
504
505
506
507
508
                  var labels = this.$.datalet_selection_labels.querySelectorAll("paper-textarea");
                  for (var i = 0; i < labels.length; i++) {
                      if (labels[i].innerHTML.trim() != "") {
                          this.params[labels[i].label] = labels[i].value;
                      }
                  }
ed1bed76   Renato De Donato   fix bug-modify in...
509
  
e0e4a976   Renato De Donato   data-sevc-control...
510
511
                  var dataletParams ={
                      component   : this.selectedDatalet+"-datalet",
57ef9bf4   Renato De Donato   labels + info
512
                      params      : this.params,
e0e4a976   Renato De Donato   data-sevc-control...
513
514
515
                      fields      : selectedFields,
                      placeHolder : this.$.datalet_selection_datalet_placeholder
                  };
0f6424fe   root   update new data-s...
516
  
e0e4a976   Renato De Donato   data-sevc-control...
517
518
                  ComponentService.deep_url = this.deepUrl;
                  ComponentService.getComponent(dataletParams);
a31f0660   root   sevc-controllet i...
519
  
e0e4a976   Renato De Donato   data-sevc-control...
520
                  this.async(function(){this.$.add_button.removeAttribute("disabled");}, 1111);
0f6424fe   root   update new data-s...
521
522
              },
  
e0e4a976   Renato De Donato   data-sevc-control...
523
              _addDatalet : function(){
0f6424fe   root   update new data-s...
524
  
9579b866   Renato De Donato   firefox bug fix
525
526
527
528
529
                  var selectedFields = [];
                  for (var i = 0; i < this.selectedFields.length; i++)
                      if(this.selectedFields[i])
                          selectedFields.push(this.selectedFields[i]);
  
3c812cc9   Renato De Donato   title-desciption ...
530
531
  //                console.log(this.params);
  
0f6424fe   root   update new data-s...
532
533
                  var data = {
                      dataUrl : this.dataUrl,
57ef9bf4   Renato De Donato   labels + info
534
                      params :  this.params,
9579b866   Renato De Donato   firefox bug fix
535
                      fields :  selectedFields,
0f6424fe   root   update new data-s...
536
                      datalet : this.selectedDatalet+"-datalet",
3c812cc9   Renato De Donato   title-desciption ...
537
  //                    comment : "",//DEPRECATED!!!
0f6424fe   root   update new data-s...
538
539
540
                      staticData : JSON.stringify(this.$.datalet_selection_datalet_placeholder.children[1].behavior.data)
                  }
  
3c812cc9   Renato De Donato   title-desciption ...
541
  //                console.log(data);
0f6424fe   root   update new data-s...
542
                  this.fire('data-sevc-controllet.dataletCreated', {data : data});
a31f0660   root   sevc-controllet i...
543
544
545
  
              },
  
57ef9bf4   Renato De Donato   labels + info
546
547
548
549
550
551
552
553
554
555
556
557
              _showInfo : function(e){
                  var t = e.target;
                  if(t.tagName.indexOf("IRON-ICON") != -1)
                      t = $(e.target).parents("paper-icon-button")[0];
  
                  var name = t.getAttribute("title").replace(" info", "");
  
                  var dataset = $.grep(this.inputs, function(e){ return e.name == name; })[0];
                  if(!dataset)
                      dataset = $.grep(this.labels, function(e){ return e.name == name; })[0];
  
                  this.$.dialog_name.innerHTML = dataset.name;
97e0b0f8   Renato De Donato   google chart & lo...
558
559
  //                this.$.dialog_description.innerHTML = dataset.description;
                  document.l10n.formatValue(dataset.description).then(s => this.$.dialog_description.innerHTML = s);
79ec939f   Renato De Donato   info position + a...
560
                  this.$.dialog_info_input.open();
57ef9bf4   Renato De Donato   labels + info
561
562
  
                  var pos = t.getBoundingClientRect();
79ec939f   Renato De Donato   info position + a...
563
564
                  $("#dialog_info_input").css("top", pos.top - 4);
                  $("#dialog_info_input").css("left", pos.left - 4);
57ef9bf4   Renato De Donato   labels + info
565
566
              },
  
e0e4a976   Renato De Donato   data-sevc-control...
567
568
569
570
571
572
573
574
575
576
              _copy : function(o) {
                  var out, v, key;
                  out = Array.isArray(o) ? new Array(o.length) : {};
                  for (key in o) {
                      v = o[key];
                      out[key] = (typeof v === "object") ? this._copy(v) : v;
                  }
                  return out;
              },
  
a31f0660   root   sevc-controllet i...
577
578
579
580
581
582
583
584
              _resize : function(){
                  var h = Math.max(document.documentElement.clientHeight, window.innerHeight || 0) - 16;
                  h = h - 64 - 8; //height with page scroller
  
                  $("#items_vslider_container").height(h);//vslider controllet
  
                  $("#datalet_selection_inputs").height(h);
                  $("#datalet_selection_labels").height(h);
ed1bed76   Renato De Donato   fix bug-modify in...
585
  //                if(this.modify)
3c812cc9   Renato De Donato   title-desciption ...
586
  //                    $("#datalet_selection_datalet").height(h-128);
ed1bed76   Renato De Donato   fix bug-modify in...
587
  //                else
3c812cc9   Renato De Donato   title-desciption ...
588
                      $("#datalet_selection_datalet").height(h);
a31f0660   root   sevc-controllet i...
589
590
591
592
593
594
595
              }
  
          });
  
      </script>
  
  </dom-module>