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
|
}
|
3d8cde48
Renato De Donato
safari bug fix
|
42
43
|
#items_vslider_controllet {
position: relative;
|
58a818e7
Renato De Donato
safari bug fix
|
44
|
min-width: 172px;
|
3d8cde48
Renato De Donato
safari bug fix
|
45
46
|
}
|
a31f0660
root
sevc-controllet i...
|
47
48
49
50
|
#datalet_selection_inputs {
position: relative;
height: 100vh;
margin-left: 32px;
|
e0e4a976
Renato De Donato
data-sevc-control...
|
51
|
min-width: 258px;
|
a31f0660
root
sevc-controllet i...
|
52
53
54
55
56
57
|
}
#datalet_selection_labels {
position: relative;
height: 100vh;
margin-left: 32px;
|
e0e4a976
Renato De Donato
data-sevc-control...
|
58
|
min-width: 258px;
|
a31f0660
root
sevc-controllet i...
|
59
60
61
62
63
64
65
66
67
68
69
70
|
}
#datalet_selection_column {
position: relative;
width: 100%;
margin-left: 32px;
}
#datalet_selection_datalet {
position: relative;
height: 100vh;
width: 100%;
|
a31f0660
root
sevc-controllet i...
|
71
72
73
74
75
76
77
78
|
}
#datalet_selection_datalet_placeholder {
padding: 16px;
}
.inputs{
position: relative;
|
a31f0660
root
sevc-controllet i...
|
79
80
|
}
|
98d9d8a5
Renato De Donato
filters+groupby
|
81
82
83
84
85
86
87
88
89
90
91
|
.input_header {
height: 32px;
padding-top: 16px;
text-align: center;
font-weight: 700;
background-color: #B6B6B6;
}
#expert_container {
display: none;
}
|
a31f0660
root
sevc-controllet i...
|
92
|
|
98d9d8a5
Renato De Donato
filters+groupby
|
93
94
|
#expert_header {
display: none;
|
a31f0660
root
sevc-controllet i...
|
95
|
|
e0e4a976
Renato De Donato
data-sevc-control...
|
96
97
|
height: 32px;
padding-top: 16px;
|
98d9d8a5
Renato De Donato
filters+groupby
|
98
|
margin-top: 8px;
|
a31f0660
root
sevc-controllet i...
|
99
100
|
text-align: center;
font-weight: 700;
|
98d9d8a5
Renato De Donato
filters+groupby
|
101
102
103
104
105
106
107
108
109
110
111
112
113
|
color: #00BCD4;
cursor: pointer;
}
.field_nema {
height: 40px;
padding-top: 8px;
margin-top: 8px;
padding-left: 16px;
font-weight: 700;
color: #2196F3;
background-color: #E0E0E0;
|
a31f0660
root
sevc-controllet i...
|
114
115
116
|
}
.info_button {
|
a31f0660
root
sevc-controllet i...
|
117
|
position: absolute;
|
e0e4a976
Renato De Donato
data-sevc-control...
|
118
|
top: 18px;
|
a31f0660
root
sevc-controllet i...
|
119
120
121
|
right: 0px;
}
|
3c812cc9
Renato De Donato
title-desciption ...
|
122
|
paper-input {
|
e0e4a976
Renato De Donato
data-sevc-control...
|
123
|
display: inline-block;
|
a31f0660
root
sevc-controllet i...
|
124
|
height: 48px;
|
e0e4a976
Renato De Donato
data-sevc-control...
|
125
126
127
128
|
/*padding: 0px 8px;*/
width: 210px;
padding-left: 8px;
padding-bottom: 8px;
|
a31f0660
root
sevc-controllet i...
|
129
130
131
|
--paper-input-container-focus-color: #2196F3;
}
|
3c812cc9
Renato De Donato
title-desciption ...
|
132
133
134
135
136
|
paper-input.base_input {
width: 242px;
}
paper-textarea {
|
3c812cc9
Renato De Donato
title-desciption ...
|
137
138
139
140
141
142
|
width: 242px;
padding-left: 8px;
padding-bottom: 4px;
--paper-input-container-focus-color: #2196F3;
}
|
a31f0660
root
sevc-controllet i...
|
143
|
paper-dropdown-menu {
|
a31f0660
root
sevc-controllet i...
|
144
|
height: 48px;
|
e0e4a976
Renato De Donato
data-sevc-control...
|
145
|
width: 210px;;
|
e0e4a976
Renato De Donato
data-sevc-control...
|
146
147
|
padding-left: 8px;
padding-bottom: 8px;
|
a31f0660
root
sevc-controllet i...
|
148
149
150
151
152
153
154
155
156
|
--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...
|
157
|
color: #2196F3;
|
a31f0660
root
sevc-controllet i...
|
158
|
--paper-icon-button-ink-color: #2196F3;
|
e0e4a976
Renato De Donato
data-sevc-control...
|
159
|
margin: 0px;
|
a31f0660
root
sevc-controllet i...
|
160
161
162
|
}
paper-button {
|
a31f0660
root
sevc-controllet i...
|
163
164
165
166
|
position: absolute;
bottom: 16px;
right: 11px;
|
a31f0660
root
sevc-controllet i...
|
167
168
169
170
171
172
173
174
175
176
|
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 ...
|
177
178
179
180
|
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...
|
181
|
}
|
0f6424fe
root
update new data-s...
|
182
183
184
185
|
paper-button[disabled] {
background-color: #B6B6B6;
}
|
57ef9bf4
Renato De Donato
labels + info
|
186
|
|
79ec939f
Renato De Donato
info position + a...
|
187
|
#dialog_info_input {
|
57ef9bf4
Renato De Donato
labels + info
|
188
189
|
border: 2px solid #2196F3;
background-color: #E0E0E0;
|
3c812cc9
Renato De Donato
title-desciption ...
|
190
|
min-width: 248px;
|
57ef9bf4
Renato De Donato
labels + info
|
191
|
}
|
a31f0660
root
sevc-controllet i...
|
192
193
|
</style>
|
0f6424fe
root
update new data-s...
|
194
|
<iron-ajax id="selectedDatalet_request" on-response="_handleSelectedDatalet"></iron-ajax>
|
a31f0660
root
sevc-controllet i...
|
195
196
|
<div id="datalet_selection_container">
|
3d8cde48
Renato De Donato
safari bug fix
|
197
198
199
200
|
<div id="items_vslider_controllet">
<items-vslider-controllet id="vslider" datalets-list-url={{dataletsListUrl}} preselected-datalet={{preselectedDatalet}}></items-vslider-controllet>
</div>
|
a31f0660
root
sevc-controllet i...
|
201
|
|
a31f0660
root
sevc-controllet i...
|
202
|
<paper-material id="datalet_selection_inputs" elevation="5">
|
6d2a2a1e
Andrea Petta
language handling
|
203
|
<div class="input_header"><span id="inputs"></span></div>
|
e0e4a976
Renato De Donato
data-sevc-control...
|
204
|
<template is="dom-repeat" items="{{inputs}}" index-as="ddl_index">
|
a31f0660
root
sevc-controllet i...
|
205
|
<div class="inputs">
|
ac237fdd
Renato De Donato
controllet ln
|
206
|
<paper-dropdown-menu id={{ddl_index}} label={{_getLabelName(item.name)}}>
|
a31f0660
root
sevc-controllet i...
|
207
|
<paper-menu class="dropdown-content">
|
e0e4a976
Renato De Donato
data-sevc-control...
|
208
|
<template is="dom-repeat" items={{fields}}>
|
0b7cbd33
Renato De Donato
title-desciption
|
209
|
<paper-item id={{index}} on-tap="_addInput">{{_fieldName(item)}}</paper-item>
|
59100bec
Renato De Donato
localization + ba...
|
210
|
<!--{{_fieldName(item)}}-->
|
a31f0660
root
sevc-controllet i...
|
211
212
213
|
</template>
</paper-menu>
</paper-dropdown-menu>
|
e0e4a976
Renato De Donato
data-sevc-control...
|
214
|
<div class="info_button">
|
ac237fdd
Renato De Donato
controllet ln
|
215
|
<paper-icon-button id={{item.name}} on-click="_showInfo" icon="info-outline" title="{{_getLabelName(item.name)}} info"></paper-icon-button>
|
e0e4a976
Renato De Donato
data-sevc-control...
|
216
|
</div>
|
a31f0660
root
sevc-controllet i...
|
217
218
|
</div>
</template>
|
98d9d8a5
Renato De Donato
filters+groupby
|
219
220
221
|
<!-- EXPERT MODE EXPERT MODE EXPERT MODE EXPERT MODE EXPERT MODE EXPERT MODE EXPERT MODE EXPERT MODE -->
|
39d5ab70
Renato De Donato
update filters
|
222
|
<div id="expert_header" on-click="_showExpertMode"><span id="expert">GROUP BY</span></div>
|
98d9d8a5
Renato De Donato
filters+groupby
|
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
|
<div id="expert_container">
<div class="inputs">
<paper-dropdown-menu id="group_by" label="GROUP BY">
<paper-menu class="dropdown-content">
<template is="dom-repeat" items={{selectedFields}}>
<paper-item id={{index}} on-tap="_showGroupedFields">{{_fieldName(item)}}</paper-item>
</template>
</paper-menu>
</paper-dropdown-menu>
<div class="info_button">
<paper-icon-button id="gb" on-click="_addOrder" icon="unfold-more" title="unsort"></paper-icon-button>
</div>
</div>
<template is="dom-repeat" items="{{groupedFields}}">
<div class="inputs">
<paper-dropdown-menu id="calculate_{{index}}" label="CALCULATE">
<paper-menu class="dropdown-content">
<paper-item on-tap="_addGroupByInput">COUNT of {{_fieldName(item)}}</paper-item>
<paper-item on-tap="_addGroupByInput">SUM of {{_fieldName(item)}}</paper-item>
<paper-item on-tap="_addGroupByInput">MIN of {{_fieldName(item)}}</paper-item>
<paper-item on-tap="_addGroupByInput">MAX of {{_fieldName(item)}}</paper-item>
<paper-item on-tap="_addGroupByInput">AVG of {{_fieldName(item)}}</paper-item>
<paper-item on-tap="_addGroupByInput">FIRST of {{_fieldName(item)}}</paper-item>
<paper-item on-tap="_addGroupByInput">LAST of {{_fieldName(item)}}</paper-item>
</paper-menu>
</paper-dropdown-menu>
<div class="info_button">
<paper-icon-button id={{_fieldName(item)}} on-click="_addOrder" icon="unfold-more" title="unsort"></paper-icon-button>
</div>
</div>
</template>
</div>
<!-- EXPERT MODE EXPERT MODE EXPERT MODE EXPERT MODE EXPERT MODE EXPERT MODE EXPERT MODE EXPERT MODE -->
|
a31f0660
root
sevc-controllet i...
|
262
263
264
|
</paper-material>
<paper-material id="datalet_selection_labels" elevation="5">
|
6d2a2a1e
Andrea Petta
language handling
|
265
|
<div class="input_header"><span id="baseInfo"></span></div>
|
3c812cc9
Renato De Donato
title-desciption ...
|
266
267
|
<div class="inputs">
|
ac237fdd
Renato De Donato
controllet ln
|
268
|
<paper-input id="base_title" maxlength="32" class="base_input"></paper-input>
|
3c812cc9
Renato De Donato
title-desciption ...
|
269
270
271
|
</div>
<div class="inputs">
|
ac237fdd
Renato De Donato
controllet ln
|
272
|
<paper-textarea id="base_description" maxlength="100" class="base_input"></paper-textarea>
|
3c812cc9
Renato De Donato
title-desciption ...
|
273
274
|
</div>
|
6d2a2a1e
Andrea Petta
language handling
|
275
|
<div class="input_header"><span id="layouts"></span></div>
|
3c812cc9
Renato De Donato
title-desciption ...
|
276
|
|
a31f0660
root
sevc-controllet i...
|
277
278
|
<template is="dom-repeat" items="{{labels}}" index-as="index">
<div class="inputs">
|
ac237fdd
Renato De Donato
controllet ln
|
279
|
<paper-input label={{_getLabelName(item.name)}}></paper-input>
|
e0e4a976
Renato De Donato
data-sevc-control...
|
280
|
<div class="info_button">
|
ac237fdd
Renato De Donato
controllet ln
|
281
|
<paper-icon-button id={{item.name}} on-click="_showInfo" icon="info-outline" title="{{_getLabelName(item.name)}} info"></paper-icon-button>
|
a31f0660
root
sevc-controllet i...
|
282
|
</div>
|
a31f0660
root
sevc-controllet i...
|
283
284
285
286
287
288
|
</div>
</template>
</paper-material>
<div id="datalet_selection_column">
|
e0e4a976
Renato De Donato
data-sevc-control...
|
289
|
|
a31f0660
root
sevc-controllet i...
|
290
|
<paper-material id="datalet_selection_datalet" elevation="5">
|
6d2a2a1e
Andrea Petta
language handling
|
291
|
<div class="input_header"><span id="dataletPreview"></span></div>
|
a31f0660
root
sevc-controllet i...
|
292
293
294
295
|
<div id="datalet_selection_datalet_placeholder"></div>
</paper-material>
|
6d2a2a1e
Andrea Petta
language handling
|
296
|
<paper-button id="add_button" disabled raised on-click="_addDatalet"></paper-button>
|
a31f0660
root
sevc-controllet i...
|
297
298
299
|
</div>
|
79ec939f
Renato De Donato
info position + a...
|
300
|
<paper-dialog id="dialog_info_input">
|
57ef9bf4
Renato De Donato
labels + info
|
301
302
303
304
|
<h2 id="dialog_name"></h2>
<p id="dialog_description"></p>
</paper-dialog>
|
a31f0660
root
sevc-controllet i...
|
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
|
</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...
|
332
333
334
335
336
|
preselectedDatalet : {
type : String,
value : undefined
},
|
d2da5141
Renato De Donato
async 0
|
337
338
339
340
341
342
343
344
345
346
|
loadPreview : {
type : Boolean,
value : false
},
type : {
type : String,
value : undefined
},
|
a31f0660
root
sevc-controllet i...
|
347
348
349
350
351
352
353
354
355
356
|
inputs : {
type : Array,
value : []
},
labels : {
type : Array,
value : []
},
|
98d9d8a5
Renato De Donato
filters+groupby
|
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
|
filters : {
type : Array,
value : []
},
aggregators : {
type : Array,
value : []
},
orders : {
type : Array,
value : []
},
|
a31f0660
root
sevc-controllet i...
|
372
373
|
fields : {
type : Array,
|
0f6424fe
root
update new data-s...
|
374
375
376
377
378
379
380
381
|
value : []
},
selectedFields : {
type : Array,
value : []
},
|
98d9d8a5
Renato De Donato
filters+groupby
|
382
383
384
385
386
|
groupedFields : {
type : Array,
value : []
},
|
e8219f9a
Renato De Donato
datalet-mod
|
387
388
389
390
391
|
dataletPreset : {
type : Object,
value : []
},
|
e0e4a976
Renato De Donato
data-sevc-control...
|
392
393
394
395
|
// selectableFields : {
// type : Array,
// value : []
// },
|
a31f0660
root
sevc-controllet i...
|
396
397
398
|
dataUrl : {
type : String,
|
0f6424fe
root
update new data-s...
|
399
|
value : undefined
|
e0e4a976
Renato De Donato
data-sevc-control...
|
400
401
|
},
|
57ef9bf4
Renato De Donato
labels + info
|
402
403
404
405
406
|
params:{
type: Object,
value: undefined
},
|
98d9d8a5
Renato De Donato
filters+groupby
|
407
408
409
410
411
|
expert : {
type : Boolean,
value : false
},
|
e0e4a976
Renato De Donato
data-sevc-control...
|
412
413
414
|
modify : {
type : Boolean,
value : false
|
a31f0660
root
sevc-controllet i...
|
415
416
417
418
419
|
}
},
listeners: {
|
4b79b3c8
Renato De Donato
datalet-selection...
|
420
|
'items-vslider-controllet_selected-datalet': '_selectDatalet',
|
0f6424fe
root
update new data-s...
|
421
|
// 'tree-view-controllet_selected-fields': '_updateSelectedFields'
|
b4accc86
Renato De Donato
datalet improved
|
422
|
'change': '_paramsChanged'
|
a31f0660
root
sevc-controllet i...
|
423
424
|
},
|
98d9d8a5
Renato De Donato
filters+groupby
|
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
|
_showExpertMode : function() {
if(!this.expert) {
this.$.expert_header.style.color = "#000000";
this.$.expert_header.style.background = "#B6B6B6";
this.$.expert_container.style.display = "block";
}
else {
this.$.expert_header.style.color = "#00BCD4";
this.$.expert_header.style.background = "#FFFFFF";
this.$.expert_container.style.display = "none";
}
this.expert = !this.expert;
},
_showGroupedFields : function(e) {
var index = e.target.id;
var isSelected = false;
var temp = [];
for (var i = 0; i < this.selectedFields.length; i++) {
if (this.selectedFields[i]) {
if (this.selectedFields[i].indexOf(this.fields[index]) > -1) {
isSelected = true;
}
else {
temp.push(this.selectedFields[i])
}
}
}
if (isSelected)
this.groupedFields = this._copy(temp);
else
this.groupedFields =[];
this.async(function() {
var ddls = document.getElementsByTagName("paper-dropdown-menu");
for (var i = 0; i < ddls.length; i++){
var id = ddls[i].id;
if(id.indexOf("calculate") > -1) {
$(ddls[i]).find("paper-menu")[0].select(-1);
$(ddls[i]).find("paper-menu")[0].select(0);
}
}
}, 0);
this._addGroupByInput();
},
ready : function() {
|
a31f0660
root
sevc-controllet i...
|
476
477
478
479
|
this._resize();
$(this.$.datalet_selection_inputs).perfectScrollbar();
$(this.$.datalet_selection_labels).perfectScrollbar();
$(this.$.datalet_selection_datalet).perfectScrollbar();
|
0f6424fe
root
update new data-s...
|
480
|
|
ed1bed76
Renato De Donato
fix bug-modify in...
|
481
482
483
|
this.params = {'data-url' : this.dataUrl};
//this.modify = true;//da eliminare in futuro
|
e0e4a976
Renato De Donato
data-sevc-control...
|
484
|
if(this.preselectedDatalet){
|
0b7cbd33
Renato De Donato
title-desciption
|
485
486
487
|
if(this.modify)
this._preselectDatalet();
|
e0e4a976
Renato De Donato
data-sevc-control...
|
488
|
this.modify = true;
|
e0e4a976
Renato De Donato
data-sevc-control...
|
489
490
|
this.preselectedDatalet = undefined;
}
|
a31f0660
root
sevc-controllet i...
|
491
492
493
494
495
496
|
},
attached : function() {
this._resize();
var that = this;
window.addEventListener("resize", function() { that._resize(); });
|
e0e4a976
Renato De Donato
data-sevc-control...
|
497
|
|
97e0b0f8
Renato De Donato
google chart & lo...
|
498
|
this._translate();
|
97e0b0f8
Renato De Donato
google chart & lo...
|
499
500
|
},
|
98d9d8a5
Renato De Donato
filters+groupby
|
501
502
503
504
|
setFilters : function(filters) {
this.filters = filters;
},
|
0f6424fe
root
update new data-s...
|
505
506
507
508
|
setFields : function(fields) {
this.fields = fields;
},
|
e0e4a976
Renato De Donato
data-sevc-control...
|
509
|
reset : function() {
|
98d9d8a5
Renato De Donato
filters+groupby
|
510
511
512
|
this.selectedDatalet = undefined;//non va!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
this.preselectedDatalet = undefined;
this.type = undefined;
|
e0e4a976
Renato De Donato
data-sevc-control...
|
513
514
|
this.inputs = [];
this.labels = [];
|
98d9d8a5
Renato De Donato
filters+groupby
|
515
516
517
518
|
this.$.expert_header.style.display = "none";
this.expert = true;
this._showExpertMode();
this.loadPreview = false;
|
e0e4a976
Renato De Donato
data-sevc-control...
|
519
|
this.$.datalet_selection_datalet_placeholder.innerHTML = "";
|
98d9d8a5
Renato De Donato
filters+groupby
|
520
|
this._resetGroupBy();
|
e0e4a976
Renato De Donato
data-sevc-control...
|
521
522
|
},
|
3c812cc9
Renato De Donato
title-desciption ...
|
523
|
_translate : function(){
|
6d2a2a1e
Andrea Petta
language handling
|
524
525
526
527
528
529
530
|
this.$.add_button.innerHTML = ln["addDatalet_" + ln["localization"]];
this.$.inputs.innerHTML = ln["inputs_" + ln["localization"]];
this.$.baseInfo.innerHTML = ln["baseInfo_" + ln["localization"]];
this.$.layouts.innerHTML = ln["layouts_" + ln["localization"]];
this.$.dataletPreview.innerHTML = ln["dataletPreview_" + ln["localization"]];
|
ac237fdd
Renato De Donato
controllet ln
|
531
532
533
|
this.$.base_title.label = ln["title_" + ln["localization"]];
this.$.base_description.label = ln["description_" + ln["localization"]];
|
6d2a2a1e
Andrea Petta
language handling
|
534
535
|
if(this.modify)
this.$.add_button.innerHTML = ln["modifyDatalet_" + ln["localization"]];
|
3c812cc9
Renato De Donato
title-desciption ...
|
536
537
|
},
|
e0e4a976
Renato De Donato
data-sevc-control...
|
538
|
_selectDatalet : function(e){
|
0f6424fe
root
update new data-s...
|
539
540
|
this.$.add_button.setAttribute("disabled", "true");
|
a31f0660
root
sevc-controllet i...
|
541
|
this.selectedDatalet = e.detail.datalet;
|
0f6424fe
root
update new data-s...
|
542
|
|
d2da5141
Renato De Donato
async 0
|
543
544
545
546
547
548
|
this.$.datalet_selection_datalet_placeholder.innerHTML = "";
if(!this.selectedDatalet){
this.type = undefined;
this.inputs = [];
this.labels = [];
|
98d9d8a5
Renato De Donato
filters+groupby
|
549
550
551
|
this.$.expert_header.style.display = "none";
this.expert = true;
this._showExpertMode();
|
d2da5141
Renato De Donato
async 0
|
552
553
554
|
this.loadPreview = false;
}
else{
|
a31f0660
root
sevc-controllet i...
|
555
556
|
this.$.selectedDatalet_request.url = this.deepUrl + e.detail.datalet + "-datalet";
this.$.selectedDatalet_request.generateRequest();
|
98d9d8a5
Renato De Donato
filters+groupby
|
557
|
this.$.expert_header.style.display = "block";
|
a31f0660
root
sevc-controllet i...
|
558
|
}
|
e0e4a976
Renato De Donato
data-sevc-control...
|
559
|
},
|
0f6424fe
root
update new data-s...
|
560
|
|
e0e4a976
Renato De Donato
data-sevc-control...
|
561
|
_preselectDatalet : function() {
|
0b7cbd33
Renato De Donato
title-desciption
|
562
563
564
565
|
this.type = "undefined";
this.$.selectedDatalet_request.url = this.deepUrl + this.preselectedDatalet + "-datalet";
this.$.selectedDatalet_request.generateRequest();
|
e0e4a976
Renato De Donato
data-sevc-control...
|
566
567
568
|
this.selectedDatalet = this.preselectedDatalet;
this.selectedFields = this._copy(this.fields);
|
0b7cbd33
Renato De Donato
title-desciption
|
569
570
|
this.async(function() {
this.selectedFields = this._copy(this.fields);
|
e0e4a976
Renato De Donato
data-sevc-control...
|
571
|
|
0b7cbd33
Renato De Donato
title-desciption
|
572
573
574
|
var inputs = document.getElementsByTagName("paper-dropdown-menu");
for (var i = 0; i < inputs.length; i++)
$(inputs[i]).find("paper-menu")[0].select(i);
|
e8219f9a
Renato De Donato
datalet-mod
|
575
|
|
0b7cbd33
Renato De Donato
title-desciption
|
576
577
578
579
|
//set info labels options
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];
|
e8219f9a
Renato De Donato
datalet-mod
|
580
|
|
0b7cbd33
Renato De Donato
title-desciption
|
581
582
583
|
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 ...
|
584
|
|
55dade56
Renato De Donato
modify a datalet
|
585
586
587
|
this.loadPreview = true;
this._loadDatalet(this.selectedFields);
}, 300);
|
a31f0660
root
sevc-controllet i...
|
588
589
|
},
|
0f6424fe
root
update new data-s...
|
590
|
_handleSelectedDatalet : function(e){
|
0f6424fe
root
update new data-s...
|
591
|
|
d2da5141
Renato De Donato
async 0
|
592
|
if(this.type != e.detail.response.type) {
|
a31f0660
root
sevc-controllet i...
|
593
|
|
d2da5141
Renato De Donato
async 0
|
594
595
596
597
598
599
600
601
602
603
604
|
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)
|
d2da5141
Renato De Donato
async 0
|
605
606
|
inputs.push({name: name + " " + i, description: description, selection: selection});
}
|
a31f0660
root
sevc-controllet i...
|
607
|
|
d2da5141
Renato De Donato
async 0
|
608
609
610
611
|
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...
|
612
|
|
d2da5141
Renato De Donato
async 0
|
613
614
615
|
this.selectedFields = new Array(inputs.length);
},0);
|
98d9d8a5
Renato De Donato
filters+groupby
|
616
617
|
this._resetGroupBy();
|
d2da5141
Renato De Donato
async 0
|
618
619
620
621
622
|
this.loadPreview = false;
}
else if (this.loadPreview)
this._loadDatalet(this.selectedFields);
|
0f6424fe
root
update new data-s...
|
623
624
|
},
|
98d9d8a5
Renato De Donato
filters+groupby
|
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
|
_resetGroupBy : function(){
$(this.$.group_by).find("paper-menu")[0].select(-1);
this.groupedFields = [];
this.aggregators = [];
},
_addGroupByInput : function(){
this.async(function() {//codice reprlicato!
var selectedFields = this.selectedFields;
var load = true;
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;
}
}
if(load){
this.loadPreview = true;
this._loadDatalet(selectedFields);
}
}, 0);
},
_addOrder : function(e){
var t = e.target;
if(t.tagName.indexOf("IRON-ICON") > -1)
t = $(e.target).parents("paper-icon-button")[0];
var icon = t.getAttribute("icon");
var name = t.getAttribute("id");
if(name.indexOf("gb") > -1){
var selectedItem = $(this.$.group_by).find("paper-menu")[0].selectedItem;
if(selectedItem)
name = selectedItem.textContent.trim();
// name = "[" + selectedItem.textContent.trim() + "]";
else
return;
}// else {
// var i = name;
// var ddl = $("#calculate_"+i);
//
// var label = $(ddl).find("paper-menu")[0].selectedItem.textContent.trim();
// var index = label.split(" ", 2).join(" ").length;
// var field = label.substring(index+1, label.length);
// var operation = label.substring(0, label.indexOf(" "));
// name = operation + "([" + field + "])";
// }
if(icon.indexOf("unfold-more") > -1){
t.setAttribute("icon", "expand-less");
t.setAttribute("title", "sort ascending");
var orders = this.orders.filter(function (el) { return el.field !== name; });
orders.push({"field": name, "operation": "ASC"});
this.orders = this._copy(orders);
}
else if(icon.indexOf("expand-less") > -1){
t.setAttribute("icon", "expand-more");
t.setAttribute("title", "sort descending");
var orders = this.orders.filter(function (el) { return el.field !== name; });
orders.push({"field": name, "operation": "DESC"});
this.orders = this._copy(orders);
}
else if(icon.indexOf("expand-more") > -1){
t.setAttribute("icon", "unfold-more");
t.setAttribute("title", "unsort");
var orders = this.orders.filter(function (el) { return el.field !== name; });
this.orders = this._copy(orders);
}
this._addGroupByInput();//no buoono
// if(load){
// this.loadPreview = true;
// this._loadDatalet(selectedFields);
// }
},
|
e0e4a976
Renato De Donato
data-sevc-control...
|
713
|
_addInput : function(e){
|
0f6424fe
root
update new data-s...
|
714
|
var selectedFields = this._copy(this.selectedFields);
|
0f6424fe
root
update new data-s...
|
715
|
|
0b7cbd33
Renato De Donato
title-desciption
|
716
717
718
719
720
721
|
// var index = $(e.target).parents("paper-dropdown-menu")[0].id;
// selectedFields[index] = e.target.innerHTML.trim();
var ddl_index = $(e.target).parents("paper-dropdown-menu")[0].id;
var index = e.target.id;
selectedFields[ddl_index] = this.fields[index];
|
0f6424fe
root
update new data-s...
|
722
|
|
e0e4a976
Renato De Donato
data-sevc-control...
|
723
|
this.selectedFields = this._copy(selectedFields);
|
0f6424fe
root
update new data-s...
|
724
|
|
e0e4a976
Renato De Donato
data-sevc-control...
|
725
|
var load = true;
|
0f6424fe
root
update new data-s...
|
726
|
|
e0e4a976
Renato De Donato
data-sevc-control...
|
727
728
729
730
|
if(this.inputs[0].selection == "*"){
var temp = [];
for (var i = 0; i < selectedFields.length; i++)
if(selectedFields[i])
|
98d9d8a5
Renato De Donato
filters+groupby
|
731
|
temp.push(selectedFields[i]);
|
e0e4a976
Renato De Donato
data-sevc-control...
|
732
733
734
735
736
737
738
739
740
|
selectedFields = temp;
}
else {
for (var i = 0; i < selectedFields.length; i++)
if (!selectedFields[i]) {
load = false;
break;
}
}
|
0f6424fe
root
update new data-s...
|
741
|
|
98d9d8a5
Renato De Donato
filters+groupby
|
742
743
|
this._resetGroupBy();//--> conflitto, in _updateparams valorizza this.aggregators
|
0f6424fe
root
update new data-s...
|
744
|
if(load){
|
98d9d8a5
Renato De Donato
filters+groupby
|
745
|
this.loadPreview = true;
|
e0e4a976
Renato De Donato
data-sevc-control...
|
746
747
|
this._loadDatalet(selectedFields);
}
|
e0e4a976
Renato De Donato
data-sevc-control...
|
748
|
},
|
0f6424fe
root
update new data-s...
|
749
|
|
b4accc86
Renato De Donato
datalet improved
|
750
|
_updateParams : function(){
|
84242065
Andrea Petta
params fix
|
751
752
|
var textarea = this.$.datalet_selection_labels.querySelectorAll("paper-textarea");
this.params["description"] = textarea[0].value;
|
e8219f9a
Renato De Donato
datalet-mod
|
753
|
|
84242065
Andrea Petta
params fix
|
754
755
|
if(!textarea[0].value)
this.params[textarea[0].label] = "";
|
b4accc86
Renato De Donato
datalet improved
|
756
|
|
84242065
Andrea Petta
params fix
|
757
758
|
var inputs = this.$.datalet_selection_labels.querySelectorAll("paper-input");
this.params["title"] = inputs[0].value;
|
0f6424fe
root
update new data-s...
|
759
|
|
84242065
Andrea Petta
params fix
|
760
761
|
for (var i = 1; i < inputs.length; i++)
this.params[this.labels[i-1].name] = inputs[i].value;
|
98d9d8a5
Renato De Donato
filters+groupby
|
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
|
this.aggregators = [];
var ddls = document.getElementsByTagName("paper-dropdown-menu");
for (var i = 0; i < ddls.length; i++){
var id = ddls[i].id;
if(id.indexOf("group_by") > -1 && $(ddls[i]).find("paper-menu")[0].selectedItem) {
var label = $(ddls[i]).find("paper-menu")[0].selectedItem.textContent.trim();
this.aggregators.push({"field": label, "operation": "GROUP BY"});
}
if(id.indexOf("calculate") > -1) {
var label = $(ddls[i]).find("paper-menu")[0].selectedItem.textContent.trim();
// var field = label.substring(label.lastIndexOf(" ")+1, label.length);
var index = label.split(" ", 2).join(" ").length;
var field = label.substring(index+1, label.length);
var operation = label.substring(0, label.indexOf(" "));
this.aggregators.push({"field": field, "operation": operation});
}
}
|
b4accc86
Renato De Donato
datalet improved
|
781
782
783
784
785
|
},
_paramsChanged : function(){
this._updateParams();
|
e8219f9a
Renato De Donato
datalet-mod
|
786
|
|
4b79b3c8
Renato De Donato
datalet-selection...
|
787
788
|
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
|
789
790
791
792
|
},
_loadDatalet : function(selectedFields){
|
b4accc86
Renato De Donato
datalet improved
|
793
|
this._updateParams();
|
e8219f9a
Renato De Donato
datalet-mod
|
794
|
|
98d9d8a5
Renato De Donato
filters+groupby
|
795
796
797
798
799
800
801
802
803
804
805
|
this.params["filters"] = JSON.stringify(this.filters);
this.params["aggregators"] = JSON.stringify(this.aggregators);
this.params["orders"] = JSON.stringify(this.orders);
// this.params["filters"] = '[{"field": "Lat", "operation": ">=", "value": "53.298164"}, {"field": "Lat", "operation": "<", "value": "54"}]';
// this.params["aggregators"] = '[{"field": "Lat", "operation": "GROUP BY"}, {"field": "Lng", "operation": "COUNT"}]';
// this.params["orders"] = '[{"field": "Lat", "operation": "DESC"}, {"field": "Lat", "operation": "ASC"}]';
//this.params["aggregators"] = '[{"field": "Value", "operation": "GROUP BY"}, {"field": "LOCATION", "operation": "COUNT"}]';
//this.params["orders"] = '[{"field": "Value", "operation": "ASC"}, {"field": "Value", "operation": "ASC"}]';
|
e0e4a976
Renato De Donato
data-sevc-control...
|
806
807
|
var dataletParams ={
component : this.selectedDatalet+"-datalet",
|
57ef9bf4
Renato De Donato
labels + info
|
808
|
params : this.params,
|
e0e4a976
Renato De Donato
data-sevc-control...
|
809
810
811
|
fields : selectedFields,
placeHolder : this.$.datalet_selection_datalet_placeholder
};
|
0f6424fe
root
update new data-s...
|
812
|
|
e0e4a976
Renato De Donato
data-sevc-control...
|
813
814
|
ComponentService.deep_url = this.deepUrl;
ComponentService.getComponent(dataletParams);
|
a31f0660
root
sevc-controllet i...
|
815
|
|
8afca675
Renato De Donato
title-description
|
816
|
this.$.add_button.removeAttribute("disabled");
|
0f6424fe
root
update new data-s...
|
817
818
|
},
|
e0e4a976
Renato De Donato
data-sevc-control...
|
819
|
_addDatalet : function(){
|
0f6424fe
root
update new data-s...
|
820
|
|
346a4475
Andrea Petta
private room bug fix
|
821
822
|
this._updateParams();
|
9579b866
Renato De Donato
firefox bug fix
|
823
824
825
826
827
|
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...
|
828
829
|
var data = {
dataUrl : this.dataUrl,
|
57ef9bf4
Renato De Donato
labels + info
|
830
|
params : this.params,
|
9579b866
Renato De Donato
firefox bug fix
|
831
|
fields : selectedFields,
|
0f6424fe
root
update new data-s...
|
832
|
datalet : this.selectedDatalet+"-datalet",
|
3c812cc9
Renato De Donato
title-desciption ...
|
833
|
// comment : "",//DEPRECATED!!!
|
0f6424fe
root
update new data-s...
|
834
835
836
|
staticData : JSON.stringify(this.$.datalet_selection_datalet_placeholder.children[1].behavior.data)
}
|
0f6424fe
root
update new data-s...
|
837
|
this.fire('data-sevc-controllet.dataletCreated', {data : data});
|
a31f0660
root
sevc-controllet i...
|
838
839
840
|
},
|
57ef9bf4
Renato De Donato
labels + info
|
841
|
_showInfo : function(e){
|
98d9d8a5
Renato De Donato
filters+groupby
|
842
|
// var that = this;
|
57ef9bf4
Renato De Donato
labels + info
|
843
844
845
846
|
var t = e.target;
if(t.tagName.indexOf("IRON-ICON") != -1)
t = $(e.target).parents("paper-icon-button")[0];
|
ac237fdd
Renato De Donato
controllet ln
|
847
848
|
// var name = t.getAttribute("title").replace(" info", "");
var name = t.getAttribute("id");
|
57ef9bf4
Renato De Donato
labels + info
|
849
850
851
852
853
|
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];
|
98d9d8a5
Renato De Donato
filters+groupby
|
854
|
this.$.dialog_name.innerHTML = this._getLabelName(dataset.name);
|
6d2a2a1e
Andrea Petta
language handling
|
855
|
this.$.dialog_description.innerHTML = ln[dataset.description + "_" + ln["localization"]];
|
79ec939f
Renato De Donato
info position + a...
|
856
|
this.$.dialog_info_input.open();
|
57ef9bf4
Renato De Donato
labels + info
|
857
858
|
var pos = t.getBoundingClientRect();
|
79ec939f
Renato De Donato
info position + a...
|
859
860
|
$("#dialog_info_input").css("top", pos.top - 4);
$("#dialog_info_input").css("left", pos.left - 4);
|
57ef9bf4
Renato De Donato
labels + info
|
861
862
|
},
|
59100bec
Renato De Donato
localization + ba...
|
863
|
_fieldName : function(field) {
|
98d9d8a5
Renato De Donato
filters+groupby
|
864
865
866
|
if(!field)//when?
return "";
return field.substring(field.lastIndexOf(",")+1, field.length);
|
59100bec
Renato De Donato
localization + ba...
|
867
868
|
},
|
e0e4a976
Renato De Donato
data-sevc-control...
|
869
870
871
872
873
874
875
876
877
878
|
_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;
},
|
ac237fdd
Renato De Donato
controllet ln
|
879
|
_getLabelName: function(key) {
|
98d9d8a5
Renato De Donato
filters+groupby
|
880
881
882
883
884
885
886
887
|
//* exceptions
if(key.indexOf("Cell") > -1) {
return ln["Cell" + "_" +ln["localization"]] + key.slice(-2);
}
if(key.indexOf("Level") > -1) {
return ln["Level" + "_" +ln["localization"]] + key.slice(-2);
}
|
ac237fdd
Renato De Donato
controllet ln
|
888
889
890
|
return ln[key + "_" +ln["localization"]];
},
|
a31f0660
root
sevc-controllet i...
|
891
892
893
894
895
896
897
898
|
_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...
|
899
|
// if(this.modify)
|
3c812cc9
Renato De Donato
title-desciption ...
|
900
|
// $("#datalet_selection_datalet").height(h-128);
|
ed1bed76
Renato De Donato
fix bug-modify in...
|
901
|
// else
|
98d9d8a5
Renato De Donato
filters+groupby
|
902
|
$("#datalet_selection_datalet").height(h);
|
a31f0660
root
sevc-controllet i...
|
903
904
905
906
907
908
909
|
}
});
</script>
</dom-module>
|