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
52
|
/*width: 344px;*/
min-width: 258px;
|
a31f0660
root
sevc-controllet i...
|
53
54
55
56
57
58
|
}
#datalet_selection_labels {
position: relative;
height: 100vh;
margin-left: 32px;
|
e0e4a976
Renato De Donato
data-sevc-control...
|
59
60
|
/*width: 344px;*/
min-width: 258px;
|
a31f0660
root
sevc-controllet i...
|
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
}
#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...
|
80
|
/*height: 112px;*/
|
a31f0660
root
sevc-controllet i...
|
81
82
83
84
85
86
87
88
89
90
91
92
93
|
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...
|
94
95
96
97
|
/*.input_name{*/
/*height: 16px;*/
/*padding: 16px;*/
/*/!*background-color: #B6B6B6;*!/*/
|
a31f0660
root
sevc-controllet i...
|
98
|
|
e0e4a976
Renato De Donato
data-sevc-control...
|
99
100
101
102
|
/*background-color: #2196F3;*/
/*color: #FFFFFF;*/
/*font-weight: 700;*/
/*}*/
|
a31f0660
root
sevc-controllet i...
|
103
104
|
.input_header{
|
e0e4a976
Renato De Donato
data-sevc-control...
|
105
106
107
|
height: 32px;
padding-top: 16px;
/*padding: 16px;*/
|
a31f0660
root
sevc-controllet i...
|
108
109
110
111
112
113
|
background-color: #B6B6B6;
text-align: center;
font-weight: 700;
}
.info_button {
|
e0e4a976
Renato De Donato
data-sevc-control...
|
114
|
/*background-color: red;*/
|
a31f0660
root
sevc-controllet i...
|
115
|
position: absolute;
|
e0e4a976
Renato De Donato
data-sevc-control...
|
116
|
top: 18px;
|
a31f0660
root
sevc-controllet i...
|
117
118
119
|
right: 0px;
}
|
3c812cc9
Renato De Donato
title-desciption ...
|
120
|
paper-input {
|
e0e4a976
Renato De Donato
data-sevc-control...
|
121
|
display: inline-block;
|
a31f0660
root
sevc-controllet i...
|
122
|
height: 48px;
|
e0e4a976
Renato De Donato
data-sevc-control...
|
123
124
125
126
|
/*padding: 0px 8px;*/
width: 210px;
padding-left: 8px;
padding-bottom: 8px;
|
a31f0660
root
sevc-controllet i...
|
127
128
129
|
--paper-input-container-focus-color: #2196F3;
}
|
3c812cc9
Renato De Donato
title-desciption ...
|
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
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...
|
144
145
146
147
|
padding-bottom: 0px;
width: calc(100% - 16px);
}
|
a31f0660
root
sevc-controllet i...
|
148
|
paper-dropdown-menu {
|
e0e4a976
Renato De Donato
data-sevc-control...
|
149
|
/*display: inline-block;*/
|
a31f0660
root
sevc-controllet i...
|
150
|
height: 48px;
|
e0e4a976
Renato De Donato
data-sevc-control...
|
151
152
153
154
|
width: 210px;;
/*padding: 0px 8px;*/
padding-left: 8px;
padding-bottom: 8px;
|
a31f0660
root
sevc-controllet i...
|
155
156
157
158
159
160
161
162
163
|
--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...
|
164
165
166
|
/*display: inline-block;*/
color: #2196F3;
/*color: #FFFFFF;*/
|
a31f0660
root
sevc-controllet i...
|
167
|
--paper-icon-button-ink-color: #2196F3;
|
e0e4a976
Renato De Donato
data-sevc-control...
|
168
|
margin: 0px;
|
a31f0660
root
sevc-controllet i...
|
169
170
171
172
173
174
175
176
177
|
/*padding: 0px;*/
}
paper-button {
/*display: block;*/
position: absolute;
bottom: 16px;
right: 11px;
|
a31f0660
root
sevc-controllet i...
|
178
179
180
181
182
183
184
185
186
187
|
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 ...
|
188
189
190
191
|
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...
|
192
|
}
|
0f6424fe
root
update new data-s...
|
193
194
195
196
|
paper-button[disabled] {
background-color: #B6B6B6;
}
|
57ef9bf4
Renato De Donato
labels + info
|
197
|
|
79ec939f
Renato De Donato
info position + a...
|
198
|
#dialog_info_input {
|
57ef9bf4
Renato De Donato
labels + info
|
199
200
|
border: 2px solid #2196F3;
background-color: #E0E0E0;
|
3c812cc9
Renato De Donato
title-desciption ...
|
201
|
min-width: 248px;
|
57ef9bf4
Renato De Donato
labels + info
|
202
|
}
|
a31f0660
root
sevc-controllet i...
|
203
204
|
</style>
|
0f6424fe
root
update new data-s...
|
205
|
<iron-ajax id="selectedDatalet_request" on-response="_handleSelectedDatalet"></iron-ajax>
|
a31f0660
root
sevc-controllet i...
|
206
207
|
<div id="datalet_selection_container">
|
3d8cde48
Renato De Donato
safari bug fix
|
208
209
210
211
|
<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...
|
212
|
|
a31f0660
root
sevc-controllet i...
|
213
|
<paper-material id="datalet_selection_inputs" elevation="5">
|
6d2a2a1e
Andrea Petta
language handling
|
214
|
<div class="input_header"><span id="inputs"></span></div>
|
e0e4a976
Renato De Donato
data-sevc-control...
|
215
|
<template is="dom-repeat" items="{{inputs}}" index-as="ddl_index">
|
a31f0660
root
sevc-controllet i...
|
216
|
<div class="inputs">
|
ac237fdd
Renato De Donato
controllet ln
|
217
|
<paper-dropdown-menu id={{ddl_index}} label={{_getLabelName(item.name)}}>
|
a31f0660
root
sevc-controllet i...
|
218
|
<paper-menu class="dropdown-content">
|
e0e4a976
Renato De Donato
data-sevc-control...
|
219
|
<template is="dom-repeat" items={{fields}}>
|
0b7cbd33
Renato De Donato
title-desciption
|
220
|
<paper-item id={{index}} on-tap="_addInput">{{_fieldName(item)}}</paper-item>
|
59100bec
Renato De Donato
localization + ba...
|
221
|
<!--{{_fieldName(item)}}-->
|
a31f0660
root
sevc-controllet i...
|
222
223
224
|
</template>
</paper-menu>
</paper-dropdown-menu>
|
e0e4a976
Renato De Donato
data-sevc-control...
|
225
|
<div class="info_button">
|
ac237fdd
Renato De Donato
controllet ln
|
226
|
<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...
|
227
|
</div>
|
a31f0660
root
sevc-controllet i...
|
228
229
230
231
232
|
</div>
</template>
</paper-material>
<paper-material id="datalet_selection_labels" elevation="5">
|
6d2a2a1e
Andrea Petta
language handling
|
233
|
<div class="input_header"><span id="baseInfo"></span></div>
|
3c812cc9
Renato De Donato
title-desciption ...
|
234
235
|
<div class="inputs">
|
ac237fdd
Renato De Donato
controllet ln
|
236
|
<paper-input id="base_title" maxlength="32" class="base_input"></paper-input>
|
3c812cc9
Renato De Donato
title-desciption ...
|
237
238
239
|
</div>
<div class="inputs">
|
ac237fdd
Renato De Donato
controllet ln
|
240
|
<paper-textarea id="base_description" maxlength="100" class="base_input"></paper-textarea>
|
3c812cc9
Renato De Donato
title-desciption ...
|
241
242
|
</div>
|
6d2a2a1e
Andrea Petta
language handling
|
243
|
<div class="input_header"><span id="layouts"></span></div>
|
3c812cc9
Renato De Donato
title-desciption ...
|
244
|
|
a31f0660
root
sevc-controllet i...
|
245
246
|
<template is="dom-repeat" items="{{labels}}" index-as="index">
<div class="inputs">
|
ac237fdd
Renato De Donato
controllet ln
|
247
|
<paper-input label={{_getLabelName(item.name)}}></paper-input>
|
e0e4a976
Renato De Donato
data-sevc-control...
|
248
|
<div class="info_button">
|
ac237fdd
Renato De Donato
controllet ln
|
249
|
<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...
|
250
|
</div>
|
a31f0660
root
sevc-controllet i...
|
251
252
253
254
255
256
|
</div>
</template>
</paper-material>
<div id="datalet_selection_column">
|
e0e4a976
Renato De Donato
data-sevc-control...
|
257
|
|
83faae2e
Renato De Donato
comment-modify
|
258
|
<!--<template is="dom-if" if={{modify}}>-->
|
3c812cc9
Renato De Donato
title-desciption ...
|
259
260
261
262
|
<!--<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
|
263
|
<!--</template>-->
|
a31f0660
root
sevc-controllet i...
|
264
265
|
<paper-material id="datalet_selection_datalet" elevation="5">
|
6d2a2a1e
Andrea Petta
language handling
|
266
|
<div class="input_header"><span id="dataletPreview"></span></div>
|
a31f0660
root
sevc-controllet i...
|
267
268
269
270
|
<div id="datalet_selection_datalet_placeholder"></div>
</paper-material>
|
6d2a2a1e
Andrea Petta
language handling
|
271
|
<paper-button id="add_button" disabled raised on-click="_addDatalet"></paper-button>
|
a31f0660
root
sevc-controllet i...
|
272
273
274
|
</div>
|
79ec939f
Renato De Donato
info position + a...
|
275
|
<paper-dialog id="dialog_info_input">
|
57ef9bf4
Renato De Donato
labels + info
|
276
277
278
279
|
<h2 id="dialog_name"></h2>
<p id="dialog_description"></p>
</paper-dialog>
|
a31f0660
root
sevc-controllet i...
|
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
|
</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...
|
307
308
309
310
311
|
preselectedDatalet : {
type : String,
value : undefined
},
|
d2da5141
Renato De Donato
async 0
|
312
313
314
315
316
317
318
319
320
321
|
loadPreview : {
type : Boolean,
value : false
},
type : {
type : String,
value : undefined
},
|
a31f0660
root
sevc-controllet i...
|
322
323
324
325
326
327
328
329
330
331
332
333
|
inputs : {
type : Array,
value : []
},
labels : {
type : Array,
value : []
},
fields : {
type : Array,
|
0f6424fe
root
update new data-s...
|
334
335
336
337
338
339
340
341
|
value : []
},
selectedFields : {
type : Array,
value : []
},
|
e8219f9a
Renato De Donato
datalet-mod
|
342
343
344
345
346
|
dataletPreset : {
type : Object,
value : []
},
|
e0e4a976
Renato De Donato
data-sevc-control...
|
347
348
349
350
|
// selectableFields : {
// type : Array,
// value : []
// },
|
a31f0660
root
sevc-controllet i...
|
351
352
353
|
dataUrl : {
type : String,
|
0f6424fe
root
update new data-s...
|
354
|
value : undefined
|
e0e4a976
Renato De Donato
data-sevc-control...
|
355
356
|
},
|
57ef9bf4
Renato De Donato
labels + info
|
357
358
359
360
361
|
params:{
type: Object,
value: undefined
},
|
e0e4a976
Renato De Donato
data-sevc-control...
|
362
363
364
|
modify : {
type : Boolean,
value : false
|
a31f0660
root
sevc-controllet i...
|
365
366
367
368
369
|
}
},
listeners: {
|
4b79b3c8
Renato De Donato
datalet-selection...
|
370
|
'items-vslider-controllet_selected-datalet': '_selectDatalet',
|
0f6424fe
root
update new data-s...
|
371
|
// 'tree-view-controllet_selected-fields': '_updateSelectedFields'
|
b4accc86
Renato De Donato
datalet improved
|
372
|
'change': '_paramsChanged'
|
a31f0660
root
sevc-controllet i...
|
373
374
|
},
|
e8219f9a
Renato De Donato
datalet-mod
|
375
|
ready : function() {//console.log(this.dataletPreset);
|
a31f0660
root
sevc-controllet i...
|
376
377
378
379
|
this._resize();
$(this.$.datalet_selection_inputs).perfectScrollbar();
$(this.$.datalet_selection_labels).perfectScrollbar();
$(this.$.datalet_selection_datalet).perfectScrollbar();
|
0f6424fe
root
update new data-s...
|
380
|
|
ed1bed76
Renato De Donato
fix bug-modify in...
|
381
382
383
|
this.params = {'data-url' : this.dataUrl};
//this.modify = true;//da eliminare in futuro
|
e0e4a976
Renato De Donato
data-sevc-control...
|
384
|
if(this.preselectedDatalet){
|
0b7cbd33
Renato De Donato
title-desciption
|
385
386
387
|
if(this.modify)
this._preselectDatalet();
|
e0e4a976
Renato De Donato
data-sevc-control...
|
388
|
this.modify = true;
|
e0e4a976
Renato De Donato
data-sevc-control...
|
389
390
|
this.preselectedDatalet = undefined;
}
|
a31f0660
root
sevc-controllet i...
|
391
392
393
394
395
396
|
},
attached : function() {
this._resize();
var that = this;
window.addEventListener("resize", function() { that._resize(); });
|
e0e4a976
Renato De Donato
data-sevc-control...
|
397
|
|
97e0b0f8
Renato De Donato
google chart & lo...
|
398
|
this._translate();
|
97e0b0f8
Renato De Donato
google chart & lo...
|
399
400
|
},
|
0f6424fe
root
update new data-s...
|
401
402
403
404
|
setFields : function(fields) {
this.fields = fields;
},
|
e0e4a976
Renato De Donato
data-sevc-control...
|
405
406
407
408
409
410
411
|
reset : function() {
this.selectedDatalet = undefined;
this.inputs = [];
this.labels = [];
this.$.datalet_selection_datalet_placeholder.innerHTML = "";
},
|
3c812cc9
Renato De Donato
title-desciption ...
|
412
|
_translate : function(){
|
6d2a2a1e
Andrea Petta
language handling
|
413
414
415
416
417
418
419
|
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
|
420
421
422
|
this.$.base_title.label = ln["title_" + ln["localization"]];
this.$.base_description.label = ln["description_" + ln["localization"]];
|
6d2a2a1e
Andrea Petta
language handling
|
423
424
|
if(this.modify)
this.$.add_button.innerHTML = ln["modifyDatalet_" + ln["localization"]];
|
3c812cc9
Renato De Donato
title-desciption ...
|
425
426
|
},
|
e0e4a976
Renato De Donato
data-sevc-control...
|
427
|
_selectDatalet : function(e){
|
0f6424fe
root
update new data-s...
|
428
429
|
this.$.add_button.setAttribute("disabled", "true");
|
a31f0660
root
sevc-controllet i...
|
430
|
this.selectedDatalet = e.detail.datalet;
|
0f6424fe
root
update new data-s...
|
431
|
|
d2da5141
Renato De Donato
async 0
|
432
433
434
435
436
437
438
439
440
|
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...
|
441
442
443
|
this.$.selectedDatalet_request.url = this.deepUrl + e.detail.datalet + "-datalet";
this.$.selectedDatalet_request.generateRequest();
}
|
e0e4a976
Renato De Donato
data-sevc-control...
|
444
|
},
|
0f6424fe
root
update new data-s...
|
445
|
|
e0e4a976
Renato De Donato
data-sevc-control...
|
446
|
_preselectDatalet : function() {
|
0b7cbd33
Renato De Donato
title-desciption
|
447
448
449
450
|
this.type = "undefined";
this.$.selectedDatalet_request.url = this.deepUrl + this.preselectedDatalet + "-datalet";
this.$.selectedDatalet_request.generateRequest();
|
e0e4a976
Renato De Donato
data-sevc-control...
|
451
452
453
|
this.selectedDatalet = this.preselectedDatalet;
this.selectedFields = this._copy(this.fields);
|
0b7cbd33
Renato De Donato
title-desciption
|
454
455
|
this.async(function() {
this.selectedFields = this._copy(this.fields);
|
e0e4a976
Renato De Donato
data-sevc-control...
|
456
|
|
0b7cbd33
Renato De Donato
title-desciption
|
457
458
459
|
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
|
460
|
|
0b7cbd33
Renato De Donato
title-desciption
|
461
462
463
464
|
//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
|
465
|
|
0b7cbd33
Renato De Donato
title-desciption
|
466
467
468
|
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 ...
|
469
|
|
55dade56
Renato De Donato
modify a datalet
|
470
471
472
|
this.loadPreview = true;
this._loadDatalet(this.selectedFields);
}, 300);
|
a31f0660
root
sevc-controllet i...
|
473
474
|
},
|
0f6424fe
root
update new data-s...
|
475
|
_handleSelectedDatalet : function(e){
|
0f6424fe
root
update new data-s...
|
476
|
|
d2da5141
Renato De Donato
async 0
|
477
|
if(this.type != e.detail.response.type) {
|
a31f0660
root
sevc-controllet i...
|
478
|
|
d2da5141
Renato De Donato
async 0
|
479
480
481
482
483
484
485
486
487
488
489
|
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)
|
0b7cbd33
Renato De Donato
title-desciption
|
490
|
// for (var i = 0; i < Math.max(this.fields.length, 8); i++)//error
|
d2da5141
Renato De Donato
async 0
|
491
492
|
inputs.push({name: name + " " + i, description: description, selection: selection});
}
|
a31f0660
root
sevc-controllet i...
|
493
|
|
d2da5141
Renato De Donato
async 0
|
494
495
496
497
|
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...
|
498
|
|
d2da5141
Renato De Donato
async 0
|
499
500
501
502
503
504
505
506
|
this.selectedFields = new Array(inputs.length);
},0);
this.loadPreview = false;
}
else if (this.loadPreview)
this._loadDatalet(this.selectedFields);
|
0f6424fe
root
update new data-s...
|
507
508
|
},
|
e0e4a976
Renato De Donato
data-sevc-control...
|
509
|
_addInput : function(e){
|
0f6424fe
root
update new data-s...
|
510
|
var selectedFields = this._copy(this.selectedFields);
|
0f6424fe
root
update new data-s...
|
511
|
|
0b7cbd33
Renato De Donato
title-desciption
|
512
513
514
515
516
517
|
// 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...
|
518
|
|
e0e4a976
Renato De Donato
data-sevc-control...
|
519
|
this.selectedFields = this._copy(selectedFields);
|
0f6424fe
root
update new data-s...
|
520
|
|
e0e4a976
Renato De Donato
data-sevc-control...
|
521
|
var load = true;
|
0f6424fe
root
update new data-s...
|
522
|
|
e0e4a976
Renato De Donato
data-sevc-control...
|
523
524
525
526
527
528
529
530
531
532
533
534
535
536
|
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...
|
537
538
|
if(load){
|
d2da5141
Renato De Donato
async 0
|
539
|
this.loadPreview = true
|
e0e4a976
Renato De Donato
data-sevc-control...
|
540
541
|
this._loadDatalet(selectedFields);
}
|
0f6424fe
root
update new data-s...
|
542
|
|
e0e4a976
Renato De Donato
data-sevc-control...
|
543
|
},
|
0f6424fe
root
update new data-s...
|
544
|
|
b4accc86
Renato De Donato
datalet improved
|
545
|
_updateParams : function(){
|
84242065
Andrea Petta
params fix
|
546
547
|
var textarea = this.$.datalet_selection_labels.querySelectorAll("paper-textarea");
this.params["description"] = textarea[0].value;
|
e8219f9a
Renato De Donato
datalet-mod
|
548
|
|
84242065
Andrea Petta
params fix
|
549
550
|
if(!textarea[0].value)
this.params[textarea[0].label] = "";
|
b4accc86
Renato De Donato
datalet improved
|
551
|
|
84242065
Andrea Petta
params fix
|
552
553
|
var inputs = this.$.datalet_selection_labels.querySelectorAll("paper-input");
this.params["title"] = inputs[0].value;
|
0f6424fe
root
update new data-s...
|
554
|
|
84242065
Andrea Petta
params fix
|
555
556
|
for (var i = 1; i < inputs.length; i++)
this.params[this.labels[i-1].name] = inputs[i].value;
|
b4accc86
Renato De Donato
datalet improved
|
557
558
559
560
561
|
},
_paramsChanged : function(){
this._updateParams();
|
e8219f9a
Renato De Donato
datalet-mod
|
562
|
|
4b79b3c8
Renato De Donato
datalet-selection...
|
563
564
|
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
|
565
566
567
568
|
},
_loadDatalet : function(selectedFields){
|
b4accc86
Renato De Donato
datalet improved
|
569
|
this._updateParams();
|
e8219f9a
Renato De Donato
datalet-mod
|
570
|
|
e0e4a976
Renato De Donato
data-sevc-control...
|
571
572
|
var dataletParams ={
component : this.selectedDatalet+"-datalet",
|
57ef9bf4
Renato De Donato
labels + info
|
573
|
params : this.params,
|
e0e4a976
Renato De Donato
data-sevc-control...
|
574
575
576
|
fields : selectedFields,
placeHolder : this.$.datalet_selection_datalet_placeholder
};
|
0f6424fe
root
update new data-s...
|
577
|
|
e0e4a976
Renato De Donato
data-sevc-control...
|
578
579
|
ComponentService.deep_url = this.deepUrl;
ComponentService.getComponent(dataletParams);
|
a31f0660
root
sevc-controllet i...
|
580
|
|
8afca675
Renato De Donato
title-description
|
581
|
// console.log(this.params);
|
1c44cfb8
Renato De Donato
datalet selection...
|
582
|
|
0b7cbd33
Renato De Donato
title-desciption
|
583
|
|
8afca675
Renato De Donato
title-description
|
584
585
586
587
588
|
// this.async(function(){
// if(this.$.datalet_selection_datalet_placeholder.children[1])
// this.$.datalet_selection_datalet_placeholder.children[1].behavior.setParameters(this.params);
// this.$.add_button.removeAttribute("disabled");
// }, 300);
|
1c44cfb8
Renato De Donato
datalet selection...
|
589
590
|
// this.async(function(){this.$.add_button.removeAttribute("disabled");}, 300);
|
8afca675
Renato De Donato
title-description
|
591
|
this.$.add_button.removeAttribute("disabled");
|
0f6424fe
root
update new data-s...
|
592
593
|
},
|
e0e4a976
Renato De Donato
data-sevc-control...
|
594
|
_addDatalet : function(){
|
0f6424fe
root
update new data-s...
|
595
|
|
346a4475
Andrea Petta
private room bug fix
|
596
597
|
this._updateParams();
|
9579b866
Renato De Donato
firefox bug fix
|
598
599
600
601
602
|
var selectedFields = [];
for (var i = 0; i < this.selectedFields.length; i++)
if(this.selectedFields[i])
selectedFields.push(this.selectedFields[i]);
|
0b7cbd33
Renato De Donato
title-desciption
|
603
|
// console.log(this.params);
|
3c812cc9
Renato De Donato
title-desciption ...
|
604
|
|
0f6424fe
root
update new data-s...
|
605
606
|
var data = {
dataUrl : this.dataUrl,
|
57ef9bf4
Renato De Donato
labels + info
|
607
|
params : this.params,
|
9579b866
Renato De Donato
firefox bug fix
|
608
|
fields : selectedFields,
|
0f6424fe
root
update new data-s...
|
609
|
datalet : this.selectedDatalet+"-datalet",
|
3c812cc9
Renato De Donato
title-desciption ...
|
610
|
// comment : "",//DEPRECATED!!!
|
0f6424fe
root
update new data-s...
|
611
612
613
|
staticData : JSON.stringify(this.$.datalet_selection_datalet_placeholder.children[1].behavior.data)
}
|
0f6424fe
root
update new data-s...
|
614
|
this.fire('data-sevc-controllet.dataletCreated', {data : data});
|
a31f0660
root
sevc-controllet i...
|
615
616
617
|
},
|
57ef9bf4
Renato De Donato
labels + info
|
618
|
_showInfo : function(e){
|
90890e86
Andrea Petta
l20n bug fix
|
619
|
var that = this;
|
57ef9bf4
Renato De Donato
labels + info
|
620
621
622
623
|
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
|
624
625
|
// var name = t.getAttribute("title").replace(" info", "");
var name = t.getAttribute("id");
|
57ef9bf4
Renato De Donato
labels + info
|
626
627
628
629
630
|
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];
|
ac237fdd
Renato De Donato
controllet ln
|
631
|
this.$.dialog_name.innerHTML = ln[dataset.name + "_" + ln["localization"]];
|
6d2a2a1e
Andrea Petta
language handling
|
632
|
this.$.dialog_description.innerHTML = ln[dataset.description + "_" + ln["localization"]];
|
79ec939f
Renato De Donato
info position + a...
|
633
|
this.$.dialog_info_input.open();
|
57ef9bf4
Renato De Donato
labels + info
|
634
635
|
var pos = t.getBoundingClientRect();
|
79ec939f
Renato De Donato
info position + a...
|
636
637
|
$("#dialog_info_input").css("top", pos.top - 4);
$("#dialog_info_input").css("left", pos.left - 4);
|
57ef9bf4
Renato De Donato
labels + info
|
638
639
|
},
|
59100bec
Renato De Donato
localization + ba...
|
640
641
642
643
|
_fieldName : function(field) {
return field.substring(field.lastIndexOf(",")+1, field.length);;
},
|
e0e4a976
Renato De Donato
data-sevc-control...
|
644
645
646
647
648
649
650
651
652
653
|
_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
|
654
655
656
657
|
_getLabelName: function(key) {
return ln[key + "_" +ln["localization"]];
},
|
a31f0660
root
sevc-controllet i...
|
658
659
660
661
662
663
664
665
|
_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...
|
666
|
// if(this.modify)
|
3c812cc9
Renato De Donato
title-desciption ...
|
667
|
// $("#datalet_selection_datalet").height(h-128);
|
ed1bed76
Renato De Donato
fix bug-modify in...
|
668
|
// else
|
3c812cc9
Renato De Donato
title-desciption ...
|
669
|
$("#datalet_selection_datalet").height(h);
|
a31f0660
root
sevc-controllet i...
|
670
671
672
673
674
675
676
|
}
});
</script>
</dom-module>
|