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 -->
|
93ba7167
Renato De Donato
filters bug fix + ln
|
222
|
<div id="expert_header" on-click="_showExpertMode"><span id="groupBy"></span></div>
|
98d9d8a5
Renato De Donato
filters+groupby
|
223
224
225
226
|
<div id="expert_container">
<div class="inputs">
|
40eb0979
Renato De Donato
group by and filt...
|
227
|
<paper-dropdown-menu id="group_by">
|
98d9d8a5
Renato De Donato
filters+groupby
|
228
|
<paper-menu class="dropdown-content">
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
229
|
<template is="dom-repeat" items={{fields}}>
|
98d9d8a5
Renato De Donato
filters+groupby
|
230
231
232
233
234
|
<paper-item id={{index}} on-tap="_showGroupedFields">{{_fieldName(item)}}</paper-item>
</template>
</paper-menu>
</paper-dropdown-menu>
<div class="info_button">
|
e31934c0
Renato De Donato
group by bug fix
|
235
|
<paper-icon-button id="gb" on-click="_addOrder" icon="unfold-more" title=""></paper-icon-button>
|
98d9d8a5
Renato De Donato
filters+groupby
|
236
237
238
239
240
|
</div>
</div>
<template is="dom-repeat" items="{{groupedFields}}">
<div class="inputs">
|
40eb0979
Renato De Donato
group by and filt...
|
241
|
<paper-dropdown-menu id="calculate_{{index}}" label="{{_calculateLabel()}}">
|
98d9d8a5
Renato De Donato
filters+groupby
|
242
|
<paper-menu class="dropdown-content">
|
40eb0979
Renato De Donato
group by and filt...
|
243
244
245
246
247
248
249
250
|
<!--foreach functions-->
<paper-item id="0" on-tap="_addGroupByInput">{{_operationName(0)}} {{_fieldName(item)}}</paper-item>
<paper-item id="1" on-tap="_addGroupByInput">{{_operationName(1)}} {{_fieldName(item)}}</paper-item>
<paper-item id="2" on-tap="_addGroupByInput">{{_operationName(2)}} {{_fieldName(item)}}</paper-item>
<paper-item id="3" on-tap="_addGroupByInput">{{_operationName(3)}} {{_fieldName(item)}}</paper-item>
<paper-item id="4" on-tap="_addGroupByInput">{{_operationName(4)}} {{_fieldName(item)}}</paper-item>
<paper-item id="5" on-tap="_addGroupByInput">{{_operationName(5)}} {{_fieldName(item)}}</paper-item>
<paper-item id="6" on-tap="_addGroupByInput">{{_operationName(6)}} {{_fieldName(item)}}</paper-item>
|
98d9d8a5
Renato De Donato
filters+groupby
|
251
252
253
|
</paper-menu>
</paper-dropdown-menu>
<div class="info_button">
|
e31934c0
Renato De Donato
group by bug fix
|
254
|
<paper-icon-button id={{_fieldName(item)}} on-click="_addOrder" icon="unfold-more" title=""></paper-icon-button>
|
98d9d8a5
Renato De Donato
filters+groupby
|
255
256
257
258
259
260
261
262
|
</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...
|
263
264
265
|
</paper-material>
<paper-material id="datalet_selection_labels" elevation="5">
|
6d2a2a1e
Andrea Petta
language handling
|
266
|
<div class="input_header"><span id="baseInfo"></span></div>
|
3c812cc9
Renato De Donato
title-desciption ...
|
267
268
|
<div class="inputs">
|
ac237fdd
Renato De Donato
controllet ln
|
269
|
<paper-input id="base_title" maxlength="32" class="base_input"></paper-input>
|
3c812cc9
Renato De Donato
title-desciption ...
|
270
271
272
|
</div>
<div class="inputs">
|
ac237fdd
Renato De Donato
controllet ln
|
273
|
<paper-textarea id="base_description" maxlength="100" class="base_input"></paper-textarea>
|
3c812cc9
Renato De Donato
title-desciption ...
|
274
275
|
</div>
|
6d2a2a1e
Andrea Petta
language handling
|
276
|
<div class="input_header"><span id="layouts"></span></div>
|
3c812cc9
Renato De Donato
title-desciption ...
|
277
|
|
a31f0660
root
sevc-controllet i...
|
278
279
|
<template is="dom-repeat" items="{{labels}}" index-as="index">
<div class="inputs">
|
ac237fdd
Renato De Donato
controllet ln
|
280
|
<paper-input label={{_getLabelName(item.name)}}></paper-input>
|
e0e4a976
Renato De Donato
data-sevc-control...
|
281
|
<div class="info_button">
|
ac237fdd
Renato De Donato
controllet ln
|
282
|
<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...
|
283
|
</div>
|
a31f0660
root
sevc-controllet i...
|
284
285
286
287
288
289
|
</div>
</template>
</paper-material>
<div id="datalet_selection_column">
|
e0e4a976
Renato De Donato
data-sevc-control...
|
290
|
|
a31f0660
root
sevc-controllet i...
|
291
|
<paper-material id="datalet_selection_datalet" elevation="5">
|
6d2a2a1e
Andrea Petta
language handling
|
292
|
<div class="input_header"><span id="dataletPreview"></span></div>
|
a31f0660
root
sevc-controllet i...
|
293
294
295
296
|
<div id="datalet_selection_datalet_placeholder"></div>
</paper-material>
|
6d2a2a1e
Andrea Petta
language handling
|
297
|
<paper-button id="add_button" disabled raised on-click="_addDatalet"></paper-button>
|
a31f0660
root
sevc-controllet i...
|
298
299
300
|
</div>
|
79ec939f
Renato De Donato
info position + a...
|
301
|
<paper-dialog id="dialog_info_input">
|
57ef9bf4
Renato De Donato
labels + info
|
302
303
304
305
|
<h2 id="dialog_name"></h2>
<p id="dialog_description"></p>
</paper-dialog>
|
a31f0660
root
sevc-controllet i...
|
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
332
|
</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...
|
333
334
335
336
337
|
preselectedDatalet : {
type : String,
value : undefined
},
|
d2da5141
Renato De Donato
async 0
|
338
339
340
341
342
343
344
345
346
347
|
loadPreview : {
type : Boolean,
value : false
},
type : {
type : String,
value : undefined
},
|
a31f0660
root
sevc-controllet i...
|
348
349
350
351
352
353
354
355
356
357
|
inputs : {
type : Array,
value : []
},
labels : {
type : Array,
value : []
},
|
98d9d8a5
Renato De Donato
filters+groupby
|
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
|
filters : {
type : Array,
value : []
},
aggregators : {
type : Array,
value : []
},
orders : {
type : Array,
value : []
},
|
a31f0660
root
sevc-controllet i...
|
373
374
|
fields : {
type : Array,
|
0f6424fe
root
update new data-s...
|
375
376
377
378
379
380
381
382
|
value : []
},
selectedFields : {
type : Array,
value : []
},
|
98d9d8a5
Renato De Donato
filters+groupby
|
383
384
385
386
387
|
groupedFields : {
type : Array,
value : []
},
|
e8219f9a
Renato De Donato
datalet-mod
|
388
389
390
391
392
|
dataletPreset : {
type : Object,
value : []
},
|
e0e4a976
Renato De Donato
data-sevc-control...
|
393
394
395
396
|
// selectableFields : {
// type : Array,
// value : []
// },
|
a31f0660
root
sevc-controllet i...
|
397
398
399
|
dataUrl : {
type : String,
|
0f6424fe
root
update new data-s...
|
400
|
value : undefined
|
e0e4a976
Renato De Donato
data-sevc-control...
|
401
402
|
},
|
57ef9bf4
Renato De Donato
labels + info
|
403
404
405
406
407
|
params:{
type: Object,
value: undefined
},
|
98d9d8a5
Renato De Donato
filters+groupby
|
408
409
410
411
412
|
expert : {
type : Boolean,
value : false
},
|
40eb0979
Renato De Donato
group by and filt...
|
413
414
415
416
417
|
functions : {
type : Array,
value : ["COUNT", "SUM", "MIN", "MAX", "AVG", "FIRST", "LAST"]
},
|
e0e4a976
Renato De Donato
data-sevc-control...
|
418
419
420
|
modify : {
type : Boolean,
value : false
|
a31f0660
root
sevc-controllet i...
|
421
422
423
424
425
|
}
},
listeners: {
|
4b79b3c8
Renato De Donato
datalet-selection...
|
426
|
'items-vslider-controllet_selected-datalet': '_selectDatalet',
|
0f6424fe
root
update new data-s...
|
427
|
// 'tree-view-controllet_selected-fields': '_updateSelectedFields'
|
b4accc86
Renato De Donato
datalet improved
|
428
|
'change': '_paramsChanged'
|
a31f0660
root
sevc-controllet i...
|
429
430
|
},
|
98d9d8a5
Renato De Donato
filters+groupby
|
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
|
_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;
|
98d9d8a5
Renato De Donato
filters+groupby
|
448
449
|
var temp = [];
|
e31934c0
Renato De Donato
group by bug fix
|
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
|
// var isSelected = false;
// 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 =[];
|
98d9d8a5
Renato De Donato
filters+groupby
|
467
468
|
for (var i = 0; i < this.selectedFields.length; i++) {
if (this.selectedFields[i]) {
|
e31934c0
Renato De Donato
group by bug fix
|
469
470
|
if (i != index) {
temp.push(this.selectedFields[i]);
|
98d9d8a5
Renato De Donato
filters+groupby
|
471
472
473
474
|
}
}
}
|
e31934c0
Renato De Donato
group by bug fix
|
475
|
this.groupedFields = this._copy(temp);
|
98d9d8a5
Renato De Donato
filters+groupby
|
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
|
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...
|
492
493
494
495
|
this._resize();
$(this.$.datalet_selection_inputs).perfectScrollbar();
$(this.$.datalet_selection_labels).perfectScrollbar();
$(this.$.datalet_selection_datalet).perfectScrollbar();
|
0f6424fe
root
update new data-s...
|
496
|
|
ed1bed76
Renato De Donato
fix bug-modify in...
|
497
498
499
|
this.params = {'data-url' : this.dataUrl};
//this.modify = true;//da eliminare in futuro
|
e0e4a976
Renato De Donato
data-sevc-control...
|
500
|
if(this.preselectedDatalet){
|
0b7cbd33
Renato De Donato
title-desciption
|
501
502
503
|
if(this.modify)
this._preselectDatalet();
|
e0e4a976
Renato De Donato
data-sevc-control...
|
504
|
this.modify = true;
|
e0e4a976
Renato De Donato
data-sevc-control...
|
505
506
|
this.preselectedDatalet = undefined;
}
|
a31f0660
root
sevc-controllet i...
|
507
508
509
510
511
512
|
},
attached : function() {
this._resize();
var that = this;
window.addEventListener("resize", function() { that._resize(); });
|
e0e4a976
Renato De Donato
data-sevc-control...
|
513
|
|
97e0b0f8
Renato De Donato
google chart & lo...
|
514
|
this._translate();
|
97e0b0f8
Renato De Donato
google chart & lo...
|
515
516
|
},
|
98d9d8a5
Renato De Donato
filters+groupby
|
517
518
519
520
|
setFilters : function(filters) {
this.filters = filters;
},
|
0f6424fe
root
update new data-s...
|
521
522
523
524
|
setFields : function(fields) {
this.fields = fields;
},
|
e0e4a976
Renato De Donato
data-sevc-control...
|
525
|
reset : function() {
|
98d9d8a5
Renato De Donato
filters+groupby
|
526
527
528
|
this.selectedDatalet = undefined;//non va!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
this.preselectedDatalet = undefined;
this.type = undefined;
|
e0e4a976
Renato De Donato
data-sevc-control...
|
529
530
|
this.inputs = [];
this.labels = [];
|
98d9d8a5
Renato De Donato
filters+groupby
|
531
532
533
534
|
this.$.expert_header.style.display = "none";
this.expert = true;
this._showExpertMode();
this.loadPreview = false;
|
e0e4a976
Renato De Donato
data-sevc-control...
|
535
|
this.$.datalet_selection_datalet_placeholder.innerHTML = "";
|
98d9d8a5
Renato De Donato
filters+groupby
|
536
|
this._resetGroupBy();
|
e0e4a976
Renato De Donato
data-sevc-control...
|
537
538
|
},
|
3c812cc9
Renato De Donato
title-desciption ...
|
539
|
_translate : function(){
|
6d2a2a1e
Andrea Petta
language handling
|
540
541
542
543
544
545
546
|
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
|
547
548
549
|
this.$.base_title.label = ln["title_" + ln["localization"]];
this.$.base_description.label = ln["description_" + ln["localization"]];
|
93ba7167
Renato De Donato
filters bug fix + ln
|
550
|
this.$.groupBy.innerHTML = ln["groupBy_" + ln["localization"]];
|
40eb0979
Renato De Donato
group by and filt...
|
551
|
this.$.group_by.setAttribute("label", ln["groupBy_" + ln["localization"]]);
|
93ba7167
Renato De Donato
filters bug fix + ln
|
552
|
|
6d2a2a1e
Andrea Petta
language handling
|
553
554
|
if(this.modify)
this.$.add_button.innerHTML = ln["modifyDatalet_" + ln["localization"]];
|
3c812cc9
Renato De Donato
title-desciption ...
|
555
556
|
},
|
e0e4a976
Renato De Donato
data-sevc-control...
|
557
|
_selectDatalet : function(e){
|
0f6424fe
root
update new data-s...
|
558
559
|
this.$.add_button.setAttribute("disabled", "true");
|
a31f0660
root
sevc-controllet i...
|
560
|
this.selectedDatalet = e.detail.datalet;
|
0f6424fe
root
update new data-s...
|
561
|
|
d2da5141
Renato De Donato
async 0
|
562
563
564
565
566
567
|
this.$.datalet_selection_datalet_placeholder.innerHTML = "";
if(!this.selectedDatalet){
this.type = undefined;
this.inputs = [];
this.labels = [];
|
98d9d8a5
Renato De Donato
filters+groupby
|
568
569
570
|
this.$.expert_header.style.display = "none";
this.expert = true;
this._showExpertMode();
|
d2da5141
Renato De Donato
async 0
|
571
572
573
|
this.loadPreview = false;
}
else{
|
a31f0660
root
sevc-controllet i...
|
574
575
|
this.$.selectedDatalet_request.url = this.deepUrl + e.detail.datalet + "-datalet";
this.$.selectedDatalet_request.generateRequest();
|
98d9d8a5
Renato De Donato
filters+groupby
|
576
|
this.$.expert_header.style.display = "block";
|
a31f0660
root
sevc-controllet i...
|
577
|
}
|
e0e4a976
Renato De Donato
data-sevc-control...
|
578
|
},
|
0f6424fe
root
update new data-s...
|
579
|
|
e0e4a976
Renato De Donato
data-sevc-control...
|
580
|
_preselectDatalet : function() {
|
0b7cbd33
Renato De Donato
title-desciption
|
581
582
583
584
|
this.type = "undefined";
this.$.selectedDatalet_request.url = this.deepUrl + this.preselectedDatalet + "-datalet";
this.$.selectedDatalet_request.generateRequest();
|
e0e4a976
Renato De Donato
data-sevc-control...
|
585
586
587
|
this.selectedDatalet = this.preselectedDatalet;
this.selectedFields = this._copy(this.fields);
|
e31934c0
Renato De Donato
group by bug fix
|
588
|
// this.filters = JSON.parse(this.dataletPreset["filters"]);
|
efb059b1
Renato De Donato
preload filter in...
|
589
590
591
|
// this.aggregators = JSON.parse(this.dataletPreset["aggregators"]);
// this.orders = JSON.parse(this.dataletPreset["orders"]);
|
0b7cbd33
Renato De Donato
title-desciption
|
592
593
|
this.async(function() {
this.selectedFields = this._copy(this.fields);
|
e0e4a976
Renato De Donato
data-sevc-control...
|
594
|
|
0b7cbd33
Renato De Donato
title-desciption
|
595
|
//set info labels options
|
efb059b1
Renato De Donato
preload filter in...
|
596
597
598
599
600
601
602
603
|
var textarea = this.$.datalet_selection_labels.querySelectorAll("paper-textarea");
textarea[0].value = this.dataletPreset["description"];
var inputs = this.$.datalet_selection_labels.querySelectorAll("paper-input");
inputs[0].value = this.dataletPreset["title"];
for (var i = 1; i < inputs.length; i++)
inputs[i].value = this.dataletPreset[this.labels[i-1].name];
|
e8219f9a
Renato De Donato
datalet-mod
|
604
|
|
efb059b1
Renato De Donato
preload filter in...
|
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
|
//set inputs --> prima apri GB e riempi CALCULATE e poi gli ORDERBY???
var ddls = document.getElementsByTagName("paper-dropdown-menu");
for (var i = 0; i < ddls.length; i++) {
var id = ddls[i].id;
if (!isNaN(id)) {
// id = parseInt(id);
$(ddls[i]).find("paper-menu")[0].select(id);
}
else if (id.indexOf("group_by") > -1) {
;
}
else if (id.indexOf("calculate") > -1) {
;
}
}
|
3c812cc9
Renato De Donato
title-desciption ...
|
620
|
|
55dade56
Renato De Donato
modify a datalet
|
621
622
623
|
this.loadPreview = true;
this._loadDatalet(this.selectedFields);
}, 300);
|
a31f0660
root
sevc-controllet i...
|
624
625
|
},
|
0f6424fe
root
update new data-s...
|
626
|
_handleSelectedDatalet : function(e){
|
0f6424fe
root
update new data-s...
|
627
|
|
d2da5141
Renato De Donato
async 0
|
628
|
if(this.type != e.detail.response.type) {
|
a31f0660
root
sevc-controllet i...
|
629
|
|
d2da5141
Renato De Donato
async 0
|
630
631
632
633
634
635
636
637
638
639
640
|
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
|
641
642
|
inputs.push({name: name + " " + i, description: description, selection: selection});
}
|
a31f0660
root
sevc-controllet i...
|
643
|
|
d2da5141
Renato De Donato
async 0
|
644
645
646
647
|
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...
|
648
|
|
d2da5141
Renato De Donato
async 0
|
649
650
651
|
this.selectedFields = new Array(inputs.length);
},0);
|
98d9d8a5
Renato De Donato
filters+groupby
|
652
653
|
this._resetGroupBy();
|
d2da5141
Renato De Donato
async 0
|
654
655
656
657
658
|
this.loadPreview = false;
}
else if (this.loadPreview)
this._loadDatalet(this.selectedFields);
|
0f6424fe
root
update new data-s...
|
659
660
|
},
|
98d9d8a5
Renato De Donato
filters+groupby
|
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
713
714
715
716
717
718
719
720
721
722
|
_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");
|
e31934c0
Renato De Donato
group by bug fix
|
723
|
t.setAttribute("title", ln["sortAscending_" + ln["localization"]]);
|
98d9d8a5
Renato De Donato
filters+groupby
|
724
725
726
727
728
729
|
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");
|
e31934c0
Renato De Donato
group by bug fix
|
730
|
t.setAttribute("title", ln["sortDescending_" + ln["localization"]]);
|
98d9d8a5
Renato De Donato
filters+groupby
|
731
732
733
734
735
736
|
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");
|
e31934c0
Renato De Donato
group by bug fix
|
737
|
t.setAttribute("title", ln["unsort_" + ln["localization"]]);
|
98d9d8a5
Renato De Donato
filters+groupby
|
738
739
740
741
742
743
744
745
746
747
748
|
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...
|
749
|
_addInput : function(e){
|
0f6424fe
root
update new data-s...
|
750
|
var selectedFields = this._copy(this.selectedFields);
|
0f6424fe
root
update new data-s...
|
751
|
|
0b7cbd33
Renato De Donato
title-desciption
|
752
753
754
755
756
757
|
// 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...
|
758
|
|
e0e4a976
Renato De Donato
data-sevc-control...
|
759
|
this.selectedFields = this._copy(selectedFields);
|
0f6424fe
root
update new data-s...
|
760
|
|
e0e4a976
Renato De Donato
data-sevc-control...
|
761
|
var load = true;
|
0f6424fe
root
update new data-s...
|
762
|
|
e0e4a976
Renato De Donato
data-sevc-control...
|
763
764
765
766
|
if(this.inputs[0].selection == "*"){
var temp = [];
for (var i = 0; i < selectedFields.length; i++)
if(selectedFields[i])
|
98d9d8a5
Renato De Donato
filters+groupby
|
767
|
temp.push(selectedFields[i]);
|
e0e4a976
Renato De Donato
data-sevc-control...
|
768
769
770
771
772
773
774
775
776
|
selectedFields = temp;
}
else {
for (var i = 0; i < selectedFields.length; i++)
if (!selectedFields[i]) {
load = false;
break;
}
}
|
0f6424fe
root
update new data-s...
|
777
|
|
98d9d8a5
Renato De Donato
filters+groupby
|
778
779
|
this._resetGroupBy();//--> conflitto, in _updateparams valorizza this.aggregators
|
0f6424fe
root
update new data-s...
|
780
|
if(load){
|
98d9d8a5
Renato De Donato
filters+groupby
|
781
|
this.loadPreview = true;
|
e0e4a976
Renato De Donato
data-sevc-control...
|
782
783
|
this._loadDatalet(selectedFields);
}
|
e0e4a976
Renato De Donato
data-sevc-control...
|
784
|
},
|
0f6424fe
root
update new data-s...
|
785
|
|
e31934c0
Renato De Donato
group by bug fix
|
786
|
_updateParams : function(){
|
84242065
Andrea Petta
params fix
|
787
788
|
var textarea = this.$.datalet_selection_labels.querySelectorAll("paper-textarea");
this.params["description"] = textarea[0].value;
|
e8219f9a
Renato De Donato
datalet-mod
|
789
|
|
84242065
Andrea Petta
params fix
|
790
791
|
if(!textarea[0].value)
this.params[textarea[0].label] = "";
|
b4accc86
Renato De Donato
datalet improved
|
792
|
|
84242065
Andrea Petta
params fix
|
793
794
|
var inputs = this.$.datalet_selection_labels.querySelectorAll("paper-input");
this.params["title"] = inputs[0].value;
|
0f6424fe
root
update new data-s...
|
795
|
|
84242065
Andrea Petta
params fix
|
796
797
|
for (var i = 1; i < inputs.length; i++)
this.params[this.labels[i-1].name] = inputs[i].value;
|
98d9d8a5
Renato De Donato
filters+groupby
|
798
799
800
801
802
803
804
805
806
807
808
|
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) {
|
40eb0979
Renato De Donato
group by and filt...
|
809
810
811
812
813
814
815
816
|
var menu = $(ddls[i]).find("paper-menu")[0];
var label = menu.selectedItem.textContent.trim();
var index = menu.selectedItem.id;
var ii = label.split(" ", 2).join(" ").length;
//attenzione BUG --> non funziona se la traduzione non ha solo 1 spazio
var field = label.substring(ii+1, label.length);
// var operation = label.substring(0, label.indexOf(" "));
this.aggregators.push({"field": field, "operation": this.functions[index]});
|
98d9d8a5
Renato De Donato
filters+groupby
|
817
818
|
}
}
|
b4accc86
Renato De Donato
datalet improved
|
819
820
821
822
823
|
},
_paramsChanged : function(){
this._updateParams();
|
e8219f9a
Renato De Donato
datalet-mod
|
824
|
|
4b79b3c8
Renato De Donato
datalet-selection...
|
825
826
|
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
|
827
828
829
830
|
},
_loadDatalet : function(selectedFields){
|
b4accc86
Renato De Donato
datalet improved
|
831
|
this._updateParams();
|
e8219f9a
Renato De Donato
datalet-mod
|
832
|
|
98d9d8a5
Renato De Donato
filters+groupby
|
833
834
835
836
837
838
839
840
841
842
843
|
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...
|
844
845
|
var dataletParams ={
component : this.selectedDatalet+"-datalet",
|
57ef9bf4
Renato De Donato
labels + info
|
846
|
params : this.params,
|
e0e4a976
Renato De Donato
data-sevc-control...
|
847
848
849
|
fields : selectedFields,
placeHolder : this.$.datalet_selection_datalet_placeholder
};
|
0f6424fe
root
update new data-s...
|
850
|
|
e0e4a976
Renato De Donato
data-sevc-control...
|
851
852
|
ComponentService.deep_url = this.deepUrl;
ComponentService.getComponent(dataletParams);
|
a31f0660
root
sevc-controllet i...
|
853
|
|
8afca675
Renato De Donato
title-description
|
854
|
this.$.add_button.removeAttribute("disabled");
|
0f6424fe
root
update new data-s...
|
855
856
|
},
|
e0e4a976
Renato De Donato
data-sevc-control...
|
857
|
_addDatalet : function(){
|
0f6424fe
root
update new data-s...
|
858
|
|
346a4475
Andrea Petta
private room bug fix
|
859
860
|
this._updateParams();
|
9579b866
Renato De Donato
firefox bug fix
|
861
862
863
864
865
|
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...
|
866
867
|
var data = {
dataUrl : this.dataUrl,
|
57ef9bf4
Renato De Donato
labels + info
|
868
|
params : this.params,
|
9579b866
Renato De Donato
firefox bug fix
|
869
|
fields : selectedFields,
|
0f6424fe
root
update new data-s...
|
870
|
datalet : this.selectedDatalet+"-datalet",
|
3c812cc9
Renato De Donato
title-desciption ...
|
871
|
// comment : "",//DEPRECATED!!!
|
0f6424fe
root
update new data-s...
|
872
873
874
|
staticData : JSON.stringify(this.$.datalet_selection_datalet_placeholder.children[1].behavior.data)
}
|
0f6424fe
root
update new data-s...
|
875
|
this.fire('data-sevc-controllet.dataletCreated', {data : data});
|
a31f0660
root
sevc-controllet i...
|
876
877
878
|
},
|
57ef9bf4
Renato De Donato
labels + info
|
879
|
_showInfo : function(e){
|
98d9d8a5
Renato De Donato
filters+groupby
|
880
|
// var that = this;
|
57ef9bf4
Renato De Donato
labels + info
|
881
882
883
884
|
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
|
885
886
|
// var name = t.getAttribute("title").replace(" info", "");
var name = t.getAttribute("id");
|
57ef9bf4
Renato De Donato
labels + info
|
887
888
889
890
891
|
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
|
892
|
this.$.dialog_name.innerHTML = this._getLabelName(dataset.name);
|
6d2a2a1e
Andrea Petta
language handling
|
893
|
this.$.dialog_description.innerHTML = ln[dataset.description + "_" + ln["localization"]];
|
79ec939f
Renato De Donato
info position + a...
|
894
|
this.$.dialog_info_input.open();
|
57ef9bf4
Renato De Donato
labels + info
|
895
896
|
var pos = t.getBoundingClientRect();
|
79ec939f
Renato De Donato
info position + a...
|
897
898
|
$("#dialog_info_input").css("top", pos.top - 4);
$("#dialog_info_input").css("left", pos.left - 4);
|
57ef9bf4
Renato De Donato
labels + info
|
899
900
|
},
|
59100bec
Renato De Donato
localization + ba...
|
901
|
_fieldName : function(field) {
|
98d9d8a5
Renato De Donato
filters+groupby
|
902
903
904
|
if(!field)//when?
return "";
return field.substring(field.lastIndexOf(",")+1, field.length);
|
59100bec
Renato De Donato
localization + ba...
|
905
906
|
},
|
e0e4a976
Renato De Donato
data-sevc-control...
|
907
908
909
910
911
912
913
914
915
916
|
_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
|
917
|
_getLabelName: function(key) {
|
98d9d8a5
Renato De Donato
filters+groupby
|
918
919
920
921
922
923
924
925
|
//* 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
|
926
927
928
|
return ln[key + "_" +ln["localization"]];
},
|
40eb0979
Renato De Donato
group by and filt...
|
929
930
931
932
933
934
935
936
937
|
_calculateLabel: function() {
return ln["calculate" + "_" +ln["localization"]];
},
_operationName: function(index) {
var key = this.functions[index];
return ln[key + "_" +ln["localization"]];
},
|
a31f0660
root
sevc-controllet i...
|
938
939
940
941
942
943
944
945
|
_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);
|
98d9d8a5
Renato De Donato
filters+groupby
|
946
|
$("#datalet_selection_datalet").height(h);
|
a31f0660
root
sevc-controllet i...
|
947
948
949
950
951
952
953
|
}
});
</script>
</dom-module>
|