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>
|
59100bec
Renato De Donato
localization + ba...
|
213
|
<!--{{_fieldName(item)}}-->
|
a31f0660
root
sevc-controllet i...
|
214
215
216
|
</template>
</paper-menu>
</paper-dropdown-menu>
|
e0e4a976
Renato De Donato
data-sevc-control...
|
217
218
219
|
<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...
|
220
221
222
223
224
|
</div>
</template>
</paper-material>
<paper-material id="datalet_selection_labels" elevation="5">
|
3c812cc9
Renato De Donato
title-desciption ...
|
225
226
227
|
<div class="input_header"><span data-l10n-id="baseInfo"></span></div>
<div class="inputs">
|
4b79b3c8
Renato De Donato
datalet-selection...
|
228
|
<paper-input maxlength="32" label="title" class="base_input"></paper-input>
|
3c812cc9
Renato De Donato
title-desciption ...
|
229
230
231
|
</div>
<div class="inputs">
|
4b79b3c8
Renato De Donato
datalet-selection...
|
232
|
<paper-textarea maxlength="100" label="description" class="base_input"></paper-textarea>
|
3c812cc9
Renato De Donato
title-desciption ...
|
233
234
235
236
|
</div>
<div class="input_header"><span data-l10n-id="layouts"></span></div>
|
a31f0660
root
sevc-controllet i...
|
237
238
|
<template is="dom-repeat" items="{{labels}}" index-as="index">
<div class="inputs">
|
4b79b3c8
Renato De Donato
datalet-selection...
|
239
|
<paper-input label={{item.name}}></paper-input>
|
e0e4a976
Renato De Donato
data-sevc-control...
|
240
241
|
<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...
|
242
|
</div>
|
a31f0660
root
sevc-controllet i...
|
243
244
245
246
247
248
|
</div>
</template>
</paper-material>
<div id="datalet_selection_column">
|
e0e4a976
Renato De Donato
data-sevc-control...
|
249
|
|
83faae2e
Renato De Donato
comment-modify
|
250
|
<!--<template is="dom-if" if={{modify}}>-->
|
3c812cc9
Renato De Donato
title-desciption ...
|
251
252
253
254
|
<!--<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
|
255
|
<!--</template>-->
|
a31f0660
root
sevc-controllet i...
|
256
257
|
<paper-material id="datalet_selection_datalet" elevation="5">
|
97e0b0f8
Renato De Donato
google chart & lo...
|
258
|
<div class="input_header"><span data-l10n-id="dataletPreview"></span></div>
|
a31f0660
root
sevc-controllet i...
|
259
260
261
262
|
<div id="datalet_selection_datalet_placeholder"></div>
</paper-material>
|
97e0b0f8
Renato De Donato
google chart & lo...
|
263
|
<paper-button id="add_button" disabled raised on-click="_addDatalet"><span data-l10n-id="addDatalet"></span></paper-button>
|
a31f0660
root
sevc-controllet i...
|
264
265
266
|
</div>
|
79ec939f
Renato De Donato
info position + a...
|
267
|
<paper-dialog id="dialog_info_input">
|
57ef9bf4
Renato De Donato
labels + info
|
268
269
270
271
|
<h2 id="dialog_name"></h2>
<p id="dialog_description"></p>
</paper-dialog>
|
a31f0660
root
sevc-controllet i...
|
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
298
|
</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...
|
299
300
301
302
303
|
preselectedDatalet : {
type : String,
value : undefined
},
|
d2da5141
Renato De Donato
async 0
|
304
305
306
307
308
309
310
311
312
313
|
loadPreview : {
type : Boolean,
value : false
},
type : {
type : String,
value : undefined
},
|
a31f0660
root
sevc-controllet i...
|
314
315
316
317
318
319
320
321
322
323
324
325
|
inputs : {
type : Array,
value : []
},
labels : {
type : Array,
value : []
},
fields : {
type : Array,
|
0f6424fe
root
update new data-s...
|
326
327
328
329
330
331
332
333
|
value : []
},
selectedFields : {
type : Array,
value : []
},
|
e8219f9a
Renato De Donato
datalet-mod
|
334
335
336
337
338
|
dataletPreset : {
type : Object,
value : []
},
|
e0e4a976
Renato De Donato
data-sevc-control...
|
339
340
341
342
|
// selectableFields : {
// type : Array,
// value : []
// },
|
a31f0660
root
sevc-controllet i...
|
343
344
345
|
dataUrl : {
type : String,
|
0f6424fe
root
update new data-s...
|
346
|
value : undefined
|
e0e4a976
Renato De Donato
data-sevc-control...
|
347
348
|
},
|
57ef9bf4
Renato De Donato
labels + info
|
349
350
351
352
353
|
params:{
type: Object,
value: undefined
},
|
e0e4a976
Renato De Donato
data-sevc-control...
|
354
355
356
|
modify : {
type : Boolean,
value : false
|
a31f0660
root
sevc-controllet i...
|
357
358
359
360
361
|
}
},
listeners: {
|
4b79b3c8
Renato De Donato
datalet-selection...
|
362
|
'items-vslider-controllet_selected-datalet': '_selectDatalet',
|
0f6424fe
root
update new data-s...
|
363
|
// 'tree-view-controllet_selected-fields': '_updateSelectedFields'
|
b4accc86
Renato De Donato
datalet improved
|
364
|
'change': '_paramsChanged'
|
a31f0660
root
sevc-controllet i...
|
365
366
|
},
|
e8219f9a
Renato De Donato
datalet-mod
|
367
|
ready : function() {//console.log(this.dataletPreset);
|
a31f0660
root
sevc-controllet i...
|
368
369
370
371
|
this._resize();
$(this.$.datalet_selection_inputs).perfectScrollbar();
$(this.$.datalet_selection_labels).perfectScrollbar();
$(this.$.datalet_selection_datalet).perfectScrollbar();
|
0f6424fe
root
update new data-s...
|
372
|
|
ed1bed76
Renato De Donato
fix bug-modify in...
|
373
374
375
|
this.params = {'data-url' : this.dataUrl};
//this.modify = true;//da eliminare in futuro
|
e0e4a976
Renato De Donato
data-sevc-control...
|
376
377
378
379
380
|
if(this.preselectedDatalet){
this.modify = true;
this._preselectDatalet();
this.preselectedDatalet = undefined;
}
|
a31f0660
root
sevc-controllet i...
|
381
382
383
384
385
386
|
},
attached : function() {
this._resize();
var that = this;
window.addEventListener("resize", function() { that._resize(); });
|
e0e4a976
Renato De Donato
data-sevc-control...
|
387
|
|
97e0b0f8
Renato De Donato
google chart & lo...
|
388
|
this._translate();
|
97e0b0f8
Renato De Donato
google chart & lo...
|
389
390
|
},
|
0f6424fe
root
update new data-s...
|
391
392
393
394
|
setFields : function(fields) {
this.fields = fields;
},
|
e0e4a976
Renato De Donato
data-sevc-control...
|
395
396
397
398
399
400
401
|
reset : function() {
this.selectedDatalet = undefined;
this.inputs = [];
this.labels = [];
this.$.datalet_selection_datalet_placeholder.innerHTML = "";
},
|
3c812cc9
Renato De Donato
title-desciption ...
|
402
403
404
405
406
407
|
_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...
|
408
|
_selectDatalet : function(e){
|
0f6424fe
root
update new data-s...
|
409
410
|
this.$.add_button.setAttribute("disabled", "true");
|
a31f0660
root
sevc-controllet i...
|
411
|
this.selectedDatalet = e.detail.datalet;
|
0f6424fe
root
update new data-s...
|
412
|
|
d2da5141
Renato De Donato
async 0
|
413
414
415
416
417
418
419
420
421
|
this.$.datalet_selection_datalet_placeholder.innerHTML = "";
if(!this.selectedDatalet){
this.type = undefined;
this.inputs = [];
this.labels = [];
this.loadPreview = false;
}
else{
|
a31f0660
root
sevc-controllet i...
|
422
423
424
|
this.$.selectedDatalet_request.url = this.deepUrl + e.detail.datalet + "-datalet";
this.$.selectedDatalet_request.generateRequest();
}
|
e0e4a976
Renato De Donato
data-sevc-control...
|
425
|
},
|
0f6424fe
root
update new data-s...
|
426
|
|
e0e4a976
Renato De Donato
data-sevc-control...
|
427
|
_preselectDatalet : function() {
|
e0e4a976
Renato De Donato
data-sevc-control...
|
428
429
430
431
432
433
434
|
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 ...
|
435
|
//set info labels options
|
e8219f9a
Renato De Donato
datalet-mod
|
436
437
438
439
440
441
442
443
|
var labels = this.$.datalet_selection_labels.querySelectorAll("paper-textarea");
for (var i = 0; i < labels.length; i++)
labels[i].value = this.dataletPreset[labels[i].label];
var labels = this.$.datalet_selection_labels.querySelectorAll("paper-input");
for (var i = 0; i < labels.length; i++)
labels[i].value = this.dataletPreset[labels[i].label];
|
3c812cc9
Renato De Donato
title-desciption ...
|
444
|
|
59100bec
Renato De Donato
localization + ba...
|
445
|
this.loadPreview = true;
|
e0e4a976
Renato De Donato
data-sevc-control...
|
446
|
this._loadDatalet(this.selectedFields);
|
a31f0660
root
sevc-controllet i...
|
447
448
|
},
|
0f6424fe
root
update new data-s...
|
449
|
_handleSelectedDatalet : function(e){
|
0f6424fe
root
update new data-s...
|
450
|
|
d2da5141
Renato De Donato
async 0
|
451
|
if(this.type != e.detail.response.type) {
|
a31f0660
root
sevc-controllet i...
|
452
|
|
d2da5141
Renato De Donato
async 0
|
453
454
455
456
457
458
459
460
461
462
463
464
465
|
this.inputs = [];
this.labels = [];
var inputs = e.detail.response.idm.inputs.input;
if (inputs.constructor == Object) {//not Array && inputs.input.selection == "*"
var name = inputs.name;
var description = inputs.description;
var selection = inputs.selection;
inputs = [];
for (var i in this.fields)
inputs.push({name: name + " " + i, description: description, selection: selection});
}
|
a31f0660
root
sevc-controllet i...
|
466
|
|
d2da5141
Renato De Donato
async 0
|
467
468
469
470
|
this.async(function(){
this.type = e.detail.response.type;
this.inputs = inputs;
this.labels = e.detail.response.idm.inputs.layouts.input;
|
a31f0660
root
sevc-controllet i...
|
471
|
|
d2da5141
Renato De Donato
async 0
|
472
473
474
475
476
477
478
479
|
this.selectedFields = new Array(inputs.length);
},0);
this.loadPreview = false;
}
else if (this.loadPreview)
this._loadDatalet(this.selectedFields);
|
0f6424fe
root
update new data-s...
|
480
481
|
},
|
e0e4a976
Renato De Donato
data-sevc-control...
|
482
|
_addInput : function(e){
|
0f6424fe
root
update new data-s...
|
483
|
var selectedFields = this._copy(this.selectedFields);
|
0f6424fe
root
update new data-s...
|
484
|
|
e0e4a976
Renato De Donato
data-sevc-control...
|
485
|
var index = $(e.target).parents("paper-dropdown-menu")[0].id;
|
9579b866
Renato De Donato
firefox bug fix
|
486
|
selectedFields[index] = e.target.innerHTML.trim();
|
0f6424fe
root
update new data-s...
|
487
|
|
e0e4a976
Renato De Donato
data-sevc-control...
|
488
|
this.selectedFields = this._copy(selectedFields);
|
0f6424fe
root
update new data-s...
|
489
|
|
e0e4a976
Renato De Donato
data-sevc-control...
|
490
|
var load = true;
|
0f6424fe
root
update new data-s...
|
491
|
|
e0e4a976
Renato De Donato
data-sevc-control...
|
492
493
494
495
496
497
498
499
500
501
502
503
504
505
|
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...
|
506
507
|
if(load){
|
d2da5141
Renato De Donato
async 0
|
508
|
this.loadPreview = true
|
e0e4a976
Renato De Donato
data-sevc-control...
|
509
510
|
this._loadDatalet(selectedFields);
}
|
0f6424fe
root
update new data-s...
|
511
|
|
e0e4a976
Renato De Donato
data-sevc-control...
|
512
|
},
|
0f6424fe
root
update new data-s...
|
513
|
|
b4accc86
Renato De Donato
datalet improved
|
514
|
_updateParams : function(){
|
e8219f9a
Renato De Donato
datalet-mod
|
515
516
|
var labels = this.$.datalet_selection_labels.querySelectorAll("paper-textarea");
|
b4accc86
Renato De Donato
datalet improved
|
517
518
519
520
|
this.params[labels[0].label] = labels[0].value;
if(!labels[0].value)
this.params[labels[0].label] = "";
|
0f6424fe
root
update new data-s...
|
521
|
|
3c812cc9
Renato De Donato
title-desciption ...
|
522
|
var labels = this.$.datalet_selection_labels.querySelectorAll("paper-input");
|
e8219f9a
Renato De Donato
datalet-mod
|
523
524
|
for (var i = 0; i < labels.length; i++)
this.params[labels[i].label] = labels[i].value;
|
b4accc86
Renato De Donato
datalet improved
|
525
526
527
528
529
|
},
_paramsChanged : function(){
this._updateParams();
|
e8219f9a
Renato De Donato
datalet-mod
|
530
|
|
4b79b3c8
Renato De Donato
datalet-selection...
|
531
532
|
if(this.$.datalet_selection_datalet_placeholder.children[1])
this.$.datalet_selection_datalet_placeholder.children[1].behavior.setParameters(this.params);
|
e8219f9a
Renato De Donato
datalet-mod
|
533
534
535
536
|
},
_loadDatalet : function(selectedFields){
|
b4accc86
Renato De Donato
datalet improved
|
537
|
this._updateParams();
|
e8219f9a
Renato De Donato
datalet-mod
|
538
|
|
e0e4a976
Renato De Donato
data-sevc-control...
|
539
540
|
var dataletParams ={
component : this.selectedDatalet+"-datalet",
|
57ef9bf4
Renato De Donato
labels + info
|
541
|
params : this.params,
|
e0e4a976
Renato De Donato
data-sevc-control...
|
542
543
544
|
fields : selectedFields,
placeHolder : this.$.datalet_selection_datalet_placeholder
};
|
0f6424fe
root
update new data-s...
|
545
|
|
e0e4a976
Renato De Donato
data-sevc-control...
|
546
547
|
ComponentService.deep_url = this.deepUrl;
ComponentService.getComponent(dataletParams);
|
a31f0660
root
sevc-controllet i...
|
548
|
|
59100bec
Renato De Donato
localization + ba...
|
549
550
|
// this.async(function(){this.$.add_button.removeAttribute("disabled");}, 1000);
this.$.add_button.removeAttribute("disabled");
|
0f6424fe
root
update new data-s...
|
551
552
|
},
|
e0e4a976
Renato De Donato
data-sevc-control...
|
553
|
_addDatalet : function(){
|
0f6424fe
root
update new data-s...
|
554
|
|
9579b866
Renato De Donato
firefox bug fix
|
555
556
557
558
559
|
var selectedFields = [];
for (var i = 0; i < this.selectedFields.length; i++)
if(this.selectedFields[i])
selectedFields.push(this.selectedFields[i]);
|
b4accc86
Renato De Donato
datalet improved
|
560
|
console.log(this.params);
|
3c812cc9
Renato De Donato
title-desciption ...
|
561
|
|
0f6424fe
root
update new data-s...
|
562
563
|
var data = {
dataUrl : this.dataUrl,
|
57ef9bf4
Renato De Donato
labels + info
|
564
|
params : this.params,
|
9579b866
Renato De Donato
firefox bug fix
|
565
|
fields : selectedFields,
|
0f6424fe
root
update new data-s...
|
566
|
datalet : this.selectedDatalet+"-datalet",
|
3c812cc9
Renato De Donato
title-desciption ...
|
567
|
// comment : "",//DEPRECATED!!!
|
0f6424fe
root
update new data-s...
|
568
569
570
|
staticData : JSON.stringify(this.$.datalet_selection_datalet_placeholder.children[1].behavior.data)
}
|
0f6424fe
root
update new data-s...
|
571
|
this.fire('data-sevc-controllet.dataletCreated', {data : data});
|
a31f0660
root
sevc-controllet i...
|
572
573
574
|
},
|
57ef9bf4
Renato De Donato
labels + info
|
575
576
577
578
579
580
581
582
583
584
585
586
|
_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...
|
587
588
|
// 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...
|
589
|
this.$.dialog_info_input.open();
|
57ef9bf4
Renato De Donato
labels + info
|
590
591
|
var pos = t.getBoundingClientRect();
|
79ec939f
Renato De Donato
info position + a...
|
592
593
|
$("#dialog_info_input").css("top", pos.top - 4);
$("#dialog_info_input").css("left", pos.left - 4);
|
57ef9bf4
Renato De Donato
labels + info
|
594
595
|
},
|
59100bec
Renato De Donato
localization + ba...
|
596
597
598
599
|
_fieldName : function(field) {
return field.substring(field.lastIndexOf(",")+1, field.length);;
},
|
e0e4a976
Renato De Donato
data-sevc-control...
|
600
601
602
603
604
605
606
607
608
609
|
_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...
|
610
611
612
613
614
615
616
617
|
_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...
|
618
|
// if(this.modify)
|
3c812cc9
Renato De Donato
title-desciption ...
|
619
|
// $("#datalet_selection_datalet").height(h-128);
|
ed1bed76
Renato De Donato
fix bug-modify in...
|
620
|
// else
|
3c812cc9
Renato De Donato
title-desciption ...
|
621
|
$("#datalet_selection_datalet").height(h);
|
a31f0660
root
sevc-controllet i...
|
622
623
624
625
626
627
628
|
}
});
</script>
</dom-module>
|