Blame view

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

  @license

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

73bcce88   luigser   COMPONENTS
4
  

a31f0660   root   sevc-controllet i...
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
  <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">

f748e9cf   Luigi Serra   new controllet an...
41
  <link rel="import" href="../../bower_components/paper-material/paper-material.html">

938d1928   Luigi Serra   Update documentat...
42
43
44
45
46
47
48
49
50
  <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...
51
52
  <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...
53
  

f748e9cf   Luigi Serra   new controllet an...
54
  <link rel="import" href="../items-list-controllet/item-list-controllet.html">

938d1928   Luigi Serra   Update documentat...
55
  <link rel="import" href="../draggable-element-controllet/draggable-element-controllet.html">

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

a31f0660   root   sevc-controllet i...
57
  <link rel="import" href="../tree-view-multi-table-controllet/tree-view-multi-table-controllet.html">

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

f748e9cf   Luigi Serra   new controllet an...
59
  <link rel="import" href="../animated-button-container-controllet/animated-button-container-controllet.html">

a31f0660   root   sevc-controllet i...
60
  <link rel="import" href="../../datalets/datasetexplorer-datalet/datasetexplorer-datalet.html">

938d1928   Luigi Serra   Update documentat...
61
62
  

  <!--

c6d8e1a1   Luigi Serra   fix
63
64
65
66
67
  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...
68
69
70
  

  Example:

  

6f8e74f7   Luigi Serra   card update
71
72
      <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
73
                            datasets='{[{name : 'dataset1', url : dataset1Urls}, ... , {name : 'datasetN', url : datasetNUrls}]'>

938d1928   Luigi Serra   Update documentat...
74
75
76
77
78
      </data-sevc-controllet>

  

  

  @element data-sevc-controllet

  @status beta

c6d8e1a1   Luigi Serra   fix
79
  @homepage

938d1928   Luigi Serra   Update documentat...
80
81
82
83
84
  @group controllets

  -->

  

  

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

a31f0660   root   sevc-controllet i...
85
86
      <template>

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

74249687   Luigi Serra   Cross browser con...
87
  

a31f0660   root   sevc-controllet i...
88
          <style is="custom-style">

73bcce88   luigser   COMPONENTS
89
  

a31f0660   root   sevc-controllet i...
90
91
92
              ::content body {

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

              }

dbc787cf   Luigi Serra   Controllet cross ...
93
  

a31f0660   root   sevc-controllet i...
94
95
96
97
              .flexchild

              {

              @apply(--layout-flex);

              }

73bcce88   luigser   COMPONENTS
98
  

a31f0660   root   sevc-controllet i...
99
100
101
102
              .flex2child

              {

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

              }

73bcce88   luigser   COMPONENTS
103
  

a31f0660   root   sevc-controllet i...
104
105
106
107
108
109
110
111
112
113
114
115
              .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
116
  

a31f0660   root   sevc-controllet i...
117
118
119
120
121
122
              .title

              {

                  position: relative;

                  top: 0.60vh;

                  margin-left: 20px;

              }

73bcce88   luigser   COMPONENTS
123
  

a31f0660   root   sevc-controllet i...
124
125
126
127
128
              .big

              {

                  font-size: 1.37em;

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

              }

73bcce88   luigser   COMPONENTS
129
  

a31f0660   root   sevc-controllet i...
130
131
132
133
134
135
136
              .medium

              {

                  font-size: 1em;

                  padding-bottom: 0.5em;

                  color : #000000;

                  font-weight: bold;

              }

73bcce88   luigser   COMPONENTS
137
  

a31f0660   root   sevc-controllet i...
138
139
140
141
142
143
144
              .small

              {

                  font-size: 0.8em;

                  padding-top: 10px;

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

                  font-weight: bold;

              }

74249687   Luigi Serra   Cross browser con...
145
  

a31f0660   root   sevc-controllet i...
146
147
148
149
              paper-input

              {

                  width: 80%;

              }

73bcce88   luigser   COMPONENTS
150
  

a31f0660   root   sevc-controllet i...
151
152
153
154
155
156
              paper-dropdown-menu

              {

                  text-align: left;

                  margin: auto;

                  width: 100%;

              }

cb1aab91   Luigi Serra   Controllets update
157
  

a31f0660   root   sevc-controllet i...
158
159
160
161
162
              ::content paper-menu-button

              {

                  display: block;

                  width: 100%;

              }

cb1aab91   Luigi Serra   Controllets update
163
  

a31f0660   root   sevc-controllet i...
164
165
166
167
168
              #visualization_slider_area

              {

                  padding-top: 20px;

                  overflow: visible;

              }

73bcce88   luigser   COMPONENTS
169
  

a31f0660   root   sevc-controllet i...
170
171
172
173
174
              #fields_mapping_area

              {

                  min-width: 670px;

                  min-height: 180px;

              }

73bcce88   luigser   COMPONENTS
175
  

a31f0660   root   sevc-controllet i...
176
177
178
179
180
181
182
              #datalet_placeholder

              {

                  height: 60vh;

                  min-height: 60vh;

                  min-width: 45%;

                  margin-top:10px;

              }

73bcce88   luigser   COMPONENTS
183
  

a31f0660   root   sevc-controllet i...
184
185
186
187
              .datalet_right_container

              {

                  width: 100vh;

              }

73bcce88   luigser   COMPONENTS
188
  

a31f0660   root   sevc-controllet i...
189
190
191
192
193
              .field-mapping-card

              {

                  width: 50%;

                  float: left;

              }

73bcce88   luigser   COMPONENTS
194
  

a31f0660   root   sevc-controllet i...
195
196
197
198
199
              .toolbar_button

              {

                  --iron-icon-height: 32px;

                  --iron-icon-width: 32px;

              }

73bcce88   luigser   COMPONENTS
200
  

a31f0660   root   sevc-controllet i...
201
202
203
204
205
206
              #finish_button

              {

                  --iron-icon-height: 32px;

                  --iron-icon-width: 32px;

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

              }

73bcce88   luigser   COMPONENTS
207
  

a31f0660   root   sevc-controllet i...
208
209
210
211
212
213
              .area_container

              {

                  overflow: hidden;

                  margin : 0.8em;

                  padding : 0.8em;

              }

73bcce88   luigser   COMPONENTS
214
  

a31f0660   root   sevc-controllet i...
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
              /*#fields_placeholder{*/

                  /*width: 40%;*/

                  /*height: 75vh;*/

                  /*position: relative;*/

                  /*float: left;*/

                  /*overflow: auto;*/

              /*}*/

  

              #fields_placeholder{

                  width: 100%;

                  /*height: 75vh;*/

                  /*position: relative;*/

                  /*float: right;*/

                  /*overflow: auto;*/

              }

73bcce88   luigser   COMPONENTS
230
  

a31f0660   root   sevc-controllet i...
231
232
233
234
235
236
237
              #table_fields_container{

                  height: 75vh;

                  width: 55%;

                  position: relative;

                  float: left;

                  overflow: auto;

              }

73bcce88   luigser   COMPONENTS
238
  

a31f0660   root   sevc-controllet i...
239
240
241
242
              #idm_fields_main_container{

                  position: relative;

                  height: 60vh;

              }

74249687   Luigi Serra   Cross browser con...
243
  

a31f0660   root   sevc-controllet i...
244
245
246
247
              #selectedFields_main_container{

                  position: relative;

                  height: 60vh;

              }

74249687   Luigi Serra   Cross browser con...
248
  

a31f0660   root   sevc-controllet i...
249
250
251
252
              #idm_layout_main_container{

                  position: relative;

                  height: 50vh;

              }

486a1c48   Luigi Serra   selection control...
253
  

a31f0660   root   sevc-controllet i...
254
255
256
257
              #comment{

                  position: relative;

                  width: 35vw;

              }

035bbee3   Luigi Serra   Datalets and cont...
258
  

a31f0660   root   sevc-controllet i...
259
260
261
              paper-menu{

                  width: 100%;

              }

74249687   Luigi Serra   Cross browser con...
262
  

a31f0660   root   sevc-controllet i...
263
264
265
266
267
268
269
270
              paper-dialog {

                  position: fixed;

                  top: 16px;

                  width: auto;

                  height: auto;

                  overflow: auto;

                  padding : 30px;

              }

c011cd54   Luigi Serra   selection control...
271
  

a31f0660   root   sevc-controllet i...
272
273
274
275
276
277
278
              paper-tabs, paper-toolbar

              {

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

                  color: #ffffff;

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

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

              }

74249687   Luigi Serra   Cross browser con...
279
  

a31f0660   root   sevc-controllet i...
280
281
282
283
              paper-toolbar paper-tabs

              {

                  box-shadow: none;

              }

cb1aab91   Luigi Serra   Controllets update
284
  

a31f0660   root   sevc-controllet i...
285
286
287
288
              paper-tabs[noink][no-bar] paper-tab.iron-selected

              {

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

              }

835a711f   Luigi Serra   Controllet cross ...
289
  

a31f0660   root   sevc-controllet i...
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
              paper-tabs[align-bottom]

              {

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

              }

          </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

                  id="selectedDatalet_request"

                  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>

                          </div>

  

                          <paper-material elevation="2" class="area_container">

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

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

                                  <paper-tab>Tree Map Search</paper-tab>

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

                              </paper-tabs>

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

                                  <div>

                                      <div class="card-content">

                                          <paper-dropdown-menu id="datasets-sources" name="datasets-sources" label="Available datasets">

                                              <paper-menu class="dropdown-content">

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

                                                      <paper-item id="{{index}}" on-tap="_datasourceSelected">{{dataset.name}}</paper-item>

                                                  </template>

                                              </paper-menu>

                                          </paper-dropdown-menu>

                                          <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>

                                      </div>

835a711f   Luigi Serra   Controllet cross ...
357
  

a31f0660   root   sevc-controllet i...
358
                                      <div><img src="static/images/or.png" style="position: relative;left: 50%;padding-top:20px"></div>

835a711f   Luigi Serra   Controllet cross ...
359
  

a31f0660   root   sevc-controllet i...
360
361
                                      <div class="card-content">

                                          <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...
362
                                      </div>

cb1aab91   Luigi Serra   Controllets update
363
  

73bcce88   luigser   COMPONENTS
364
  

a31f0660   root   sevc-controllet i...
365
366
367
                                  </div>

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

                                  <div>

339d682e   isisadmin   controllet
368
                                      <datasetexplorer-datalet class="datasetexplorer" data-url="/openwall/api/datasetTree" fields='["result,provider_name","result,organization_name","result,package_name","result,resource_name","result,url","result,w"]'></datasetexplorer-datalet>

a31f0660   root   sevc-controllet i...
369
370
371
372
                                  </div>

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

                              </iron-pages>

                          </paper-material>

73bcce88   luigser   COMPONENTS
373
  

a31f0660   root   sevc-controllet i...
374
                      </div>

73bcce88   luigser   COMPONENTS
375
  

a31f0660   root   sevc-controllet i...
376
                  </neon-animatable>

74249687   Luigi Serra   Cross browser con...
377
  

a31f0660   root   sevc-controllet i...
378
379
380
381
382
383
384
385
386
387
                  <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">2</div>

                              <div class="title flex">

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

                                  <div id="toolbar_description" class="small">Select the fields you want to use for visualization from tree on the right side. The table on the left side will show you the values related to the selected fields.</div>

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

a31f0660   root   sevc-controllet i...
389
390
                              <paper-icon-button id="NextButton" class="toolbar_button" on-click="_onNextClick" icon="chevron-right" alt="arrow-forward" title="arrow-forward"></paper-icon-button>

                          </div>

74249687   Luigi Serra   Cross browser con...
391
  

a31f0660   root   sevc-controllet i...
392
                          <div class="horizontal layout">

73bcce88   luigser   COMPONENTS
393
  

a31f0660   root   sevc-controllet i...
394
395
396
                              <!--<paper-material elevation="2" id="fields_placeholder" class="area_container flexchild" style="min-width:300px">-->

                                  <!--<tree-view-controllet id="fields_treeview" root-name="data" opened-path="result,records"></tree-view-controllet>-->

                              <!--</paper-material>-->

938d1928   Luigi Serra   Update documentat...
397
  

a31f0660   root   sevc-controllet i...
398
399
400
                              <!--<paper-material elevation="2" id="table_fields_container" class="area_container flex2child">-->

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

                              <!--</paper-material>-->

74249687   Luigi Serra   Cross browser con...
401
  

a31f0660   root   sevc-controllet i...
402
403
404
                              <!--<paper-material elevation="2" id="fields_placeholder" class="area_container flexchild" style="min-width:300px">-->

                              <div id="fields_placeholder">

                                  <tree-view-multi-table-controllet id="fields_treeview" root-name="data" opened-path="result,records" data-url={{dataUrl}}></tree-view-multi-table-controllet>

73bcce88   luigser   COMPONENTS
405
                              </div>

a31f0660   root   sevc-controllet i...
406
                              <!--</paper-material>-->

74249687   Luigi Serra   Cross browser con...
407
  

73bcce88   luigser   COMPONENTS
408
                          </div>

74249687   Luigi Serra   Cross browser con...
409
  

a31f0660   root   sevc-controllet i...
410
                      </div>

73bcce88   luigser   COMPONENTS
411
  

a31f0660   root   sevc-controllet i...
412
                  </neon-animatable>

73bcce88   luigser   COMPONENTS
413
  

a31f0660   root   sevc-controllet i...
414
                  <neon-animatable>

73bcce88   luigser   COMPONENTS
415
  

a31f0660   root   sevc-controllet i...
416
417
418
419
420
421
422
423
                      <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">3</div>

                              <div class="title flex">

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

                                  <div id="toolbar_description" class="small">Select the visualization by clicking on the button(a window will appear with all available visualization).After, drag and drop the selected fields into datalet parameters area. A preview will be shown on the right side.</div>

73bcce88   luigser   COMPONENTS
424
                              </div>

a31f0660   root   sevc-controllet i...
425
426
                              <paper-icon-button id="NextButton" class="toolbar_button" on-click="_onNextClick" icon="chevron-right" alt="arrow-forward" title="arrow-forward"></paper-icon-button>

                          </div>

74249687   Luigi Serra   Cross browser con...
427
  

73bcce88   luigser   COMPONENTS
428
  

a31f0660   root   sevc-controllet i...
429
                          <div class="horizontal layout">

74249687   Luigi Serra   Cross browser con...
430
  

a31f0660   root   sevc-controllet i...
431
432
433
                              <div class="">

                                  <paper-material elevation="0" id="visualization_slider_area"></paper-material>

                                  <paper-material elevation="2" id="fields_mapping_area" class="area_container">

73bcce88   luigser   COMPONENTS
434
  

a31f0660   root   sevc-controllet i...
435
436
437
                                      <div id="selectedFields_main_container" class="field-mapping-card">

                                          <div class="title">

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

73bcce88   luigser   COMPONENTS
438
                                          </div>

a31f0660   root   sevc-controllet i...
439
440
                                          <paper-material elevation="2" id="selectedFields_container" class="area_container"></paper-material>

                                      </div>

73bcce88   luigser   COMPONENTS
441
  

a31f0660   root   sevc-controllet i...
442
443
444
                                      <div id="idm_fields_main_container" class="field-mapping-card">

                                          <div class="title">

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

73bcce88   luigser   COMPONENTS
445
                                          </div>

a31f0660   root   sevc-controllet i...
446
447
448
                                          <paper-material elevation="2" id="datalet_idm_fields_container" class="area_container"></paper-material>

                                      </div>

                                  </paper-material>

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

73bcce88   luigser   COMPONENTS
450
  

a31f0660   root   sevc-controllet i...
451
                              <div id="datalet_placeholder"></div>

24be6abb   Luigi Serra   selection control...
452
  

a31f0660   root   sevc-controllet i...
453
                          </div>

24be6abb   Luigi Serra   selection control...
454
  

a31f0660   root   sevc-controllet i...
455
                      </div>

24be6abb   Luigi Serra   selection control...
456
  

a31f0660   root   sevc-controllet i...
457
                  </neon-animatable>

74249687   Luigi Serra   Cross browser con...
458
  

a31f0660   root   sevc-controllet i...
459
460
                  <neon-animatable>

                      <div class="vertical justified layout">

486a1c48   Luigi Serra   selection control...
461
  

a31f0660   root   sevc-controllet i...
462
463
464
465
466
467
468
469
470
                          <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 layout parameters (e.g. title for you visualization) and look at the final visualization. You can also add a comment if you are in the private room. </div>

                              </div>

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

                          </div>

486a1c48   Luigi Serra   selection control...
471
  

a31f0660   root   sevc-controllet i...
472
473
474
475
                          <div class="horizontal layout">

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

                                  <div class="title">

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

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

a31f0660   root   sevc-controllet i...
477
478
479
                                  <paper-material elevation="2" id="idm_layout_main_container" class="area_container">

                                      <paper-material elevation="2" id="idm_layout_container" class="area_container"></paper-material>

                                  </paper-material>

24be6abb   Luigi Serra   selection control...
480
  

a31f0660   root   sevc-controllet i...
481
482
483
                                  <div id="comment">

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

                                  </div>

24be6abb   Luigi Serra   selection control...
484
485
  

                              </div>

a31f0660   root   sevc-controllet i...
486
487
488
  

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

  

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

a31f0660   root   sevc-controllet i...
490
                      </div>

73bcce88   luigser   COMPONENTS
491
  

a31f0660   root   sevc-controllet i...
492
                  </neon-animatable>

73bcce88   luigser   COMPONENTS
493
  

a31f0660   root   sevc-controllet i...
494
              </neon-animated-pages>

73bcce88   luigser   COMPONENTS
495
  

a31f0660   root   sevc-controllet i...
496
              <paper-toast id="message" text=""></paper-toast>

73bcce88   luigser   COMPONENTS
497
  

a31f0660   root   sevc-controllet i...
498
499
500
501
502
              <paper-dialog id="infoDialog">

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

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

                  </paper-dialog-scrollable>

              </paper-dialog>

c011cd54   Luigi Serra   selection control...
503
  

a31f0660   root   sevc-controllet i...
504
          </content>

73bcce88   luigser   COMPONENTS
505
      </template>

74249687   Luigi Serra   Cross browser con...
506
  

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

73bcce88   luigser   COMPONENTS
508
509
510
511
      <script src="../../../DEEPCLIENT/js/deepClient.js"></script>

  

      <script>

  

73bcce88   luigser   COMPONENTS
512
513
514
515
          Polymer({

  

              is : 'data-sevc-controllet',

  

938d1928   Luigi Serra   Update documentat...
516
517
518
              /**

               * Received when the user selects a datalet from slider.

               *

f748e9cf   Luigi Serra   new controllet an...
519
               * @event items-list-controllet_item-selected

938d1928   Luigi Serra   Update documentat...
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
               */

  

              /**

               * 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...
541
542
543
544
545
546
               * Received when the user change text value of the selected datalet layout inputs

               *

               * @event text-element-controllet_content-changed

               */

  

              /**

938d1928   Luigi Serra   Update documentat...
547
548
549
550
551
               * 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
552
              listeners : {

f748e9cf   Luigi Serra   new controllet an...
553
                  'items-list-controllet_item-selected' : '_dataletSelected',

73bcce88   luigser   COMPONENTS
554
                  'draggable-element-controllet_content-dragged' : '_fieldsMapped',

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

a31f0660   root   sevc-controllet i...
556
557
                  'text-element-controllet_content-changed' : '_textElementChanged',

                  'datasetexplorer-datalet_data-url': '_selectDataUrl_treeMap'

73bcce88   luigser   COMPONENTS
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
              },

  

              properties : {

  

                  entryAnimation : {

                      type  : String,

                      value : ""

                  },

  

                  exitAnimation  : {

                      type  : String,

                      value : ""

                  },

  

                  selected       : {

                      type  : Number,

                      value : 0

                  },

  

                  /**

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

73bcce88   luigser   COMPONENTS
579
580
581
582
583
584
585
                   *

                   * @attribute dataUrl

                   * @type string

                   * @default 'null'

                   */

                  dataUrl : {

                      type : String,

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

73bcce88   luigser   COMPONENTS
587
588
589
                      observer : '_dataUrlChanged'

                  },

                  /**

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

73bcce88   luigser   COMPONENTS
591
592
593
594
595
596
597
                   *

                   * @attribute deepUrl

                   * @type string

                   * @default 'null'

                   */

                  deepUrl : {

                      type : String,

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

73bcce88   luigser   COMPONENTS
599
                  },

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

938d1928   Luigi Serra   Update documentat...
601
602
603
604
605
606
                   * It's used to store the list of datalets returned from DEEP

                   *

                   * @attribute datalets_list

                   * @type Array

                   * @default empty

                   */

73bcce88   luigser   COMPONENTS
607
608
609
610
                  datalets_list : {

                      type : Array ,

                      value : []

                  },

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

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

938d1928   Luigi Serra   Update documentat...
613
                   *

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

938d1928   Luigi Serra   Update documentat...
615
616
617
                   * @type String

                   * @default ''

                   */

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

73bcce88   luigser   COMPONENTS
619
                      type : String,

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

73bcce88   luigser   COMPONENTS
621
                  },

938d1928   Luigi Serra   Update documentat...
622
623
624
                  /**

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

                   *

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

938d1928   Luigi Serra   Update documentat...
626
627
628
                   * @type Array

                   * @default empty

                   */

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

73bcce88   luigser   COMPONENTS
630
                      type : Array,

24be6abb   Luigi Serra   selection control...
631
632
633
634
635
636
637
638
                      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
639
                  },

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

035bbee3   Luigi Serra   Datalets and cont...
641
642
                   * 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...
643
                   * @attribute paramsFields

035bbee3   Luigi Serra   Datalets and cont...
644
645
646
                   * @type Object

                   * @default empty

                   */

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

a31f0660   root   sevc-controllet i...
648
649
                      type: Object,

                      value: undefined

035bbee3   Luigi Serra   Datalets and cont...
650
651
                  },

                  /**

938d1928   Luigi Serra   Update documentat...
652
653
654
655
656
657
                   * It's used to store the tab index in the first pass

                   *

                   * @attribute DatasourceTabSelected

                   * @type Number

                   * @default 0

                   */

cb1aab91   Luigi Serra   Controllets update
658
659
660
661
                  DatasourceTabSelected : {

                      type : Number,

                      value : 0

                  },

938d1928   Luigi Serra   Update documentat...
662
663
664
665
666
667
668
                  /**

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

                   *

                   * @attribute datasets

                   * @type Array

                   * @default empty

                   */

cb1aab91   Luigi Serra   Controllets update
669
670
671
                  datasets :

                  {

                      type : Array,

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

73bcce88   luigser   COMPONENTS
673
                  }

73bcce88   luigser   COMPONENTS
674
              },

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

a31f0660   root   sevc-controllet i...
676
               * 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.

938d1928   Luigi Serra   Update documentat...
677
678
679
680
681
682
               * In this phase the scrollbar will be initialized

               *

               * @method handleResponseData

               *

               * @param {Event} e

               */

73bcce88   luigser   COMPONENTS
683
684
685
  

              ready : function(){

  

a31f0660   root   sevc-controllet i...
686
  //                $(this.$.fields_placeholder).perfectScrollbar();

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

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

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

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

73bcce88   luigser   COMPONENTS
691
  

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

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

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

24be6abb   Luigi Serra   selection control...
695
                  }

f4f24b9d   Luigi Serra   containers layout...
696
697
698
699
700
701
702
703
704
705
706
707
708
  

                  //Fiefox force :O

                  var table_params ={

                      component   : "datatable-datalet",

                      params      :{

                          'data-url' : this.dataUrl

                      },

                      fields      : [],

                      placeHolder : this.$.table_component_place_holder

                  };

  

                  ComponentService.deep_url = this.deepUrl;

                  ComponentService.getComponent(table_params);

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

486a1c48   Luigi Serra   selection control...
710
711
712
713
              /**

               * Utility function to inject datalet in a placeholder

               */

              injectDatalet: function(place_holder){

f748e9cf   Luigi Serra   new controllet an...
714
  

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

486a1c48   Luigi Serra   selection control...
716
717
718
719
720
721
                      component   : this.selectedDatalet,

                      params      : this.paramsFields,

                      fields      : this.selectedFields,

                      placeHolder : place_holder

                  };

                  ComponentService.deep_url = this.deepUrl;

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

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

7b2d40bf   Luigi Serra   Selection control...
724
  

73bcce88   luigser   COMPONENTS
725
726
727
728
              /**

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

               *

               * @method handleResponseData

938d1928   Luigi Serra   Update documentat...
729
730
               *

               * @param {Event} e

73bcce88   luigser   COMPONENTS
731
732
               */

              handleResponseData : function(e){

9d4a34db   Luigi Serra   selection control...
733
734
735
                  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
736
737
738
739
740
741
              },

  

              /**

               * Callback to parse the components response object

               *

               * @method handleResponseDatalets

938d1928   Luigi Serra   Update documentat...
742
743
               *

               * @param {Event} e

73bcce88   luigser   COMPONENTS
744
745
746
747
748
               */

              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 ,

a31f0660   root   sevc-controllet i...
749
                          image : e.detail.response[i].url + e.detail.response[i].name + ".png"

73bcce88   luigser   COMPONENTS
750
751
752
753
754
                      };

  

                      this.datalets_list.push(datalet_info);

                  }

  

24be6abb   Luigi Serra   selection control...
755
                  if(this.selectedDatalet == undefined)

a31f0660   root   sevc-controllet i...
756
757
758
759
760
761
                      this.$.visualization_slider_area.innerHTML = '<animated-button-container-controllet height="300" width="450" icon="assessment" icon-width="64" icon-height="64" background-button-color="#2196F3">' +

                              '<items-list-controllet' +

                              ' replace-string="-datalet"' +

                              ' items=\'' + JSON.stringify(this.datalets_list) + '\'>' +

                              '</items-list-controllet>' +

                              '</animated-button-container-controllet>';

24be6abb   Luigi Serra   selection control...
762
                  else

f4f24b9d   Luigi Serra   containers layout...
763
                      this.$.visualization_slider_area.innerHTML = '<animated-button-container-controllet height="300" width="450" icon="assessment" icon-width="64" icon-height="64" background-button-color="#2196F3">' +

31d9a4f6   Luigi Serra   updates
764
                              '<items-list-controllet' +

f748e9cf   Luigi Serra   new controllet an...
765
766
767
768
769
                              ' replace-string="-datalet"' +

                              ' selected-card=\'' + this.selectedDatalet + '\'' +

                              ' items=\'' + JSON.stringify(this.datalets_list) + '\'>' +

                              '</items-list-controllet>' +

                              '</animated-button-container-controllet>';

24be6abb   Luigi Serra   selection control...
770
  

73bcce88   luigser   COMPONENTS
771
              },

938d1928   Luigi Serra   Update documentat...
772
773
774
775
776
777
778
779
              /**

               * 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
780
781
              handleSelectedDatalet : function(e){

  

a31f0660   root   sevc-controllet i...
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
                  var response = e.detail.response;

                  this.$.datalet_idm_fields_container.innerHTML = "";

                  this.$.idm_layout_container.innerHTML = "";

  

                  var input;

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

  

                  if(response.idm.inputs.input.constructor == Object) {

                      if(response.idm.inputs.input.selection == "*")

                      {

                          var fields = this.$.selectedFields_container.querySelectorAll('draggable-element-controllet');

                          input = response.idm.inputs.input;

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

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

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

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

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

                          }

                      }

                  }

  

                  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] + '"';

                          }

                      }

  

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

                      this.$.datalet_idm_fields_container.innerHTML += html;

  

                  }

  

                  if(layouts.input != undefined) {

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

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

                      }

  

                      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;

                  }

  

                  if(this.selectedFields != undefined) this.generateDataletPreview();

24be6abb   Luigi Serra   selection control...
849
  

035bbee3   Luigi Serra   Datalets and cont...
850
851
852
853
854
855
856
857
              },

              /**

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

               *

               * @method generateDataletPreview

               */

              generateDataletPreview : function(){

  

f748e9cf   Luigi Serra   new controllet an...
858
                  var input_mapped_fields = this.$.datalet_idm_fields_container.querySelectorAll('draggable-element-controllet[is-target=true]');

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

035bbee3   Luigi Serra   Datalets and cont...
860
861
862
  

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

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

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

035bbee3   Luigi Serra   Datalets and cont...
864
865
866
                      }

                  }

  

f748e9cf   Luigi Serra   new controllet an...
867
                  var input_layouts_fields = this.$.idm_layout_container.querySelectorAll('text-element-controllet');

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

035bbee3   Luigi Serra   Datalets and cont...
869
870
871
  

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

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

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

035bbee3   Luigi Serra   Datalets and cont...
873
874
875
                      }

                  }

  

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

035bbee3   Luigi Serra   Datalets and cont...
877
  

73bcce88   luigser   COMPONENTS
878
              },

938d1928   Luigi Serra   Update documentat...
879
880
881
882
883
884
885
              /**

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

               *

               * @method validateCurrentPass

               *

               * @param {Number} next_selected_pass

               */

74249687   Luigi Serra   Cross browser con...
886
887
888
889
              validateCurrentPass : function(next_selected_pass){

  

                  switch(next_selected_pass){

                      case 0:

77395397   Luigi Serra   controllets and b...
890
                          this.$.data_url.value = "";

f0ea8ac7   Luigi Serra   controllets and b...
891
892
893
                          this.$.fields_treeview.setAttribute("json-data", null);

                          this.$.fields_treeview.setAttribute("preselected-fields", null);

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

74249687   Luigi Serra   Cross browser con...
894
895
                          return true;

                      case 1:

f0ea8ac7   Luigi Serra   controllets and b...
896
897
898
                          var x = this.$.fields_treeview.getAttribute("json-data");

                          if(this.$.data_url.value == undefined || this.$.fields_treeview.getAttribute('json-data') == "null" || this.$.fields_treeview.getAttribute('json-data') == null){

                              this.$.message.text = "You have to select a dataset to access to pass 2. It's possible that the data you selected are not available.";

74249687   Luigi Serra   Cross browser con...
899
900
901
902
903
904
905
                              this.$.message.show();

                              return false;

                          }else{

                              return true;

                          }

  

                      case 2:

6546f412   Luigi Serra   controllets and b...
906
                          if(this.selectedFields == undefined || this.selectedFields.length == 0){

74249687   Luigi Serra   Cross browser con...
907
908
909
910
                              this.$.message.text = "You have to select a set of fields to access to pass 3.";

                              this.$.message.show();

                              return false;

                          }else{

9bb60e44   Luigi Serra   updates
911
912
                              this.$.datalet_placeholder_2.innerHTML = "";

                              if(this.selectedDatalet != undefined) this.injectDatalet(this.$.datalet_placeholder);

74249687   Luigi Serra   Cross browser con...
913
914
                              return true;

                          }

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

6546f412   Luigi Serra   controllets and b...
916
917
918
919
920
                          if(this.paramsFields == undefined){

                              this.$.message.text = "You have to select a datalet and map the selected fields to datalets fields(by drag and drop) to access to pass 4.";

                              this.$.message.show();

                              return false;

                          }else{

9bb60e44   Luigi Serra   updates
921
                              this.$.datalet_placeholder.innerHTML = "";

6546f412   Luigi Serra   controllets and b...
922
923
924
                              this.injectDatalet(this.$.datalet_placeholder_2);

                              return true;

                          }

74249687   Luigi Serra   Cross browser con...
925
926
927
                  }

  

              },

938d1928   Luigi Serra   Update documentat...
928
929
930
931
932
933
              /**

               * Callback for manage the previous pass button

               *

               * @method _onPrevClick

               *

               */

73bcce88   luigser   COMPONENTS
934
              _onPrevClick : function() {

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

  

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

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

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

73bcce88   luigser   COMPONENTS
940
              },

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

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

938d1928   Luigi Serra   Update documentat...
943
944
945
946
               *

               * @method _onNextClick

               *

               */

73bcce88   luigser   COMPONENTS
947
              _onNextClick : function() {

74249687   Luigi Serra   Cross browser con...
948
  

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

74249687   Luigi Serra   Cross browser con...
950
  

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

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

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

73bcce88   luigser   COMPONENTS
954
              },

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

c011cd54   Luigi Serra   selection control...
956
957
958
959
960
961
962
963
964
               * Callback to manage InfoButton click to give user information about the selected dataset

               *

               */

              _onInfoClick : function(){

  

                  this.$.infoDialog.open();

  

              },

              /**

938d1928   Luigi Serra   Update documentat...
965
966
967
968
969
970
               * Callback related to datasource selection from select menu

               *

               * @method _datasourceSelected

               *

               * @param {Event} e

               */

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

2b235978   Luigi Serra   Controllet cross ...
972
  

a31f0660   root   sevc-controllet i...
973
974
975
                  this.$.data_url.value = this.datasets[parseInt(e.target.id)].url;

                  this.$.infoDialogTitle.innerHTML = this.datasets[parseInt(e.target.id)].name;

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

c011cd54   Luigi Serra   selection control...
976
  

cb1aab91   Luigi Serra   Controllets update
977
              },

938d1928   Luigi Serra   Update documentat...
978
979
980
981
982
983
984
              /**

               * Callback related to data url change

               *

               * @method _dataUrlChanged

               *

               * @param {Event} e

               */

73bcce88   luigser   COMPONENTS
985
986
987
              _dataUrlChanged : function(newValue, oldValue){

                  this.$.data_request.generateRequest();

              },

938d1928   Luigi Serra   Update documentat...
988
989
990
991
992
993
994
              /**

               * 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
995
              _dataletSelected : function(e){

24be6abb   Luigi Serra   selection control...
996
997
998
                  this.selectedDatalet = e.detail.datalet;

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

                  this.$.selectedDatalet_request.generateRequest();

73bcce88   luigser   COMPONENTS
999
1000
  

              },

938d1928   Luigi Serra   Update documentat...
1001
1002
1003
1004
1005
1006
1007
              /**

               * 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
1008
1009
              _fieldsSelected : function(e){

  

a31f0660   root   sevc-controllet i...
1010
1011
1012
                  this.selectedFields = e.detail.fields;

                  this.$.selectedFields_container.innerHTML = "";

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

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

a31f0660   root   sevc-controllet i...
1014
1015
1016
                              '" label="' + e.detail.fields[i].split(",")[e.detail.fields[i].split(",").length -1] +

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

                  }

73bcce88   luigser   COMPONENTS
1017
  

a31f0660   root   sevc-controllet i...
1018
1019
1020
                  var table_params ={

                      component   : "datatable-datalet",

                      params      :{

73bcce88   luigser   COMPONENTS
1021
                          'data-url' : this.dataUrl

a31f0660   root   sevc-controllet i...
1022
1023
1024
1025
                      },

                      fields      : e.detail.fields,

                      placeHolder : this.$.table_component_place_holder

                  };

73bcce88   luigser   COMPONENTS
1026
  

a31f0660   root   sevc-controllet i...
1027
1028
                  ComponentService.deep_url = this.deepUrl;

                  ComponentService.getComponent(table_params);

73bcce88   luigser   COMPONENTS
1029
  

f4f24b9d   Luigi Serra   containers layout...
1030
  

73bcce88   luigser   COMPONENTS
1031
              },

938d1928   Luigi Serra   Update documentat...
1032
1033
1034
1035
1036
1037
1038
              /**

               * 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
1039
1040
              _fieldsMapped : function(e){

  

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

73bcce88   luigser   COMPONENTS
1042
1043
  

              },

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

035bbee3   Luigi Serra   Datalets and cont...
1045
1046
1047
1048
1049
1050
1051
               * 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){

f748e9cf   Luigi Serra   new controllet an...
1052
                  if(this.selected == 3) {

59190a9b   Luigi Serra   update
1053
                      this.generateDataletPreview();

9bb60e44   Luigi Serra   updates
1054
                      this.$.datalet_placeholder.innerHTML = "";

f748e9cf   Luigi Serra   new controllet an...
1055
1056
                      this.injectDatalet(this.$.datalet_placeholder_2);

                  }

035bbee3   Luigi Serra   Datalets and cont...
1057
1058
              },

              /**

938d1928   Luigi Serra   Update documentat...
1059
1060
1061
1062
1063
1064
               * 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
1065
1066
1067
              _handleDatasourceDragOver : function(e){

                  this.$.data_url.value = "";

              },

938d1928   Luigi Serra   Update documentat...
1068
1069
1070
1071
1072
1073
1074
              /**

               * Callback related to the finish button.

               *

               * @method _onFinish

               *

               * @param {Event} e

               */

73bcce88   luigser   COMPONENTS
1075
1076
              _onFinish : function(e){

  

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

dbc787cf   Luigi Serra   Controllet cross ...
1078
1079
1080
1081
1082
                      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
1083
1084
                  var data = {

                      dataUrl : this.dataUrl,

24be6abb   Luigi Serra   selection control...
1085
1086
1087
                      params :  this.paramsFields,

                      fields :  this.selectedFields,

                      datalet : this.selectedDatalet,

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

9bb60e44   Luigi Serra   updates
1089
                      staticData : JSON.stringify(this.$.datalet_placeholder_2.children[1].behavior.data)

73bcce88   luigser   COMPONENTS
1090
1091
1092
1093
                  }

  

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

  

a31f0660   root   sevc-controllet i...
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
              },

  

              //tree map

              _selectDataUrl_treeMap : function(e){

                  var url = e.detail.url;

                  url = url.split('/');

                  var index = url.indexOf('resource')

                  if (index != -1) { // ckan

                      var resourceId = url[index + 1];

                      url = "http://ckan.routetopa.eu/api/action/datastore_search?resource_id=" + resourceId;

  

                  } else

                      url = "sorry, data provider not supported yet";

  

                  this.dataUrl = url;

                  this.DatasourceTabSelected=0;

              },

73bcce88   luigser   COMPONENTS
1111
1112
1113
1114
1115
1116
  

          });

  

      </script>

  

  </dom-module>