Blame view

controllets/data-sevc-controllet/data-sevc-controllet.html 43.2 KB
938d1928   Luigi Serra   Update documentat...
1
2
  <!--

  @license

584d6ecd   Luigi Serra   Update components...
3
      The MIT License (MIT)

73bcce88   luigser   COMPONENTS
4
  

584d6ecd   Luigi Serra   Update components...
5
      Copyright (c) 2015 Dipartimento di Informatica - Università di Salerno - Italy

73bcce88   luigser   COMPONENTS
6
  

938d1928   Luigi Serra   Update documentat...
7
8
9
10
11
12
      Permission is hereby granted, free of charge, to any person obtaining a copy

      of this software and associated documentation files (the "Software"), to deal

      in the Software without restriction, including without limitation the rights

      to use, copy, modify, merge, publish, distribute, sublicense, and/or sell

      copies of the Software, and to permit persons to whom the Software is

      furnished to do so, subject to the following conditions:

e619a3b0   Luigi Serra   Controllet cross ...
13
  

938d1928   Luigi Serra   Update documentat...
14
15
      The above copyright notice and this permission notice shall be included in

      all copies or substantial portions of the Software.

73bcce88   luigser   COMPONENTS
16
  

938d1928   Luigi Serra   Update documentat...
17
18
19
20
21
22
23
24
      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR

      IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,

      FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE

      AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER

      LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,

      OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN

      THE SOFTWARE.

  -->

73bcce88   luigser   COMPONENTS
25
  

ae17a8dc   Luigi Serra   Controllet and da...
26
  <!--

950d181d   Luigi Serra   license updates
27
28
  * Developed by :

  * ROUTE-TO-PA Project - grant No 645860. - www.routetopa.eu

ae17a8dc   Luigi Serra   Controllet and da...
29
30
31
  *

  -->

  

938d1928   Luigi Serra   Update documentat...
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
  <link rel="import" href="../../bower_components/polymer/polymer.html">

  <link rel="import" href="../../bower_components/paper-styles/color.html">

  

  <link rel="import" href="../../bower_components/neon-animation/neon-animated-pages.html">

  <link rel="import" href="../../bower_components/neon-animation/neon-animatable.html">

  <link rel="import" href="../../bower_components/neon-animation/neon-animations.html">

  

  <link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html">

  <link rel="import" href="../../bower_components/paper-input/paper-input.html">

  <link rel="import" href="../../bower_components/paper-input/paper-textarea.html">

  <link rel="import" href="../../bower_components/paper-button/paper-button.html">

  <link rel="import" href="../../bower_components/paper-tabs/paper-tabs.html">

  <link rel="import" href="../../bower_components/paper-tabs/paper-tab.html">

  <link rel="import" href="../../bower_components/iron-pages/iron-pages.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-toast/paper-toast.html">

c011cd54   Luigi Serra   selection control...
50
51
  <link rel="import" href="../../bower_components/paper-dialog/paper-dialog.html">

  <link rel="import" href="../../bower_components/paper-dialog-scrollable/paper-dialog-scrollable.html">

938d1928   Luigi Serra   Update documentat...
52
53
54
  

  <link rel="import" href="../items-slider-controllet/items-slider-controllet.html">

  <link rel="import" href="../draggable-element-controllet/draggable-element-controllet.html">

9d4a34db   Luigi Serra   selection control...
55
  <link rel="import" href="../tree-view-controllet/tree-view-controllet.html">

035bbee3   Luigi Serra   Datalets and cont...
56
  <link rel="import" href="../text-element-controllet/text-element-controllet.html">

938d1928   Luigi Serra   Update documentat...
57
58
  

  <!--

c6d8e1a1   Luigi Serra   fix
59
60
61
62
63
  The `data-sevc-controllet` is a controllet to generate visualization from a dataset accessible through api. A json response is required.

  It's composed by three steps. First, user have to select a datasource to access to a dataset. He can copy and paste/drag and drop an url(an api url with json response) or select

  from select contextual menu an available one. Second, the user selects the fields he want to visualize from a treeview by checking on it. A table preview of selected fields will show

  the currently selected values. Third, the users selects a visualization(datalet) from a slider and drags the previous selected fields in to the input data model fields area. A preview

  is available every time a fields is dragged in the input data model fields area.

938d1928   Luigi Serra   Update documentat...
64
65
66
  

  Example:

  

6f8e74f7   Luigi Serra   card update
67
68
      <data-sevc-controllet deep-url="http://192.168.36.128/DatalEts-Ecosystem-Provider/DEEP/"

                            datalets-list-url="http://192.168.36.128/DatalEts-Ecosystem-Provider/DEEP/datalets-list"

c6d8e1a1   Luigi Serra   fix
69
                            datasets='{[{name : 'dataset1', url : dataset1Urls}, ... , {name : 'datasetN', url : datasetNUrls}]'>

938d1928   Luigi Serra   Update documentat...
70
71
72
73
74
      </data-sevc-controllet>

  

  

  @element data-sevc-controllet

  @status beta

c6d8e1a1   Luigi Serra   fix
75
  @homepage

938d1928   Luigi Serra   Update documentat...
76
77
78
79
80
81
82
  @group controllets

  -->

  

  

  <dom-module id="data-sevc-controllet">

          <template>

              <link rel="stylesheet" href="../shared_js/perfect-scrollbar/css/perfect-scrollbar.min.css">

74249687   Luigi Serra   Cross browser con...
83
  

325c348a   Luigi Serra   Cross browser bug...
84
              <style is="custom-style">

73bcce88   luigser   COMPONENTS
85
  

938d1928   Luigi Serra   Update documentat...
86
87
88
                  ::content body {

                      font-family: 'Roboto', sans-serif;

                  }

dbc787cf   Luigi Serra   Controllet cross ...
89
  

938d1928   Luigi Serra   Update documentat...
90
91
92
93
                  .flexchild

                  {

                  @apply(--layout-flex);

                  }

73bcce88   luigser   COMPONENTS
94
  

938d1928   Luigi Serra   Update documentat...
95
96
97
98
                  .flex2child

                  {

                  @apply(--layout-flex-2);

                  }

73bcce88   luigser   COMPONENTS
99
  

938d1928   Luigi Serra   Update documentat...
100
101
102
103
104
105
106
107
108
109
110
111
                  .avatar

                  {

                      display: inline-block;

                      height: 2em;

                      width: 2em;

                      border-radius: 50%;

                      background: var(--paper-blue-500);

                      color: white;

                      line-height: 2em;

                      font-size: 1.87em;

                      text-align: center;

                  }

73bcce88   luigser   COMPONENTS
112
  

938d1928   Luigi Serra   Update documentat...
113
114
115
116
117
118
                  .title

                  {

                      position: relative;

                      top: 0.60vh;

                      margin-left: 20px;

                  }

73bcce88   luigser   COMPONENTS
119
  

938d1928   Luigi Serra   Update documentat...
120
121
122
123
124
                  .big

                  {

                      font-size: 1.37em;

                      color: var(--google-grey-500);

                  }

73bcce88   luigser   COMPONENTS
125
  

938d1928   Luigi Serra   Update documentat...
126
127
128
129
130
131
132
                  .medium

                  {

                      font-size: 1em;

                      padding-bottom: 0.5em;

                      color : #000000;

                      font-weight: bold;

                  }

73bcce88   luigser   COMPONENTS
133
  

938d1928   Luigi Serra   Update documentat...
134
135
136
137
138
139
140
                  .small

                  {

                      font-size: 0.8em;

                      padding-top: 10px;

                      color: var(--paper-blue-500);

                      font-weight: bold;

                  }

74249687   Luigi Serra   Cross browser con...
141
  

938d1928   Luigi Serra   Update documentat...
142
143
144
145
                  paper-input

                  {

                      width: 80%;

                  }

73bcce88   luigser   COMPONENTS
146
  

938d1928   Luigi Serra   Update documentat...
147
148
149
150
151
152
                  paper-dropdown-menu

                  {

                      text-align: left;

                      margin: auto;

                      width: 100%;

                  }

cb1aab91   Luigi Serra   Controllets update
153
  

938d1928   Luigi Serra   Update documentat...
154
155
156
157
158
                  ::content paper-menu-button

                  {

                      display: block;

                      width: 100%;

                  }

cb1aab91   Luigi Serra   Controllets update
159
  

938d1928   Luigi Serra   Update documentat...
160
161
162
163
164
                  #visualization_slider_area

                  {

                      min-width: 670px;

                      min-height: 180px;

                  }

73bcce88   luigser   COMPONENTS
165
  

938d1928   Luigi Serra   Update documentat...
166
167
168
169
170
                  #fields_mapping_area

                  {

                      min-width: 670px;

                      min-height: 180px;

                  }

73bcce88   luigser   COMPONENTS
171
  

938d1928   Luigi Serra   Update documentat...
172
173
174
175
                  #datalet_placeholder

                  {

                      height: 360px;

                      min-height: 360px;

73bcce88   luigser   COMPONENTS
176
  

938d1928   Luigi Serra   Update documentat...
177
                  }

73bcce88   luigser   COMPONENTS
178
  

938d1928   Luigi Serra   Update documentat...
179
180
181
182
                  .datalet_right_container

                  {

                      width: 100vh;

                  }

73bcce88   luigser   COMPONENTS
183
  

938d1928   Luigi Serra   Update documentat...
184
185
186
187
188
                  .field-mapping-card

                  {

                      width: 50%;

                      float: left;

                  }

73bcce88   luigser   COMPONENTS
189
  

938d1928   Luigi Serra   Update documentat...
190
191
192
193
194
                  .toolbar_button

                  {

                      --iron-icon-height: 32px;

                      --iron-icon-width: 32px;

                  }

73bcce88   luigser   COMPONENTS
195
  

938d1928   Luigi Serra   Update documentat...
196
197
198
199
200
201
                  #finish_button

                  {

                      --iron-icon-height: 32px;

                      --iron-icon-width: 32px;

                      color: var(--paper-blue-500);

                  }

73bcce88   luigser   COMPONENTS
202
  

938d1928   Luigi Serra   Update documentat...
203
204
205
206
207
208
209
210
211
                  .area_container

                  {

                      overflow: hidden;

                      margin : 0.8em;

                      padding : 0.8em;

                      border-width: 1em;

                      border-radius: 0.125rem;

                      box-shadow: 0.125em 0.125em 0.1125em 0.125em rgba(0, 0, 0, 0.25);

                  }

73bcce88   luigser   COMPONENTS
212
  

938d1928   Luigi Serra   Update documentat...
213
214
215
216
217
218
219
                  #fields_placeholder{

                      width: 40%;

                      height: 75vh;

                      position: relative;

                      float: left;

                      overflow: auto;

                  }

73bcce88   luigser   COMPONENTS
220
  

938d1928   Luigi Serra   Update documentat...
221
222
223
224
225
226
227
                  #table_fields_container{

                      height: 75vh;

                      width: 55%;

                      position: relative;

                      float: left;

                      overflow: auto;

                  }

73bcce88   luigser   COMPONENTS
228
  

938d1928   Luigi Serra   Update documentat...
229
230
231
232
233
234
                  paper-tabs, paper-toolbar

                  {

                      background-color:  var(--paper-blue-500);

                      color: #ffffff;

                      box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.2);

                  }

cb1aab91   Luigi Serra   Controllets update
235
  

938d1928   Luigi Serra   Update documentat...
236
237
238
239
240
                  paper-toolbar paper-tabs

                  {

                      box-shadow: none;

                      --paper-tabs-selection-bar-color : var(--google-gray-500);

                  }

cb1aab91   Luigi Serra   Controllets update
241
  

938d1928   Luigi Serra   Update documentat...
242
243
244
245
                  paper-tabs[noink][no-bar] paper-tab.iron-selected

                  {

                      background-color: var(--google-gray-500);

                  }

cb1aab91   Luigi Serra   Controllets update
246
  

938d1928   Luigi Serra   Update documentat...
247
248
249
250
                  paper-tabs[align-bottom]

                  {

                      box-shadow: 0px -2px 6px rgba(0, 0, 0, 0.15);

                  }

cb1aab91   Luigi Serra   Controllets update
251
  

938d1928   Luigi Serra   Update documentat...
252
253
254
255
                  #idm_fields_main_container{

                      position: relative;

                      height: 50vh;

                  }

74249687   Luigi Serra   Cross browser con...
256
  

24be6abb   Luigi Serra   selection control...
257
                  #selectedFields_main_container{

938d1928   Luigi Serra   Update documentat...
258
259
260
                      position: relative;

                      height: 50vh;

                  }

74249687   Luigi Serra   Cross browser con...
261
  

035bbee3   Luigi Serra   Datalets and cont...
262
263
                  #idm_layout_main_container{

                      position: relative;

486a1c48   Luigi Serra   selection control...
264
265
266
267
268
269
                      height: 50vh;

                  }

  

                  #comment{

                      position: relative;

                      width: 35vw;

035bbee3   Luigi Serra   Datalets and cont...
270
271
                  }

  

938d1928   Luigi Serra   Update documentat...
272
273
274
                  paper-menu{

                      width: 100%;

                  }

74249687   Luigi Serra   Cross browser con...
275
  

c011cd54   Luigi Serra   selection control...
276
277
278
279
280
281
282
283
284
                  paper-dialog {

                      position: fixed;

                      top: 16px;

                      width: auto;

                      height: auto;

                      overflow: auto;

                      padding : 30px;

                  }

  

938d1928   Luigi Serra   Update documentat...
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
              </style>

  

              <iron-ajax

                      auto

                      id="data_request"

                      url={{dataUrl}}

                      verbose="true"

                      on-response="handleResponseData"

                      debounce-duration="300">

              </iron-ajax>

  

              <iron-ajax

                      id="datales_list_request"

                      auto

                      url={{dataletsListUrl}}

                      handle-as="json"

                      on-response="handleResponseDatalets"

                      debounce-duration="300">

              </iron-ajax>

  

              <iron-ajax

24be6abb   Luigi Serra   selection control...
306
                      id="selectedDatalet_request"

938d1928   Luigi Serra   Update documentat...
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
                      url={{deepUrl}}

                      verbose="true"

                      on-response="handleSelectedDatalet"

                      debounce-duration="300">

              </iron-ajax>

  

              <content>

  

                  <neon-animated-pages id="pages" selected="[[selected]]" entry-animation="[[entryAnimation]]" exit-animation="[[exitAnimation]]">

  

                      <neon-animatable>

  

                          <div class="vertical justified layout">

  

                              <div class="horizontal layout">

                                  <div class="avatar" style="margin-left:15px">1</div>

                                  <div class="title flex">

                                      <div id="toolbar_title" class="big">Dataset source</div>

                                      <div id="toolbar_description" class="small">Copy and paste/drag and drop in the textarea the url of datasource</div>

                                  </div>

                                  <paper-icon-button id="NextButton" class="toolbar_button" on-click="_onNextClick" icon="chevron-right" alt="arrow-forward" title="arrow-forward"></paper-icon-button>

74249687   Luigi Serra   Cross browser con...
328
                              </div>

74249687   Luigi Serra   Cross browser con...
329
  

938d1928   Luigi Serra   Update documentat...
330
331
332
333
334
335
336
337
338
                              <div class="area_container">

                                  <paper-tabs selected="{{DatasourceTabSelected}}">

                                      <paper-tab>Select data source</paper-tab>

                                      <paper-tab>Most popular</paper-tab>

                                      <paper-tab>Search</paper-tab>

                                  </paper-tabs>

                                  <iron-pages selected="{{DatasourceTabSelected}}">

                                      <div>

                                          <div class="card-content">

bf28e75e   Luigi Serra   selection control...
339
                                              <paper-dropdown-menu id="datasets-sources" name="datasets-sources" label="Available datasets">

938d1928   Luigi Serra   Update documentat...
340
341
                                                  <paper-menu class="dropdown-content">

                                                      <template is="dom-repeat" items="{{datasets}}" as="dataset" index-as="index">

35c4a6d8   Luigi Serra   Datasets provider...
342
                                                          <paper-item id="{{index}}" on-tap="_datasourceSelected">{{dataset.name}}</paper-item>

938d1928   Luigi Serra   Update documentat...
343
344
345
                                                      </template>

                                                  </paper-menu>

                                              </paper-dropdown-menu>

c011cd54   Luigi Serra   selection control...
346
                                              <paper-icon-button id="infoButton" on-click="_onInfoClick" icon="info-outline" alt="Information about selected dataset" title="info-button" style="color:#9e9e9e;"></paper-icon-button>

938d1928   Luigi Serra   Update documentat...
347
                                          </div>

cb1aab91   Luigi Serra   Controllets update
348
  

938d1928   Luigi Serra   Update documentat...
349
                                          <div><img src="static/images/or.png" style="position: relative;left: 50%;padding-top:20px"></div>

835a711f   Luigi Serra   Controllet cross ...
350
  

938d1928   Luigi Serra   Update documentat...
351
                                          <div class="card-content">

486a1c48   Luigi Serra   selection control...
352
                                              <paper-textarea class="custom_textarea" id="data_url" label="Dataset api data url" floatingLabel value="{{dataUrl}}" on-dragover="_handleDatasourceDragOver"></paper-textarea>

938d1928   Luigi Serra   Update documentat...
353
                                          </div>

835a711f   Luigi Serra   Controllet cross ...
354
355
  

  

938d1928   Luigi Serra   Update documentat...
356
357
358
359
360
                                      </div>

                                      <div><img src="static/images/UnderConstruction.png" style="position: relative;top: 60%;left: 25%;"></div>

                                      <div><img src="static/images/UnderConstruction.png" style="position: relative;top: 60%;left: 25%;"></div>

                                  </iron-pages>

                              </div>

cb1aab91   Luigi Serra   Controllets update
361
  

938d1928   Luigi Serra   Update documentat...
362
                          </div>

73bcce88   luigser   COMPONENTS
363
  

938d1928   Luigi Serra   Update documentat...
364
                      </neon-animatable>

73bcce88   luigser   COMPONENTS
365
  

938d1928   Luigi Serra   Update documentat...
366
                      <neon-animatable>

73bcce88   luigser   COMPONENTS
367
  

938d1928   Luigi Serra   Update documentat...
368
                          <div class="vertical justified layout">

74249687   Luigi Serra   Cross browser con...
369
  

938d1928   Luigi Serra   Update documentat...
370
371
372
373
374
375
376
377
                              <div class="horizontal layout">

                                  <paper-icon-button id="PrevButton" class="toolbar_button x-scope" on-click="_onPrevClick" icon="chevron-left" alt="arrow-back" title="arrow-back"></paper-icon-button>

                                  <div class="avatar">2</div>

                                  <div class="title flex">

                                      <div id="toolbar_title" class="big">Dataset source</div>

                                      <div id="toolbar_description" class="small">Copy and paste/drag and drop in the textarea the url of datasource</div>

                                  </div>

                                  <paper-icon-button id="NextButton" class="toolbar_button" on-click="_onNextClick" icon="chevron-right" alt="arrow-forward" title="arrow-forward"></paper-icon-button>

74249687   Luigi Serra   Cross browser con...
378
                              </div>

74249687   Luigi Serra   Cross browser con...
379
  

938d1928   Luigi Serra   Update documentat...
380
                              <div class="horizontal layout">

73bcce88   luigser   COMPONENTS
381
  

938d1928   Luigi Serra   Update documentat...
382
                                  <div id="fields_placeholder" class="area_container flexchild" style="min-width:300px">

9d4a34db   Luigi Serra   selection control...
383
                                      <tree-view-controllet id="fields_treeview" root-name="data" opened-path="result,records"></tree-view-controllet>

938d1928   Luigi Serra   Update documentat...
384
385
386
387
388
                                  </div>

  

                                  <div id="table_fields_container" class="area_container flex2child">

                                      <div id="table_component_place_holder"></div>

                                  </div>

74249687   Luigi Serra   Cross browser con...
389
  

73bcce88   luigser   COMPONENTS
390
                              </div>

74249687   Luigi Serra   Cross browser con...
391
  

73bcce88   luigser   COMPONENTS
392
                          </div>

74249687   Luigi Serra   Cross browser con...
393
  

938d1928   Luigi Serra   Update documentat...
394
                      </neon-animatable>

73bcce88   luigser   COMPONENTS
395
  

938d1928   Luigi Serra   Update documentat...
396
                      <neon-animatable style="height:100vh">

73bcce88   luigser   COMPONENTS
397
  

938d1928   Luigi Serra   Update documentat...
398
                          <div class="vertical justified layout">

73bcce88   luigser   COMPONENTS
399
  

938d1928   Luigi Serra   Update documentat...
400
401
402
403
404
405
406
                              <div class="horizontal layout">

                                  <paper-icon-button id="PrevButton" class="toolbar_button x-scope" on-click="_onPrevClick" icon="chevron-left" alt="arrow-back" title="arrow-back"></paper-icon-button>

                                  <div class="avatar">3</div>

                                  <div class="title flex">

                                      <div id="toolbar_title" class="big">Data mapping</div>

                                      <div id="toolbar_description" class="small">Select the visualization from the slider, drag and drop the selected fields in visualization parameter area, customize the visualization if you need</div>

                                  </div>

24be6abb   Luigi Serra   selection control...
407
                                  <paper-icon-button id="NextButton" class="toolbar_button" on-click="_onNextClick" icon="chevron-right" alt="arrow-forward" title="arrow-forward"></paper-icon-button>

73bcce88   luigser   COMPONENTS
408
                              </div>

74249687   Luigi Serra   Cross browser con...
409
  

73bcce88   luigser   COMPONENTS
410
  

938d1928   Luigi Serra   Update documentat...
411
                              <div class="horizontal layout">

74249687   Luigi Serra   Cross browser con...
412
  

938d1928   Luigi Serra   Update documentat...
413
414
415
                                  <div class="">

                                      <div id="visualization_slider_area" class="area_container"></div>

                                      <div id="fields_mapping_area" class="area_container">

73bcce88   luigser   COMPONENTS
416
  

24be6abb   Luigi Serra   selection control...
417
                                          <div id="selectedFields_main_container" class="field-mapping-card">

938d1928   Luigi Serra   Update documentat...
418
419
420
                                              <div class="title">

                                                  <div class="medium">Selected fields</div>

                                              </div>

24be6abb   Luigi Serra   selection control...
421
                                              <div id="selectedFields_container" class="area_container"></div>

73bcce88   luigser   COMPONENTS
422
                                          </div>

73bcce88   luigser   COMPONENTS
423
  

938d1928   Luigi Serra   Update documentat...
424
425
426
427
428
                                          <div id="idm_fields_main_container" class="field-mapping-card">

                                              <div class="title">

                                                  <div class="medium">Datalet fields</div>

                                              </div>

                                              <div id="datalet_idm_fields_container" class="area_container"></div>

73bcce88   luigser   COMPONENTS
429
                                          </div>

73bcce88   luigser   COMPONENTS
430
                                      </div>

74249687   Luigi Serra   Cross browser con...
431
                                  </div>

73bcce88   luigser   COMPONENTS
432
  

24be6abb   Luigi Serra   selection control...
433
                                  <div id="datalet_placeholder" style="min-width: 43%;margin-top:10px;"></div>

8f65d1be   Luigi Serra   selection control...
434
  

24be6abb   Luigi Serra   selection control...
435
                              </div>

73bcce88   luigser   COMPONENTS
436
  

24be6abb   Luigi Serra   selection control...
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
                          </div>

  

                      </neon-animatable>

  

                      <neon-animatable>

                          <div class="vertical justified layout">

  

                              <div class="horizontal layout">

                                  <paper-icon-button id="PrevButton" class="toolbar_button x-scope" on-click="_onPrevClick" icon="chevron-left" alt="arrow-back" title="arrow-back"></paper-icon-button>

                                  <div class="avatar">4</div>

                                  <div class="title flex">

                                      <div id="toolbar_title" class="big">Finalize visualization</div>

                                      <div id="toolbar_description" class="small">Assign the values for label parameters (e.g. title for you visualization).</div>

                                  </div>

                                  <paper-icon-button id="finish_button" on-click="_onFinish" icon="add-circle" alt="Conforms the creation" title="finish"></paper-icon-button>

938d1928   Luigi Serra   Update documentat...
452
                              </div>

74249687   Luigi Serra   Cross browser con...
453
  

24be6abb   Luigi Serra   selection control...
454
455
456
457
458
459
460
461
                              <div class="horizontal layout">

                                  <div style="margin-top: 10px;">

                                      <div class="title">

                                          <div class="medium">Layout fields</div>

                                      </div>

                                      <div id="idm_layout_main_container" class="area_container">

                                          <div id="idm_layout_container" class="area_container"></div>

                                      </div>

486a1c48   Luigi Serra   selection control...
462
463
464
465
466
  

                                      <div id="comment">

                                          <paper-textarea class="custom_textarea" id="commentArea" label="Max 100 character comment" maxlength="100"></paper-textarea>

                                      </div>

  

24be6abb   Luigi Serra   selection control...
467
468
469
470
471
                                  </div>

  

                                  <div id="datalet_placeholder_2" style="min-width: 43%;margin-top: 10px;"></div>

  

                              </div>

938d1928   Luigi Serra   Update documentat...
472
                          </div>

73bcce88   luigser   COMPONENTS
473
  

938d1928   Luigi Serra   Update documentat...
474
                      </neon-animatable>

73bcce88   luigser   COMPONENTS
475
  

938d1928   Luigi Serra   Update documentat...
476
                  </neon-animated-pages>

73bcce88   luigser   COMPONENTS
477
  

938d1928   Luigi Serra   Update documentat...
478
                  <paper-toast id="message" text=""></paper-toast>

73bcce88   luigser   COMPONENTS
479
  

c011cd54   Luigi Serra   selection control...
480
481
482
483
484
485
                  <paper-dialog id="infoDialog">

                      <h2 id="infoDialogTitle"></h2>

                      <paper-dialog-scrollable id="infoDialogContent">

                      </paper-dialog-scrollable>

                  </paper-dialog>

  

938d1928   Luigi Serra   Update documentat...
486
              </content>

73bcce88   luigser   COMPONENTS
487
      </template>

74249687   Luigi Serra   Cross browser con...
488
  

0b818d7e   Luigi Serra   Selection control...
489
      <script src="../shared_js/perfect-scrollbar/js/min/perfect-scrollbar.jquery.min.js"></script>

73bcce88   luigser   COMPONENTS
490
491
492
493
      <script src="../../../DEEPCLIENT/js/deepClient.js"></script>

  

      <script>

  

73bcce88   luigser   COMPONENTS
494
495
496
497
          Polymer({

  

              is : 'data-sevc-controllet',

  

938d1928   Luigi Serra   Update documentat...
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
              /**

               * Received when the user selects a datalet from slider.

               *

               * @event items-slider-controllet_item-selected

               */

  

              /**

               * Received when the user drags a selected fields in to one of the source input data model field

               *

               * @event draggable-element-controllet_content-dragged

               */

  

              /**

               * Received when the user selects one field from treeview controllet

               *

               * @event treeview-controllet-fileds-selected

               */

  

              /**

               * Received when the user drags a selected fields in to one of the source input data model field

               *

               * @event draggable-element-controllet_content-dragged

               */

  

              /**

035bbee3   Luigi Serra   Datalets and cont...
523
524
525
526
527
528
               * Received when the user change text value of the selected datalet layout inputs

               *

               * @event text-element-controllet_content-changed

               */

  

              /**

938d1928   Luigi Serra   Update documentat...
529
530
531
532
533
               * Fired when the user press to finish button. At this event are attached all information about the visualization currently created

               *

               * @event data-sevc-controllet.dataletCreated

               */

  

73bcce88   luigser   COMPONENTS
534
535
536
              listeners : {

                  'items-slider-controllet_item-selected' : '_dataletSelected',

                  'draggable-element-controllet_content-dragged' : '_fieldsMapped',

9d4a34db   Luigi Serra   selection control...
537
                  'tree-view-controllet_selected-fields' : '_fieldsSelected',

035bbee3   Luigi Serra   Datalets and cont...
538
                  'text-element-controllet_content-changed' : '_textElementChanged'

73bcce88   luigser   COMPONENTS
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
              },

  

              properties : {

  

                  entryAnimation : {

                      type  : String,

                      value : ""

                  },

  

                  exitAnimation  : {

                      type  : String,

                      value : ""

                  },

  

                  selected       : {

                      type  : Number,

                      value : 0

                  },

  

                  /**

938d1928   Luigi Serra   Update documentat...
559
                   * It represents the data url from CKAN api

73bcce88   luigser   COMPONENTS
560
561
562
563
564
565
566
                   *

                   * @attribute dataUrl

                   * @type string

                   * @default 'null'

                   */

                  dataUrl : {

                      type : String,

24be6abb   Luigi Serra   selection control...
567
                      value : undefined,

73bcce88   luigser   COMPONENTS
568
569
570
                      observer : '_dataUrlChanged'

                  },

                  /**

938d1928   Luigi Serra   Update documentat...
571
                   * It represents the DEEP url to get information about the datalets

73bcce88   luigser   COMPONENTS
572
573
574
575
576
577
578
                   *

                   * @attribute deepUrl

                   * @type string

                   * @default 'null'

                   */

                  deepUrl : {

                      type : String,

24be6abb   Luigi Serra   selection control...
579
                      value : undefined

73bcce88   luigser   COMPONENTS
580
                  },

938d1928   Luigi Serra   Update documentat...
581
                  /**

938d1928   Luigi Serra   Update documentat...
582
583
584
585
586
587
                   * It's used to store the list of datalets returned from DEEP

                   *

                   * @attribute datalets_list

                   * @type Array

                   * @default empty

                   */

73bcce88   luigser   COMPONENTS
588
589
590
591
                  datalets_list : {

                      type : Array ,

                      value : []

                  },

938d1928   Luigi Serra   Update documentat...
592
593
594
                  /**

                   * It's used to store the selected datalet. It will be set when the controllet get the event of selection by item slider (items-slider-controllet_item-selected)

                   *

24be6abb   Luigi Serra   selection control...
595
                   * @attribute selectedDatalet

938d1928   Luigi Serra   Update documentat...
596
597
598
                   * @type String

                   * @default ''

                   */

24be6abb   Luigi Serra   selection control...
599
                  selectedDatalet : {

73bcce88   luigser   COMPONENTS
600
                      type : String,

24be6abb   Luigi Serra   selection control...
601
                      value : undefined

73bcce88   luigser   COMPONENTS
602
                  },

938d1928   Luigi Serra   Update documentat...
603
604
605
                  /**

                   * It's used to store the list of selected fields by user

                   *

24be6abb   Luigi Serra   selection control...
606
                   * @attribute selectedFields

938d1928   Luigi Serra   Update documentat...
607
608
609
                   * @type Array

                   * @default empty

                   */

24be6abb   Luigi Serra   selection control...
610
                  selectedFields : {

73bcce88   luigser   COMPONENTS
611
                      type : Array,

24be6abb   Luigi Serra   selection control...
612
613
614
615
616
617
618
619
                      value : undefined

                  },

                  /**

                   * It contains all attributes for the datalet preset. It'll be used when the controllet is called to modify an exsting datalet.

                   */

                  dataletPreset:{

                      type: Object,

                      value: undefined

cb1aab91   Luigi Serra   Controllets update
620
                  },

938d1928   Luigi Serra   Update documentat...
621
                  /**

035bbee3   Luigi Serra   Datalets and cont...
622
623
                   * It's used to store the params to give to datalet. This kind of params will not processed by selection step

                   *

24be6abb   Luigi Serra   selection control...
624
                   * @attribute paramsFields

035bbee3   Luigi Serra   Datalets and cont...
625
626
627
                   * @type Object

                   * @default empty

                   */

24be6abb   Luigi Serra   selection control...
628
                  paramsFields:{

035bbee3   Luigi Serra   Datalets and cont...
629
630
631
632
                    type: Object,

                    value: {}

                  },

                  /**

938d1928   Luigi Serra   Update documentat...
633
634
635
636
637
638
                   * It's used to store the tab index in the first pass

                   *

                   * @attribute DatasourceTabSelected

                   * @type Number

                   * @default 0

                   */

cb1aab91   Luigi Serra   Controllets update
639
640
641
642
                  DatasourceTabSelected : {

                      type : Number,

                      value : 0

                  },

938d1928   Luigi Serra   Update documentat...
643
644
645
646
647
648
649
                  /**

                   * It's used to store the datasets to show in the contexual menu

                   *

                   * @attribute datasets

                   * @type Array

                   * @default empty

                   */

cb1aab91   Luigi Serra   Controllets update
650
651
652
                  datasets :

                  {

                      type : Array,

35c4a6d8   Luigi Serra   Datasets provider...
653
                      value : []

73bcce88   luigser   COMPONENTS
654
                  }

73bcce88   luigser   COMPONENTS
655
              },

938d1928   Luigi Serra   Update documentat...
656
657
658
659
660
661
662
663
              /**

               * It is called after the element’s template has been stamped and all elements inside the element’s local DOM have been configured (with values bound from parents, deserialized attributes, or else default values) and had their ready method called.

               * In this phase the scrollbar will be initialized

               *

               * @method handleResponseData

               *

               * @param {Event} e

               */

73bcce88   luigser   COMPONENTS
664
665
666
  

              ready : function(){

  

0b818d7e   Luigi Serra   Selection control...
667
                  $(this.$.fields_placeholder).perfectScrollbar();

24be6abb   Luigi Serra   selection control...
668
                  $(this.$.selectedFields_main_container).perfectScrollbar();

0b818d7e   Luigi Serra   Selection control...
669
                  $(this.$.idm_fields_main_container).perfectScrollbar();

035bbee3   Luigi Serra   Datalets and cont...
670
                  $(this.$.idm_layout_main_container).perfectScrollbar();

0b818d7e   Luigi Serra   Selection control...
671
                  $(this.$.table_fields_container).perfectScrollbar();

73bcce88   luigser   COMPONENTS
672
  

24be6abb   Luigi Serra   selection control...
673
674
                  if(this.dataletPreset != undefined) {

                      this.$.data_url.value = this.dataletPreset['data-url'];

486a1c48   Luigi Serra   selection control...
675
                      this.selected = 1;

24be6abb   Luigi Serra   selection control...
676
                  }

7b2d40bf   Luigi Serra   Selection control...
677
              },

486a1c48   Luigi Serra   selection control...
678
679
680
681
              /**

               * Utility function to inject datalet in a placeholder

               */

              injectDatalet: function(place_holder){

9d4a34db   Luigi Serra   selection control...
682
                  var datalet_params ={

486a1c48   Luigi Serra   selection control...
683
684
685
686
687
688
                      component   : this.selectedDatalet,

                      params      : this.paramsFields,

                      fields      : this.selectedFields,

                      placeHolder : place_holder

                  };

                  ComponentService.deep_url = this.deepUrl;

9d4a34db   Luigi Serra   selection control...
689
                  ComponentService.getComponent(datalet_params);

486a1c48   Luigi Serra   selection control...
690
              },

7b2d40bf   Luigi Serra   Selection control...
691
  

73bcce88   luigser   COMPONENTS
692
693
694
695
              /**

               * Callback to parse the data requested when dataUrl change its value

               *

               * @method handleResponseData

938d1928   Luigi Serra   Update documentat...
696
697
               *

               * @param {Event} e

73bcce88   luigser   COMPONENTS
698
699
               */

              handleResponseData : function(e){

9d4a34db   Luigi Serra   selection control...
700
701
702
                  this.$.fields_treeview.setAttribute("json-data", JSON.stringify(e.detail.response));

                  this.$.fields_treeview.setAttribute("preselected-fields", JSON.stringify(this.selectedFields));

                  this.$.fields_treeview.ready();//chrome

73bcce88   luigser   COMPONENTS
703
704
705
706
707
708
              },

  

              /**

               * Callback to parse the components response object

               *

               * @method handleResponseDatalets

938d1928   Luigi Serra   Update documentat...
709
710
               *

               * @param {Event} e

73bcce88   luigser   COMPONENTS
711
712
713
714
715
716
717
718
719
720
721
               */

              handleResponseDatalets : function(e){

                  this.datalets_list = new Array();

                  for(var i=0;i < e.detail.response.length;i++){

                      var datalet_info = { name : e.detail.response[i].name ,

                                           image : e.detail.response[i].url + e.detail.response[i].name + ".png"

                      };

  

                      this.datalets_list.push(datalet_info);

                  }

  

24be6abb   Luigi Serra   selection control...
722
723
724
725
726
727
728
                  if(this.selectedDatalet == undefined)

                    this.$.visualization_slider_area.innerHTML = '<items-slider-controllet items=\'' + JSON.stringify(this.datalets_list) + '\'' +

                           '\'></items-slider-controllet>';

                  else

                      this.$.visualization_slider_area.innerHTML = '<items-slider-controllet items=\'' + JSON.stringify(this.datalets_list) + '\'' +

                                                                   'selected-card=\'' + this.selectedDatalet + '\'></items-slider-controllet>';

  

73bcce88   luigser   COMPONENTS
729
              },

938d1928   Luigi Serra   Update documentat...
730
731
732
733
734
735
736
737
              /**

               * Callback to dataset selection from list in the phase three. When a datalet is selected this function will build a bundle of box items, based on the datalet input data model,

               * to allow user to drag the fields, from the selected fields box, and create a new visualization.

               *

               * @method handleSelectedDatalet

               *

               * @param {Event} e

               */

73bcce88   luigser   COMPONENTS
738
739
740
              handleSelectedDatalet : function(e){

  

                 var response = e.detail.response;

73bcce88   luigser   COMPONENTS
741
                 this.$.datalet_idm_fields_container.innerHTML = "";

035bbee3   Luigi Serra   Datalets and cont...
742
                 this.$.idm_layout_container.innerHTML = "";

73bcce88   luigser   COMPONENTS
743
  

24be6abb   Luigi Serra   selection control...
744
745
746
                 var input;

                 var layouts = jQuery.extend(true, {}, response.idm.inputs.layouts);

  

a619e8e4   Luigi Serra   Selection control...
747
                 if(response.idm.inputs.input.constructor == Object) {

24be6abb   Luigi Serra   selection control...
748
749
750
751
752
753
754
755
                     if(response.idm.inputs.input.selection == "*")

                     {

                         input = response.idm.inputs.input;

                         response.idm.inputs.input = new Array();

                         for(var i=0;i<this.selectedFields.length;i++){

                             var newInput = jQuery.extend(true, {}, input);

                             newInput.name = input.name + ' ' + (i + 1);

                             response.idm.inputs.input.push(newInput);

a619e8e4   Luigi Serra   Selection control...
756
757
                         }

                     }

24be6abb   Luigi Serra   selection control...
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
                 }

  

                 var heading;

                 var id;

  

                 for(var i =0; i < response.idm.inputs.input.length; i++) {

                     var html = '<draggable-element-controllet is-target="true" ';

                     input = response.idm.inputs.input[i];

  

                     heading = ' heading="' + input.name + '"';

                     id = ' id="' + (i + 1) + '"';

  

                     html += heading + id;

                     html += ' description="' + input.description + '"' +

                             ' number="' + (i + 1) + '"';

  

                     if(this.selectedFields != undefined) {

                        if(this.selectedFields[i] != undefined) {

                            html += ' value="' + this.selectedFields[i] + '"' +

                                    ' label="' + this.selectedFields[i].split(",")[this.selectedFields[i].split(",").length - 1] + '"';

                        }

74249687   Luigi Serra   Cross browser con...
779
                     }

24be6abb   Luigi Serra   selection control...
780
781
782
783
  

                     html += '></draggable-element-controllet><br>';

                     this.$.datalet_idm_fields_container.innerHTML += html;

  

a619e8e4   Luigi Serra   Selection control...
784
785
                 }

  

24be6abb   Luigi Serra   selection control...
786
787
788
                 if(layouts.input != undefined) {

                     if(layouts.input.constructor == Object){

                         layouts.input = new Array(jQuery.extend(true, {}, layouts.input));

035bbee3   Luigi Serra   Datalets and cont...
789
790
                     }

  

24be6abb   Luigi Serra   selection control...
791
792
793
794
795
796
797
798
799
800
801
802
                     html = '<text-element-controllet ';

                     for (var i = 0; i < layouts.input.length; i++) {

                         html += '<text-element-controllet heading="' + layouts.input[i].name + '" ' +

                                 'description="' + layouts.input[i].description + '" ' +

                                 'number="' + (i + 1) + '" ';

                         if(this.dataletPreset != undefined){

                            html += 'value="' + this.dataletPreset[Object.keys(this.dataletPreset)[(i + 1)]] + '"';

                         }

  

                         html += '></text-element-controllet>';

                     }

                     this.$.idm_layout_container.innerHTML = html;

035bbee3   Luigi Serra   Datalets and cont...
803
804
                 }

  

24be6abb   Luigi Serra   selection control...
805
806
                 if(this.selectedFields != undefined) this.generateDataletPreview();

  

035bbee3   Luigi Serra   Datalets and cont...
807
808
809
810
811
812
813
814
815
              },

              /**

               * Generate the datalet preview when user mapped fields. it even retrieves the value of layout inputs values.

               *

               * @method generateDataletPreview

               */

              generateDataletPreview : function(){

  

                  var input_mapped_fields = Polymer.dom(this.$.datalet_idm_fields_container).querySelectorAll('draggable-element-controllet[is-target=true]');

24be6abb   Luigi Serra   selection control...
816
                  this.selectedFields = Array();

035bbee3   Luigi Serra   Datalets and cont...
817
818
819
  

                  for (var i = 0; i < input_mapped_fields.length; i++) {

                      if (input_mapped_fields[i].value != "") {

24be6abb   Luigi Serra   selection control...
820
                          this.selectedFields.push(input_mapped_fields[i].value);

035bbee3   Luigi Serra   Datalets and cont...
821
822
823
824
                      }

                  }

  

                  var input_layouts_fields = Polymer.dom(this.$.idm_layout_container).querySelectorAll('text-element-controllet');

24be6abb   Luigi Serra   selection control...
825
                  this.paramsFields = {'data-url' : this.dataUrl};

035bbee3   Luigi Serra   Datalets and cont...
826
827
828
  

                  for (var i = 0; i < input_layouts_fields.length; i++) {

                      if (input_layouts_fields[i].value != "") {

24be6abb   Luigi Serra   selection control...
829
                          this.paramsFields[input_layouts_fields[i].heading]  =  input_layouts_fields[i].value;

035bbee3   Luigi Serra   Datalets and cont...
830
831
832
                      }

                  }

  

486a1c48   Luigi Serra   selection control...
833
                  this.injectDatalet(this.$.datalet_placeholder);

035bbee3   Luigi Serra   Datalets and cont...
834
  

73bcce88   luigser   COMPONENTS
835
              },

938d1928   Luigi Serra   Update documentat...
836
837
838
839
840
841
842
              /**

               * Validate the current pass in order to access to next one.

               *

               * @method validateCurrentPass

               *

               * @param {Number} next_selected_pass

               */

74249687   Luigi Serra   Cross browser con...
843
844
845
846
847
848
              validateCurrentPass : function(next_selected_pass){

  

                  switch(next_selected_pass){

                      case 0:

                          return true;

                      case 1:

24be6abb   Luigi Serra   selection control...
849
                          if(this.$.data_url.value == undefined){

74249687   Luigi Serra   Cross browser con...
850
851
852
853
854
855
856
857
                              this.$.message.text = "You have to select a dataset to access to pass 2.";

                              this.$.message.show();

                              return false;

                          }else{

                              return true;

                          }

  

                      case 2:

24be6abb   Luigi Serra   selection control...
858
                          if(Polymer.dom(this.$.selectedFields_container).querySelectorAll('draggable-element-controllet') == 0){

74249687   Luigi Serra   Cross browser con...
859
860
861
862
863
864
                              this.$.message.text = "You have to select a set of fields to access to pass 3.";

                              this.$.message.show();

                              return false;

                          }else{

                              return true;

                          }

24be6abb   Luigi Serra   selection control...
865
                      case 3:

486a1c48   Luigi Serra   selection control...
866
                          this.injectDatalet(this.$.datalet_placeholder_2);

24be6abb   Luigi Serra   selection control...
867
                          return true;

74249687   Luigi Serra   Cross browser con...
868
869
870
                  }

  

              },

938d1928   Luigi Serra   Update documentat...
871
872
873
874
875
876
              /**

               * Callback for manage the previous pass button

               *

               * @method _onPrevClick

               *

               */

73bcce88   luigser   COMPONENTS
877
              _onPrevClick : function() {

74249687   Luigi Serra   Cross browser con...
878
879
                  if(!this.validateCurrentPass(this.selected === 0 ? 0 : (this.selected - 1))) return;

  

73bcce88   luigser   COMPONENTS
880
                  this.entryAnimation = 'slide-from-left-animation';

2b9aa997   Luigi Serra   Bugs fix
881
882
                  this.exitAnimation  = 'slide-right-animation';

                  this.selected = this.selected === 0 ? 0 : (this.selected - 1);

73bcce88   luigser   COMPONENTS
883
              },

938d1928   Luigi Serra   Update documentat...
884
              /**

c011cd54   Luigi Serra   selection control...
885
               * Callback to manage the next pass button

938d1928   Luigi Serra   Update documentat...
886
887
888
889
               *

               * @method _onNextClick

               *

               */

73bcce88   luigser   COMPONENTS
890
              _onNextClick : function() {

74249687   Luigi Serra   Cross browser con...
891
  

24be6abb   Luigi Serra   selection control...
892
                  if(!this.validateCurrentPass(this.selected === 3 ? 3 : (this.selected + 1))) return;

74249687   Luigi Serra   Cross browser con...
893
  

73bcce88   luigser   COMPONENTS
894
                  this.entryAnimation = 'slide-from-right-animation';

2b9aa997   Luigi Serra   Bugs fix
895
                  this.exitAnimation  = 'slide-left-animation';

24be6abb   Luigi Serra   selection control...
896
                  this.selected = this.selected === 3 ? 3 : (this.selected + 1);

73bcce88   luigser   COMPONENTS
897
              },

938d1928   Luigi Serra   Update documentat...
898
              /**

c011cd54   Luigi Serra   selection control...
899
900
901
902
903
904
905
906
907
               * Callback to manage InfoButton click to give user information about the selected dataset

               *

               */

              _onInfoClick : function(){

  

                  this.$.infoDialog.open();

  

              },

              /**

938d1928   Luigi Serra   Update documentat...
908
909
910
911
912
913
               * Callback related to datasource selection from select menu

               *

               * @method _datasourceSelected

               *

               * @param {Event} e

               */

cb1aab91   Luigi Serra   Controllets update
914
              _datasourceSelected : function(e){

2b235978   Luigi Serra   Controllet cross ...
915
  

35c4a6d8   Luigi Serra   Datasets provider...
916
                 this.$.data_url.value = this.datasets[parseInt(e.target.id)].url;

c011cd54   Luigi Serra   selection control...
917
918
919
                 this.$.infoDialogTitle.innerHTML = this.datasets[parseInt(e.target.id)].name;

                 this.$.infoDialogContent.innerHTML = this.datasets[parseInt(e.target.id)].description;

  

cb1aab91   Luigi Serra   Controllets update
920
              },

938d1928   Luigi Serra   Update documentat...
921
922
923
924
925
926
927
              /**

               * Callback related to data url change

               *

               * @method _dataUrlChanged

               *

               * @param {Event} e

               */

73bcce88   luigser   COMPONENTS
928
929
930
              _dataUrlChanged : function(newValue, oldValue){

                  this.$.data_request.generateRequest();

              },

938d1928   Luigi Serra   Update documentat...
931
932
933
934
935
936
937
              /**

               * Callback related to event 'items-slider-controllet_item-selected' fired by items-slider-controllet when the user selects a datalet

               *

               * @method _dataletSelected

               *

               * @param {Event} e

               */

73bcce88   luigser   COMPONENTS
938
              _dataletSelected : function(e){

24be6abb   Luigi Serra   selection control...
939
940
941
                  this.selectedDatalet = e.detail.datalet;

                  this.$.selectedDatalet_request.url = this.deepUrl + e.detail.datalet;

                  this.$.selectedDatalet_request.generateRequest();

73bcce88   luigser   COMPONENTS
942
943
  

              },

938d1928   Luigi Serra   Update documentat...
944
945
946
947
948
949
950
              /**

               * Callback related to event 'treeview-controllet-fileds-selected' fired by treeview-controllet when the user selects a field

               *

               * @method _fieldsSelected

               *

               * @param {Event} e

               */

73bcce88   luigser   COMPONENTS
951
952
              _fieldsSelected : function(e){

  

9d4a34db   Luigi Serra   selection control...
953
                   this.selectedFields = e.detail.fields;

24be6abb   Luigi Serra   selection control...
954
                   this.$.selectedFields_container.innerHTML = "";

73bcce88   luigser   COMPONENTS
955
                   for(var i=0;i<e.detail.fields.length;i++) {

24be6abb   Luigi Serra   selection control...
956
                      this.$.selectedFields_container.innerHTML += '<draggable-element-controllet identifier="' + e.detail.fields[i] +

73bcce88   luigser   COMPONENTS
957
958
959
960
                                                                                                   '" label="' + e.detail.fields[i].split(",")[e.detail.fields[i].split(",").length -1] +

                                                                    '"></draggable-element-controllet><br>';

                   }

  

74249687   Luigi Serra   Cross browser con...
961
962
                   var place_holder = (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) ? this.$.table_component_place_holder : this.$.table_component_place_holder[Object.keys(this.$.table_component_place_holder)[0]];

  

73bcce88   luigser   COMPONENTS
963
964
965
966
967
968
                   var table_params ={

                       component   : "datatable-datalet",

                       params      :{

                          'data-url' : this.dataUrl

                       },

                       fields      : e.detail.fields,

74249687   Luigi Serra   Cross browser con...
969
                       placeHolder :  this.$.table_component_place_holder

73bcce88   luigser   COMPONENTS
970
971
972
973
974
975
                   };

  

                   ComponentService.deep_url = this.deepUrl;

                   ComponentService.getComponent(table_params);

  

              },

938d1928   Luigi Serra   Update documentat...
976
977
978
979
980
981
982
              /**

               * Callback related to event 'draggable-element-controllet_content-dragged' fired by draggable-element-controllet when the user drags a selected field in to input data model field

               *

               * @method _fieldsMapped

               *

               * @param {Event} e

               */

73bcce88   luigser   COMPONENTS
983
984
              _fieldsMapped : function(e){

  

035bbee3   Luigi Serra   Datalets and cont...
985
                  this.generateDataletPreview();

73bcce88   luigser   COMPONENTS
986
987
  

              },

938d1928   Luigi Serra   Update documentat...
988
              /**

035bbee3   Luigi Serra   Datalets and cont...
989
990
991
992
993
994
995
996
               * Callback related to event 'text-element-controllet_content-changed' fired by text-element-controllet when the user change the value of text

               *

               * @method _textElementChanged

               *

               * @param {Event} e

               */

              _textElementChanged : function(e){

                  this.generateDataletPreview();

486a1c48   Luigi Serra   selection control...
997
                  this.injectDatalet(this.$.datalet_placeholder_2);

035bbee3   Luigi Serra   Datalets and cont...
998
999
              },

              /**

938d1928   Luigi Serra   Update documentat...
1000
1001
1002
1003
1004
1005
               * Callback related to the drag operation in the dataUrl input area. It's used to delete previous value.

               *

               * @method _handleDatasourceDragOver

               *

               * @param {Event} e

               */

73bcce88   luigser   COMPONENTS
1006
1007
1008
              _handleDatasourceDragOver : function(e){

                  this.$.data_url.value = "";

              },

938d1928   Luigi Serra   Update documentat...
1009
1010
1011
1012
1013
1014
1015
              /**

               * Callback related to the finish button.

               *

               * @method _onFinish

               *

               * @param {Event} e

               */

73bcce88   luigser   COMPONENTS
1016
1017
              _onFinish : function(e){

  

24be6abb   Luigi Serra   selection control...
1018
                  if((this.selectedFields.length == 0) || this.selectedDatalet == ""){

dbc787cf   Luigi Serra   Controllet cross ...
1019
1020
1021
1022
1023
                      this.$.message.text = "You have to map the selected fields with datalets fields(by dragging) and select a datalet to export a new visualization.";

                      this.$.message.show();

                      return;

                  }

  

73bcce88   luigser   COMPONENTS
1024
1025
                  var data = {

                      dataUrl : this.dataUrl,

24be6abb   Luigi Serra   selection control...
1026
1027
1028
                      params :  this.paramsFields,

                      fields :  this.selectedFields,

                      datalet : this.selectedDatalet,

486a1c48   Luigi Serra   selection control...
1029
                      comment : this.$.commentArea.value,

5e31b047   isisadmin   datalet chaching ...
1030
                      staticData : JSON.stringify(this.$.datalet_placeholder.children[1].behavior.data)

73bcce88   luigser   COMPONENTS
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
                  }

  

                  this.fire('data-sevc-controllet.dataletCreated', {data : data});

  

              }

  

          });

  

      </script>

  

  </dom-module>