Blame view

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