Blame view

controllets/data-sevc-controllet/data-sevc-controllet.html 7.59 KB
0f6424fe   root   update new data-s...
1
2
3
4
5
  /********************************************************************************************************************************

  <!--<script src="../shared_js/jquery-1.11.2.min.js"></script>-->

  <!--<script src="../../bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>-->

  <script src="../shared_js/perfect-scrollbar/js/min/perfect-scrollbar.jquery.min.js"></script>

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

eae8bcd8   Renato De Donato   localization
6
7
  

  <script defer src="../../bower_components/l20n/dist/compat/web/l20n.min.js"></script>

56945b67   Andrea Petta   l20n bug fix
8
  <script defer src="../../locales/lnHashMap.js"></script>

0f6424fe   root   update new data-s...
9
  /********************************************************************************************************************************

ae17a8dc   Luigi Serra   Controllet and da...
10
  

938d1928   Luigi Serra   Update documentat...
11
  <link rel="import" href="../../bower_components/polymer/polymer.html">

938d1928   Luigi Serra   Update documentat...
12
  

0f6424fe   root   update new data-s...
13
14
15
16
  <link rel="import" href="../page-slider-controllet/page-slider-controllet.html">

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

  <link rel="import" href="../tree-view-multi-table-controllet/tree-view-multi-table-controllet.html" />

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

938d1928   Luigi Serra   Update documentat...
17
18
  

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

73bcce88   luigser   COMPONENTS
19
  

0f6424fe   root   update new data-s...
20
      <template>

74249687   Luigi Serra   Cross browser con...
21
  

0f6424fe   root   update new data-s...
22
          <page-slider-controllet id="slider">

486a1c48   Luigi Serra   selection control...
23
  

0f6424fe   root   update new data-s...
24
              <neon-animatable>

0e9aeacd   root   localization l20n
25
  

e0e4a976   Renato De Donato   data-sevc-control...
26
27
28
                  <template is="dom-if" if={{!modify}}>

                      <dataset-selection-controllet id="dataset_selection" datasets={{datasets}} suggested-datasets={{suggestedDatasets}}></dataset-selection-controllet>

                  </template>

0e9aeacd   root   localization l20n
29
  

0f6424fe   root   update new data-s...
30
              </neon-animatable>

24be6abb   Luigi Serra   selection control...
31
  

0f6424fe   root   update new data-s...
32
              <neon-animatable>

a31f0660   root   sevc-controllet i...
33
  

e0e4a976   Renato De Donato   data-sevc-control...
34
                  <tree-view-multi-table-controllet id="tree_view_multi_table" data-url={{dataUrl}} preselected-fields={{selectedFields}}></tree-view-multi-table-controllet>

a31f0660   root   sevc-controllet i...
35
  

0f6424fe   root   update new data-s...
36
              </neon-animatable>

73bcce88   luigser   COMPONENTS
37
  

0f6424fe   root   update new data-s...
38
              <neon-animatable>

73bcce88   luigser   COMPONENTS
39
  

e8219f9a   Renato De Donato   datalet-mod
40
                  <datalet-selection-controllet id="datalet_selection" deep-url={{deepUrl}} datalets-list-url={{dataletsListUrl}} data-url={{dataUrl}} preselected-datalet={{selectedDatalet}} datalet-preset={{dataletPreset}}></datalet-selection-controllet>

73bcce88   luigser   COMPONENTS
41
  

0f6424fe   root   update new data-s...
42
              </neon-animatable>

73bcce88   luigser   COMPONENTS
43
  

0f6424fe   root   update new data-s...
44
          </page-slider-controllet>

c011cd54   Luigi Serra   selection control...
45
  

73bcce88   luigser   COMPONENTS
46
      </template>

74249687   Luigi Serra   Cross browser con...
47
  

73bcce88   luigser   COMPONENTS
48
49
      <script>

  

73bcce88   luigser   COMPONENTS
50
51
52
53
          Polymer({

  

              is : 'data-sevc-controllet',

  

73bcce88   luigser   COMPONENTS
54
              listeners : {

0f6424fe   root   update new data-s...
55
                  'page-slider-controllet_selected' : '_updateSlider',

707a1508   root   update data-table...
56
57
                  'dataset-selection-controllet_data-url' : '_allowSecondStep',

                  'tree-view-controllet_selected-fields' : '_allowThirdStep'

73bcce88   luigser   COMPONENTS
58
59
60
61
              },

  

              properties : {

  

73bcce88   luigser   COMPONENTS
62
63
                  deepUrl : {

                      type : String,

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

73bcce88   luigser   COMPONENTS
65
                  },

0f6424fe   root   update new data-s...
66
67
68
  

                  dataletsListUrl : {

                      type : String ,

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

73bcce88   luigser   COMPONENTS
70
                  },

0f6424fe   root   update new data-s...
71
72
  

                  datasets : {

73bcce88   luigser   COMPONENTS
73
                      type : Array,

24be6abb   Luigi Serra   selection control...
74
75
                      value : undefined

                  },

a31f0660   root   sevc-controllet i...
76
  

e0e4a976   Renato De Donato   data-sevc-control...
77
78
79
80
81
                  suggestedDatasets : {

                      type : Array,

                      value : undefined

                  },

  

0f6424fe   root   update new data-s...
82
83
84
85
                  dataUrl : {

                      type  : String,

                      value : undefined

                  },

a31f0660   root   sevc-controllet i...
86
  

0f6424fe   root   update new data-s...
87
88
89
                  jsonData : {

                      type  : Object,

                      value : undefined

e0e4a976   Renato De Donato   data-sevc-control...
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
                  },

  

                  modify : {

                      type  : Boolean,

                      value : false

                  },

  

                  selectedDatalet : {

                      type  : String,

                      value : undefined

                  },

  

                  selectedFields : {

                      type  : Array,

                      value : []

                  },

  

                  dataletPreset : {

                      type  : Object,

                      value : []

a31f0660   root   sevc-controllet i...
110
111
                  }

  

035bbee3   Luigi Serra   Datalets and cont...
112
              },

035bbee3   Luigi Serra   Datalets and cont...
113
  

0f6424fe   root   update new data-s...
114
              ready : function(){

e0e4a976   Renato De Donato   data-sevc-control...
115
116
117
118
119
                  if(this.selectedDatalet){

                      this.modify = true;

                      this.$.slider.selected = 1;

  //                    console.log(this.selectedDatalet);

                      this.dataUrl = this.dataletPreset["data-url"];

e0e4a976   Renato De Donato   data-sevc-control...
120
                  }

eae8bcd8   Renato De Donato   localization
121
  

73bcce88   luigser   COMPONENTS
122
              },

74249687   Luigi Serra   Cross browser con...
123
  

0f6424fe   root   update new data-s...
124
125
              _updateSlider : function(e){

                  switch (e.detail.selected) {

74249687   Luigi Serra   Cross browser con...
126
                      case 0:

90890e86   Andrea Petta   l20n bug fix
127
                         /* document.l10n.formatValues('slide1Title', 'slide1Subtitle').then(A => slider.setTitle(A[0], A[1]));*/

56945b67   Andrea Petta   l20n bug fix
128
                          /*document.l10n.formatValues('slide1Title', 'slide1Subtitle').then(function(A){

161c807e   Andrea Petta   l20n bug fix
129
                              slider.setTitle(A[0], A[1])

16032a5e   Andrea Petta   l20n bug fix
130
131
132
                          }, function(reason){

                              var a = reason;

                              console.log(a);

56945b67   Andrea Petta   l20n bug fix
133
134
135
                          });*/

                          slider.setTitle(ln["slide1Title_it"], ln["slide1Subtitle_it"]);

  

0e9aeacd   root   localization l20n
136
  //                        slider.setTitle("SELECT DATASET", "Search or copy and paste the url of dataset.");

707a1508   root   update data-table...
137
                          slider.chevronLeft("invisible");

0f6424fe   root   update new data-s...
138
                          slider.chevronRight(false);

e0e4a976   Renato De Donato   data-sevc-control...
139
140
                          if(slider.getPrevSelected() == 1)

                              slider.chevronRight(true);

e0e4a976   Renato De Donato   data-sevc-control...
141
                          break;

74249687   Luigi Serra   Cross browser con...
142
                      case 1:

90890e86   Andrea Petta   l20n bug fix
143
                          document.l10n.formatValues('slide2Title', 'slide2Subtitle').then(function(A){slider.setTitle(A[0], A[1])});

0e9aeacd   root   localization l20n
144
  //                        slider.setTitle("SELECT DATA", "Select the fields from tree-view. The multi-table will show the values related to the selected fields.");

e0e4a976   Renato De Donato   data-sevc-control...
145
146
                          if(this.modify){

                              slider.chevronLeft("invisible");

0b7cbd33   Renato De Donato   title-desciption
147
  //                            slider.setAvatar("2");

e0e4a976   Renato De Donato   data-sevc-control...
148
149
150
151
                          }

                          else{

                              slider.chevronLeft(true);

                          }

707a1508   root   update data-table...
152
                          slider.chevronRight(false);

0f6424fe   root   update new data-s...
153
                          this.$.tree_view_multi_table.ready();

e0e4a976   Renato De Donato   data-sevc-control...
154
                          this._allowThirdStep({detail: {fields: tree_view_multi_table.getFlatFields()}});

0f6424fe   root   update new data-s...
155
                          break;

74249687   Luigi Serra   Cross browser con...
156
                      case 2:

90890e86   Andrea Petta   l20n bug fix
157
                          document.l10n.formatValues('slide3Title', 'slide3Subtitle').then(function(A){slider.setTitle(A[0], A[1])});

0e9aeacd   root   localization l20n
158
  //                        slider.setTitle("SELECT VISUALIZATION", "Select a visualization, fill out inputs and labels (optional).");

707a1508   root   update data-table...
159
160
                          slider.chevronLeft(true);

                          slider.chevronRight("invisible");

0e9aeacd   root   localization l20n
161
162
                          this.$.datalet_selection.setFields(tree_view_multi_table.getFlatFields());

                          this.$.datalet_selection.ready();

74249687   Luigi Serra   Cross browser con...
163
                  }

c011cd54   Luigi Serra   selection control...
164
              },

2b235978   Luigi Serra   Controllet cross ...
165
  

707a1508   root   update data-table...
166
              _allowSecondStep : function(e){

0f6424fe   root   update new data-s...
167
                  this.dataUrl = e.detail.url;

c011cd54   Luigi Serra   selection control...
168
  

0f6424fe   root   update new data-s...
169
170
171
172
173
174
175
                  $.ajax({

                      url: e.detail.url,

                      dataType: "json",

                      success: function(data){

  //                        this.dataUrl = e.detail.url

  //                        this.jsonData = JSON.stringify(data);

                          slider.chevronRight(true);

a31f0660   root   sevc-controllet i...
176
                      },

0f6424fe   root   update new data-s...
177
178
179
180
181
                      error: function(){

  //                        this.jsonData = undefined;

                          slider.chevronRight(false);

                      }

                  });

e0e4a976   Renato De Donato   data-sevc-control...
182
183
  

                  this.$.datalet_selection.reset();

707a1508   root   update data-table...
184
185
186
187
188
189
190
              },

  

              _allowThirdStep : function(e){

                  if(e.detail.fields.length > 0)

                      slider.chevronRight(true);

                  else

                      slider.chevronRight(false);

0f6424fe   root   update new data-s...
191
              }

73bcce88   luigser   COMPONENTS
192
193
194
195
196
197
  

          });

  

      </script>

  

  </dom-module>