Blame view

controllets/data-sevc-controllet/data-sevc-controllet.html 31.4 KB
73bcce88   luigser   COMPONENTS
1
2
3
4
5
6
7
8
9
10
11
  <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">

cb1aab91   Luigi Serra   Controllets update
12
13
14
15
16
  <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">

74249687   Luigi Serra   Cross browser con...
17
18
  <link rel="import" href="../../bower_components/paper-item/paper-item.html">

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

73bcce88   luigser   COMPONENTS
19
  

74249687   Luigi Serra   Cross browser con...
20
  <link rel="import" href="../items-slider-controllet/items-slider-controllet.html">

73bcce88   luigser   COMPONENTS
21
22
23
24
25
26
  <link rel="import" href="../draggable-element-controllet/draggable-element-controllet.html">

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

  

  

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

      <template>

0b818d7e   Luigi Serra   Selection control...
27
          <link rel="stylesheet" href="../shared_js/perfect-scrollbar/css/perfect-scrollbar.min.css">

74249687   Luigi Serra   Cross browser con...
28
  

73bcce88   luigser   COMPONENTS
29
          <style is="custom-style">

74249687   Luigi Serra   Cross browser con...
30
31
             /* body

              {

73bcce88   luigser   COMPONENTS
32
33
34
35
36
37
                  font-family: RobotoDraft, 'Helvetica Neue', Helvetica, Arial;

                  font-size: 1em;

                  margin: 0;

                  padding: 1.5em;

                  -webkit-tap-highlight-color: rgba(0,0,0,0);

                  -webkit-touch-callout: none;

2b9aa997   Luigi Serra   Bugs fix
38
                  overflow: hidden;

74249687   Luigi Serra   Cross browser con...
39
              }*/

73bcce88   luigser   COMPONENTS
40
  

74249687   Luigi Serra   Cross browser con...
41
42
43
              .flexchild

              {

              @apply(--layout-flex);

73bcce88   luigser   COMPONENTS
44
45
              }

  

74249687   Luigi Serra   Cross browser con...
46
47
48
              .flex2child

              {

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

73bcce88   luigser   COMPONENTS
49
50
              }

  

74249687   Luigi Serra   Cross browser con...
51
52
              .avatar

              {

73bcce88   luigser   COMPONENTS
53
54
55
56
                  display: inline-block;

                  height: 2em;

                  width: 2em;

                  border-radius: 50%;

73bcce88   luigser   COMPONENTS
57
58
59
60
61
62
63
                  background: var(--paper-blue-500);

                  color: white;

                  line-height: 2em;

                  font-size: 1.87em;

                  text-align: center;

              }

  

74249687   Luigi Serra   Cross browser con...
64
65
              .title

              {

73bcce88   luigser   COMPONENTS
66
                  position: relative;

74249687   Luigi Serra   Cross browser con...
67
68
                  top: 0.60vh;

                  margin-left: 20px;

73bcce88   luigser   COMPONENTS
69
70
              }

  

74249687   Luigi Serra   Cross browser con...
71
72
              .big

              {

73bcce88   luigser   COMPONENTS
73
                  font-size: 1.37em;

73bcce88   luigser   COMPONENTS
74
75
76
                  color: var(--google-grey-500);

              }

  

74249687   Luigi Serra   Cross browser con...
77
78
              .medium

              {

73bcce88   luigser   COMPONENTS
79
80
81
82
83
84
                  font-size: 1em;

                  padding-bottom: 0.5em;

                  color : #000000;

                  font-weight: bold;

              }

  

74249687   Luigi Serra   Cross browser con...
85
86
87
88
89
90
91
92
93
94
              .small

              {

                  font-size: 0.8em;

                  padding-top: 10px;

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

                  font-weight: bold;

              }

  

              paper-input

              {

73bcce88   luigser   COMPONENTS
95
96
97
                  width: 80%;

              }

  

74249687   Luigi Serra   Cross browser con...
98
99
              paper-dropdown-menu

              {

cb1aab91   Luigi Serra   Controllets update
100
101
102
103
104
                  text-align: left;

                  margin: auto;

                  width: 100%;

              }

  

74249687   Luigi Serra   Cross browser con...
105
106
              :host ::content paper-menu-button

              {

cb1aab91   Luigi Serra   Controllets update
107
108
109
110
                  display: block;

                  width: 100%;

              }

  

74249687   Luigi Serra   Cross browser con...
111
112
              #visualization_slider_area

              {

73bcce88   luigser   COMPONENTS
113
114
115
116
                  min-width: 670px;

                  min-height: 180px;

              }

  

74249687   Luigi Serra   Cross browser con...
117
118
              #fields_mapping_area

              {

73bcce88   luigser   COMPONENTS
119
                  min-width: 670px;

74249687   Luigi Serra   Cross browser con...
120
                  min-height: 180px;

73bcce88   luigser   COMPONENTS
121
122
              }

  

74249687   Luigi Serra   Cross browser con...
123
124
125
126
              #datalet_placeholder

              {

                  height: 360px;

                  min-height: 360px;

73bcce88   luigser   COMPONENTS
127
  

73bcce88   luigser   COMPONENTS
128
129
              }

  

74249687   Luigi Serra   Cross browser con...
130
131
132
              .datalet_right_container

              {

                  width: 100vh;

73bcce88   luigser   COMPONENTS
133
134
              }

  

74249687   Luigi Serra   Cross browser con...
135
136
137
138
              .field-mapping-card

              {

                  width: 50%;

                  float: left;

73bcce88   luigser   COMPONENTS
139
140
              }

  

74249687   Luigi Serra   Cross browser con...
141
142
              .toolbar_button

              {

73bcce88   luigser   COMPONENTS
143
144
145
146
                  --iron-icon-height: 32px;

                  --iron-icon-width: 32px;

              }

  

74249687   Luigi Serra   Cross browser con...
147
148
149
150
              #finish_button

              {

                  --iron-icon-height: 32px;

                  --iron-icon-width: 32px;

73bcce88   luigser   COMPONENTS
151
152
153
                  color: var(--paper-blue-500);

              }

  

74249687   Luigi Serra   Cross browser con...
154
155
156
              .area_container

              {

                  overflow: hidden;

73bcce88   luigser   COMPONENTS
157
158
159
160
161
162
163
164
165
166
                  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);

              }

  

              #fields_placeholder{

                  width: 40%;

                  height: 50vh;

0b818d7e   Luigi Serra   Selection control...
167
                  position: relative;

73bcce88   luigser   COMPONENTS
168
169
170
171
172
173
174
                  float: left;

                  overflow: auto;

              }

  

              #table_fields_container{

                  height: 50vh;

                  width: 55%;

0b818d7e   Luigi Serra   Selection control...
175
                  position: relative;

73bcce88   luigser   COMPONENTS
176
177
178
179
                  float: left;

                  overflow: auto;

              }

  

74249687   Luigi Serra   Cross browser con...
180
181
              paper-tabs, paper-toolbar

              {

cb1aab91   Luigi Serra   Controllets update
182
183
184
185
186
                  background-color:  var(--paper-blue-500);

                  color: #ffffff;

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

              }

  

74249687   Luigi Serra   Cross browser con...
187
188
              paper-toolbar paper-tabs

              {

cb1aab91   Luigi Serra   Controllets update
189
190
191
192
                  box-shadow: none;

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

              }

  

74249687   Luigi Serra   Cross browser con...
193
194
              paper-tabs[noink][no-bar] paper-tab.iron-selected

              {

cb1aab91   Luigi Serra   Controllets update
195
196
197
                  background-color: var(--google-gray-500);

              }

  

74249687   Luigi Serra   Cross browser con...
198
199
              paper-tabs[align-bottom]

              {

cb1aab91   Luigi Serra   Controllets update
200
201
202
                  box-shadow: 0px -2px 6px rgba(0, 0, 0, 0.15);

              }

  

74249687   Luigi Serra   Cross browser con...
203
204
205
206
207
208
209
210
211
212
213
214
215
216
              #idm_fields_main_container{

                  position: relative;

                  height: 50vh;

              }

  

              #selected_fields_main_container{

                  position: relative;

                  height: 50vh;

              }

  

              paper-menu{

                  width: 100%;

              }

  

73bcce88   luigser   COMPONENTS
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
          </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="selected_datalet_request"

                  url={{deepUrl}}

                  verbose="true"

                  on-response="handleSelectedDatalet"

                  debounce-duration="300">

          </iron-ajax>

  

          <content>

73bcce88   luigser   COMPONENTS
246
  

74249687   Luigi Serra   Cross browser con...
247
              <neon-animated-pages id="pages" selected="[[selected]]" entry-animation="[[entryAnimation]]" exit-animation="[[exitAnimation]]">

73bcce88   luigser   COMPONENTS
248
249
250
  

                  <neon-animatable>

  

74249687   Luigi Serra   Cross browser con...
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
                      <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>

  

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

                                          <paper-textarea id="data_url" label="Dataset api data url" floatingLabel value="{{dataUrl}}" on-dragover="_handleDatasourceDragOver"></paper-textarea>

                                      </div>

  

                                      <div class="card-content">

                                          <paper-dropdown-menu id="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}}</paper-item>

                                                  </template>

                                              </paper-menu>

                                          </paper-dropdown-menu>

                                      </div>

cb1aab91   Luigi Serra   Controllets update
283
  

cb1aab91   Luigi Serra   Controllets update
284
                                  </div>

74249687   Luigi Serra   Cross browser con...
285
286
287
288
                                  <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
289
  

73bcce88   luigser   COMPONENTS
290
291
292
293
294
295
                      </div>

  

                  </neon-animatable>

  

                  <neon-animatable>

  

74249687   Luigi Serra   Cross browser con...
296
297
298
299
300
301
302
303
304
305
306
307
308
                      <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">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>

  

                          <div class="horizontal layout">

73bcce88   luigser   COMPONENTS
309
  

74249687   Luigi Serra   Cross browser con...
310
                              <div id="fields_placeholder" class="area_container flexchild" style="min-width:300px">

73bcce88   luigser   COMPONENTS
311
312
                                  <treeview-controllet id="fields_treeview"></treeview-controllet>

                              </div>

74249687   Luigi Serra   Cross browser con...
313
314
315
  

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

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

73bcce88   luigser   COMPONENTS
316
                              </div>

74249687   Luigi Serra   Cross browser con...
317
  

73bcce88   luigser   COMPONENTS
318
                          </div>

74249687   Luigi Serra   Cross browser con...
319
  

73bcce88   luigser   COMPONENTS
320
321
322
323
                      </div>

  

                  </neon-animatable>

  

74249687   Luigi Serra   Cross browser con...
324
                  <neon-animatable style="height:100vh">

73bcce88   luigser   COMPONENTS
325
  

74249687   Luigi Serra   Cross browser con...
326
                      <div class="vertical justified layout">

73bcce88   luigser   COMPONENTS
327
  

74249687   Luigi Serra   Cross browser con...
328
329
330
331
332
333
                          <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>

73bcce88   luigser   COMPONENTS
334
                              </div>

74249687   Luigi Serra   Cross browser con...
335
336
337
                              <paper-icon-button id="finish_button" on-click="_onFinish" icon="add-circle" alt="Conforms the creation" title="finish"></paper-icon-button>

                          </div>

  

73bcce88   luigser   COMPONENTS
338
  

74249687   Luigi Serra   Cross browser con...
339
340
341
342
343
                          <div class="horizontal layout">

  

                              <div class="">

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

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

73bcce88   luigser   COMPONENTS
344
  

0b818d7e   Luigi Serra   Selection control...
345
                                      <div id="selected_fields_main_container" class="field-mapping-card">

73bcce88   luigser   COMPONENTS
346
347
348
                                          <div class="title">

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

                                          </div>

0b818d7e   Luigi Serra   Selection control...
349
                                          <div id="selected_fields_container" class="area_container"></div>

73bcce88   luigser   COMPONENTS
350
351
                                      </div>

  

0b818d7e   Luigi Serra   Selection control...
352
                                      <div id="idm_fields_main_container" class="field-mapping-card">

73bcce88   luigser   COMPONENTS
353
354
355
                                          <div class="title">

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

                                          </div>

0b818d7e   Luigi Serra   Selection control...
356
                                          <div id="datalet_idm_fields_container" class="area_container"></div>

73bcce88   luigser   COMPONENTS
357
                                      </div>

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

73bcce88   luigser   COMPONENTS
359
360
                              </div>

  

74249687   Luigi Serra   Cross browser con...
361
362
363
364
                              <div class="datalet_right_container">

                                  <div class="vertical justified layout">

                                      <div id="datalet_placeholder" class=""></div>

                                  </div>

73bcce88   luigser   COMPONENTS
365
366
367
                              </div>

  

                          </div>

74249687   Luigi Serra   Cross browser con...
368
  

73bcce88   luigser   COMPONENTS
369
370
371
372
                      </div>

  

                  </neon-animatable>

  

74249687   Luigi Serra   Cross browser con...
373
              </neon-animated-pages>

73bcce88   luigser   COMPONENTS
374
  

74249687   Luigi Serra   Cross browser con...
375
              <paper-toast id="message" text=""></paper-toast>

73bcce88   luigser   COMPONENTS
376
  

73bcce88   luigser   COMPONENTS
377
378
          </content>

      </template>

74249687   Luigi Serra   Cross browser con...
379
  

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

73bcce88   luigser   COMPONENTS
381
382
383
384
      <script src="../../../DEEPCLIENT/js/deepClient.js"></script>

  

      <script>

  

cb1aab91   Luigi Serra   Controllets update
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
          var datasetsPrato = {

              names:[

                  'Consuntivo entrate 2009',

                  'Consuntivo entrate 2010',

                  'Consuntivo entrate 2011',

                  'Consuntivo entrate 2012',

                  'Consuntivo entrate 2014'

              ],

              urls: [

                  'http://ckan.routetopa.eu/api/action/datastore_search?resource_id=07843fc3-07e1-4c66-9be4-fed43ca4a26f&limit=10000',

                  'http://ckan.routetopa.eu/api/action/datastore_search?resource_id=48a4db73-d3d4-4639-bbc2-9c797d0e6cda&limit=10000',

                  'http://ckan.routetopa.eu/api/action/datastore_search?resource_id=a14cc2fb-0c24-48d7-9370-834045797d89&limit=10000',

                  'http://ckan.routetopa.eu/api/action/datastore_search?resource_id=fb32fcb6-5e44-4e52-b132-01c6540ddbee&limit=10000',

                  'http://ckan.routetopa.eu/api/action/datastore_search?resource_id=0cb600fc-19ad-4aaf-9794-1e6ea851840a&limit=10000'

              ]

          }

  

          var datasetsGroeningen = {

              names:[

                  'Vestigingen register gemeente Groningen',

                  'Woonruimte gemeente Groningen'

              ],

              urls: [

                  'http://ckan.routetopa.eu/api/action/datastore_search?resource_id=ba554c1f-02a7-4d76-b449-fb9daa1f8bfd&limit=10000',

                  'http://ckan.routetopa.eu/api/action/datastore_search?resource_id=af7b3916-4347-469a-8354-3c2d559bd92f&limit=10000'

              ]

          }

  

          var datasetsDublin = {

              names:[

                  'SDCC Traffic Cameras',

                  'Derelict Site Register',

                  'Dublin City Council Commencement Notices',

                  'Dublin City Council Planning Applications',

                  'Dun Laoghaire-Rathdown County Council Planning Application 2008-2014',

                  'Fingal Council Planning Applications for last 7 years',

                  'Planning Register',

                  'Fingal Development Plan 2011-2017 Record of Protected Structures'

              ],

              urls: [

                  'http://ckan.routetopa.eu/api/action/datastore_search?resource_id=73e02092-85a1-434e-85fe-0c9a43aa9a52&limit=10000',

                  'http://ckan.routetopa.eu/api/action/datastore_search?resource_id=fcbee83e-3d3d-4303-a568-24dd33d02adc&limit=10000',

                  'http://ckan.routetopa.eu/api/action/datastore_search?resource_id=ee00de68-f2e4-482f-a003-3c0561351075&limit=10000',

                  'http://ckan.routetopa.eu/api/action/datastore_search?resource_id=2f4a9d44-b52f-4c8b-a5db-d8f4a676d81e&limit=10000',

                  'http://ckan.routetopa.eu/api/action/datastore_search?resource_id=c479f061-9638-489d-ac55-0c68765548ff&limit=10000',

                  'http://ckan.routetopa.eu/api/action/datastore_search?resource_id=d29a477a-4734-43ef-8002-048c8640d441&limit=10000',

                  'http://ckan.routetopa.eu/api/action/datastore_search?resource_id=2b23f32d-e27e-4eef-af1e-27e05103df7d&limit=10000',

                  'http://ckan.routetopa.eu/api/action/datastore_search?resource_id=5ea813bc-fdf9-4edb-b3b1-0142b593d5c6&limit=10000',

              ]

          }

  

          var AvailableDatasets = [datasetsPrato, datasetsGroeningen, datasetsDublin]

  

  

73bcce88   luigser   COMPONENTS
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
          Polymer({

  

              is : 'data-sevc-controllet',

  

              listeners : {

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

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

                  'treeview-controllet-fileds-selected' : '_fieldsSelected'

              },

  

              properties : {

  

                  entryAnimation : {

                      type  : String,

                      value : ""

                  },

  

                  exitAnimation  : {

                      type  : String,

                      value : ""

                  },

  

                  selected       : {

                      type  : Number,

                      value : 0

                  },

  

                  /**

                   * It represent the data url from CKAN api

                   *

                   * @attribute dataUrl

                   * @type string

                   * @default 'null'

                   */

                  dataUrl : {

                      type : String,

cb1aab91   Luigi Serra   Controllets update
475
                      value : "",/*"http://demo.ckan.org/api/action/datastore_search?resource_id=8324a4c9-66d6-47bf-a898-94237cc39b9f&limit=50",*/

73bcce88   luigser   COMPONENTS
476
477
478
479
480
481
482
483
484
485
486
                      observer : '_dataUrlChanged'

                  },

                  /**

                   * It represent the DEEP url to get information about the datalets

                   *

                   * @attribute deepUrl

                   * @type string

                   * @default 'null'

                   */

                  deepUrl : {

                      type : String,

cb1aab91   Luigi Serra   Controllets update
487
                      value : ""

73bcce88   luigser   COMPONENTS
488
489
                  },

  

8bada91f   Luigi Serra   Controllets and D...
490
491
                  organization : {

                      type : Number,

2b9aa997   Luigi Serra   Bugs fix
492
                      value : 2

8bada91f   Luigi Serra   Controllets and D...
493
494
                  },

  

73bcce88   luigser   COMPONENTS
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
                  datalet_query : {

                      type : String,

                      value : ""

                  },

  

                  datalets_list : {

                      type : Array ,

                      value : []

                  },

  

                  selected_datalet : {

                      type : String,

                      value : ""

                  },

  

                  selected_fields : {

                      type : Array,

                      value : []

cb1aab91   Luigi Serra   Controllets update
513
514
515
516
517
518
519
520
521
522
                  },

  

                  DatasourceTabSelected : {

                      type : Number,

                      value : 0

                  },

  

                  datasets :

                  {

                      type : Array,

8bada91f   Luigi Serra   Controllets and D...
523
                      value : AvailableDatasets[0].names

cb1aab91   Luigi Serra   Controllets update
524
525
526
527
528
                  },

  

                  datasets_urls :

                  {

                      type : Array,

8bada91f   Luigi Serra   Controllets and D...
529
                      value :AvailableDatasets[0].urls

73bcce88   luigser   COMPONENTS
530
531
532
533
534
535
                  }

  

              },

  

              ready : function(){

  

8bada91f   Luigi Serra   Controllets and D...
536
537
538
                  this.datasets = AvailableDatasets[this.organization].names;

                  this.datasets_urls = AvailableDatasets[this.organization].urls;

  

0b818d7e   Luigi Serra   Selection control...
539
540
541
542
                  $(this.$.fields_placeholder).perfectScrollbar();

                  $(this.$.selected_fields_main_container).perfectScrollbar();

                  $(this.$.idm_fields_main_container).perfectScrollbar();

                  $(this.$.table_fields_container).perfectScrollbar();

73bcce88   luigser   COMPONENTS
543
  

7b2d40bf   Luigi Serra   Selection control...
544
545
              },

  

73bcce88   luigser   COMPONENTS
546
547
548
549
550
551
552
553
              /**

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

               *

               * @method handleResponseData

               */

              handleResponseData : function(e){

  

                  this.$.fields_treeview.init(e.detail.response);

74249687   Luigi Serra   Cross browser con...
554
555
  

                  /*var table_params ={

73bcce88   luigser   COMPONENTS
556
557
558
559
560
                      component   : "datatable-datalet",

                      params      :{

                          'data-url' : this.dataUrl

                      },

                      fields      : [],

74249687   Luigi Serra   Cross browser con...
561
                      placeHolder : (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
562
563
564
                  };

  

                  ComponentService.deep_url = this.deepUrl;

74249687   Luigi Serra   Cross browser con...
565
                  ComponentService.getComponent(table_params);*/

73bcce88   luigser   COMPONENTS
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
  

              },

  

              /**

               * Callback to parse the components response object

               *

               * @method handleResponseDatalets

               */

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

                  }

  

0b818d7e   Luigi Serra   Selection control...
584
                  /*var w = $(this.$.visualization_slider_area).width();

73bcce88   luigser   COMPONENTS
585
                  var pages = 2;

0b818d7e   Luigi Serra   Selection control...
586
                  var numItemsPerPage = 3;*/

73bcce88   luigser   COMPONENTS
587
588
  

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

0b818d7e   Luigi Serra   Selection control...
589
                                                               '\'></items-slider-controllet>';

73bcce88   luigser   COMPONENTS
590
591
592
593
594
595
596
              },

  

              handleSelectedDatalet : function(e){

  

                 var response = e.detail.response;

                 //<draggable-element-controllet is-target="true" heading="Field 1"  description="This fields is used for ..." number="1"></draggable-element-controllet>

                 this.$.datalet_idm_fields_container.innerHTML = "";

73bcce88   luigser   COMPONENTS
597
  

a619e8e4   Luigi Serra   Selection control...
598
599
600
601
602
                 if(response.idm.inputs.input.constructor == Object) {

                     var input = response.idm.inputs.input;

                     if(input.selection == "*") {

                         var input_selected_fields = Polymer.dom(this.$.selected_fields_container).querySelectorAll('draggable-element-controllet');

                         for (var j = 0; j < input_selected_fields.length; j++) {

74249687   Luigi Serra   Cross browser con...
603
                             this.$.datalet_idm_fields_container.innerHTML += '<draggable-element-controllet is-target="true" heading="Field ' + (j + 1) + '"  description="' + input.description + '" number="' + (j + 1) + '"></draggable-element-controllet><br>';

a619e8e4   Luigi Serra   Selection control...
604
605
                         }

                     }

74249687   Luigi Serra   Cross browser con...
606
607
608
609
610
                 }else{

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

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

                         this.$.datalet_idm_fields_container.innerHTML += '<draggable-element-controllet is-target="true" id="' + input.name + '" heading="' + input.name + '"  description="' + input.description + '" number="' + (i + 1) + '"></draggable-element-controllet><br>';

                     }

a619e8e4   Luigi Serra   Selection control...
611
612
                 }

  

73bcce88   luigser   COMPONENTS
613
614
615
616
617
618
619
620
621
622
623
624
              },

  

              assignToolbar : function(){

                  this.$.toolbar_number.innerHTML = (this.selected + 1);

                  switch(this.selected){

                     case 0:

                         this.$.toolbar_title.innerHTML  = "Dataset source";

                         this.$.toolbar_description.innerHTML = "Copy and paste/drag and drop in the textarea the url of datasource";

                         break;

                     case 1:

                         this.$.toolbar_title.innerHTML  = "Data fields selection";

                         this.$.toolbar_description.innerHTML = "Select the fields you want to visualize";

73bcce88   luigser   COMPONENTS
625
626
627
628
                         break;

                     case 2:

                         this.$.toolbar_title.innerHTML  = "Data mapping";

                         this.$.toolbar_description.innerHTML = "Select the visualization from the slider, drag and drop the selected fields in visualization parameter area, customize the visualization if you need";

73bcce88   luigser   COMPONENTS
629
630
631
632
633
634
635
636
637
                         break;

                      case 3:

                          this.$.toolbar_title.innerHTML  = "Finish";

                          this.$.toolbar_description.innerHTML = "Confirms the creation of the datalet";

  

                          break;

                 }

              },

  

74249687   Luigi Serra   Cross browser con...
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
              validateCurrentPass : function(next_selected_pass){

  

                  switch(next_selected_pass){

                      case 0:

                          return true;

                      case 1:

                          if(this.$.data_url.value == ""){

                              this.$.message.text = "You have to select a dataset to access to pass 2.";

                              this.$.message.show();

                              return false;

                          }else{

                              return true;

                          }

  

                      case 2:

                          if(Polymer.dom(this.$.selected_fields_container).querySelectorAll('draggable-element-controllet') == 0){

                              this.$.message.text = "You have to select a set of fields to access to pass 3.";

                              this.$.message.show();

                              return false;

                          }else{

                              return true;

                          }

                  }

  

              },

  

73bcce88   luigser   COMPONENTS
664
              _onPrevClick : function() {

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

  

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

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

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

74249687   Luigi Serra   Cross browser con...
670
                  //this.assignToolbar();

73bcce88   luigser   COMPONENTS
671
672
673
              },

  

              _onNextClick : function() {

74249687   Luigi Serra   Cross browser con...
674
675
676
  

                  if(!this.validateCurrentPass(this.selected === 2 ? 2 : (this.selected + 1))) return;

  

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

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

                  this.selected = this.selected === 2 ? 2 : (this.selected + 1);

74249687   Luigi Serra   Cross browser con...
680
                  //this.assignToolbar();

73bcce88   luigser   COMPONENTS
681
682
              },

  

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

74249687   Luigi Serra   Cross browser con...
684
685
686
                 if(Object.getPrototypeOf(e) !== CustomEvent.prototype) {

                    e = e[Object.keys(e)[0]];

                 }

cb1aab91   Luigi Serra   Controllets update
687
  

74249687   Luigi Serra   Cross browser con...
688
                 this.$.data_url.value = this.datasets_urls[parseInt(e.target.id)];

cb1aab91   Luigi Serra   Controllets update
689
690
              },

  

73bcce88   luigser   COMPONENTS
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
              _dataUrlChanged : function(newValue, oldValue){

                  this.$.data_request.generateRequest();

              },

  

              _dataletSelected : function(e){

                  this.selected_datalet = e.detail.datalet;

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

                  this.$.selected_datalet_request.generateRequest();

  

              },

  

              _fieldsSelected : function(e){

  

                   this.$.selected_fields_container.innerHTML = "";

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

                      this.$.selected_fields_container.innerHTML += '<draggable-element-controllet identifier="' + e.detail.fields[i] +

                                                                                                   '" label="' + e.detail.fields[i].split(",")[e.detail.fields[i].split(",").length -1] +

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

                   }

  

74249687   Luigi Serra   Cross browser con...
711
712
                   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
713
714
715
716
717
718
                   var table_params ={

                       component   : "datatable-datalet",

                       params      :{

                          'data-url' : this.dataUrl

                       },

                       fields      : e.detail.fields,

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

73bcce88   luigser   COMPONENTS
720
721
722
723
724
725
726
727
728
729
730
731
                   };

  

                   ComponentService.deep_url = this.deepUrl;

                   ComponentService.getComponent(table_params);

  

              },

  

              _fieldsMapped : function(e){

  

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

                  this.selected_fields = Array();

  

a619e8e4   Luigi Serra   Selection control...
732
733
                  for (var i = 0; i < input_mapped_fields.length; i++) {

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

73bcce88   luigser   COMPONENTS
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
                          this.selected_fields.push(input_mapped_fields[i].value);

                      }

                  }

  

                  var datalet_params ={

                      component   : this.selected_datalet,

                      params      :{

                          'data-url' : this.dataUrl

                      },

                      fields      : this.selected_fields,

                      placeHolder : this.$.datalet_placeholder

                  };

  

                  var datalet_finish_params ={

                      component   : this.selected_datalet,

                      params      :{

                          'data-url' : this.dataUrl

                      },

                      fields      : this.selected_fields,

                      placeHolder : this.$.datalet_created_placehorder

                  };

  

                  ComponentService.deep_url = this.deepUrl;

  

                  ComponentService.getComponent(datalet_params);

                  ComponentService.getComponent(datalet_finish_params);

  

              },

  

              _handleDatasourceDragOver : function(e){

                  this.$.data_url.value = "";

              },

  

              _onFinish : function(e){

  

                  var data = {

                      dataUrl : this.dataUrl,

                      fields : this.selected_fields,

                      datalet : this.selected_datalet

                  }

  

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

  

              }

  

          });

  

      </script>

  

  </dom-module>