Blame view

controllets/data-sevc-controllet/data-sevc-controllet.html 6.77 KB
0f6424fe   root   update new data-s...
1
2
  <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
3
  

052ca020   Andrea Petta   controllet langua...
4
  <script src="../../locales/controllet_ln.js"></script>

6d2a2a1e   Andrea Petta   language handling
5
  

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

938d1928   Luigi Serra   Update documentat...
7
  

0f6424fe   root   update new data-s...
8
9
  <link rel="import" href="../page-slider-controllet/page-slider-controllet.html">

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

7a8b7446   Renato De Donato   filters data-sevc
10
  <link rel="import" href="../select-data-controllet/select-data-controllet.html" />

0f6424fe   root   update new data-s...
11
  <link rel="import" href="../datalet-selection-controllet/datalet-selection-controllet.html">

938d1928   Luigi Serra   Update documentat...
12
13
  

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

73bcce88   luigser   COMPONENTS
14
  

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

74249687   Luigi Serra   Cross browser con...
16
  

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

486a1c48   Luigi Serra   selection control...
18
  

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

0e9aeacd   root   localization l20n
20
  

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

7a8b7446   Renato De Donato   filters data-sevc
22
                      <dataset-selection-controllet id="select_dataset" datasets={{datasets}} suggested-datasets={{suggestedDatasets}}></dataset-selection-controllet>

e0e4a976   Renato De Donato   data-sevc-control...
23
                  </template>

0e9aeacd   root   localization l20n
24
  

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

24be6abb   Luigi Serra   selection control...
26
  

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

a31f0660   root   sevc-controllet i...
28
  

7a8b7446   Renato De Donato   filters data-sevc
29
                  <select-data-controllet id="select_data" data-url={{dataUrl}} preselected-fields={{selectedFields}} datalet-preset="{{dataletPreset}}"></select-data-controllet>

a31f0660   root   sevc-controllet i...
30
  

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

73bcce88   luigser   COMPONENTS
32
  

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

73bcce88   luigser   COMPONENTS
34
  

7a8b7446   Renato De Donato   filters data-sevc
35
                  <datalet-selection-controllet id="select_visualization" deep-url={{deepUrl}} datalets-list-url={{dataletsListUrl}} data-url={{dataUrl}} preselected-datalet={{selectedDatalet}} datalet-preset={{dataletPreset}}></datalet-selection-controllet>

73bcce88   luigser   COMPONENTS
36
  

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

73bcce88   luigser   COMPONENTS
38
  

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

c011cd54   Luigi Serra   selection control...
40
  

73bcce88   luigser   COMPONENTS
41
      </template>

74249687   Luigi Serra   Cross browser con...
42
  

73bcce88   luigser   COMPONENTS
43
44
      <script>

  

73bcce88   luigser   COMPONENTS
45
46
47
48
          Polymer({

  

              is : 'data-sevc-controllet',

  

73bcce88   luigser   COMPONENTS
49
              listeners : {

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

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

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

73bcce88   luigser   COMPONENTS
53
54
55
56
              },

  

              properties : {

  

73bcce88   luigser   COMPONENTS
57
58
                  deepUrl : {

                      type : String,

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

73bcce88   luigser   COMPONENTS
60
                  },

0f6424fe   root   update new data-s...
61
62
63
  

                  dataletsListUrl : {

                      type : String ,

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

73bcce88   luigser   COMPONENTS
65
                  },

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

                  datasets : {

73bcce88   luigser   COMPONENTS
68
                      type : Array,

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

                  },

a31f0660   root   sevc-controllet i...
71
  

e0e4a976   Renato De Donato   data-sevc-control...
72
73
74
75
76
                  suggestedDatasets : {

                      type : Array,

                      value : undefined

                  },

  

0f6424fe   root   update new data-s...
77
78
79
80
                  dataUrl : {

                      type  : String,

                      value : undefined

                  },

a31f0660   root   sevc-controllet i...
81
  

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

                      type  : Object,

                      value : undefined

e0e4a976   Renato De Donato   data-sevc-control...
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
                  },

  

                  modify : {

                      type  : Boolean,

                      value : false

                  },

  

                  selectedDatalet : {

                      type  : String,

                      value : undefined

                  },

  

                  selectedFields : {

                      type  : Array,

                      value : []

                  },

  

                  dataletPreset : {

                      type  : Object,

                      value : []

6d2a2a1e   Andrea Petta   language handling
105
106
107
108
109
                  },

  

                  localization : {

                      type : String,

                      value : "en"

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
                  if(this.selectedDatalet){

                      this.modify = true;

                      this.$.slider.selected = 1;

e0e4a976   Renato De Donato   data-sevc-control...
118
                      this.dataUrl = this.dataletPreset["data-url"];

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

6d2a2a1e   Andrea Petta   language handling
120
                  ln["localization"] = this.localization;

73bcce88   luigser   COMPONENTS
121
              },

74249687   Luigi Serra   Cross browser con...
122
  

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

                  switch (e.detail.selected) {

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

6d2a2a1e   Andrea Petta   language handling
126
                          slider.setTitle(ln["slide1Title_" + this.localization], ln["slide1Subtitle_" + this.localization]);

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

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

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

                              slider.chevronRight(true);

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

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

6d2a2a1e   Andrea Petta   language handling
133
                          slider.setTitle(ln["slide2Title_" + this.localization], ln["slide2Subtitle_" + this.localization]);

e0e4a976   Renato De Donato   data-sevc-control...
134
135
                          if(this.modify){

                              slider.chevronLeft("invisible");

e0e4a976   Renato De Donato   data-sevc-control...
136
137
138
139
                          }

                          else{

                              slider.chevronLeft(true);

                          }

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

7a8b7446   Renato De Donato   filters data-sevc
141
142
143
144
                          this.$.select_data.ready();

  //                        this.async(function () {this.dataletPreset["filters"] = undefined;}, 1000);

                          this._allowThirdStep({detail: {fields: select_data.getFlatFields()}});

                          this._allowThirdStep({detail: {fields: select_data.getFlatFields()}});

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

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

6d2a2a1e   Andrea Petta   language handling
147
                          slider.setTitle(ln["slide3Title_" + this.localization], ln["slide3Subtitle_" + this.localization]);

707a1508   root   update data-table...
148
149
                          slider.chevronLeft(true);

                          slider.chevronRight("invisible");

7a8b7446   Renato De Donato   filters data-sevc
150
151
152
                          this.$.select_visualization.setFields(select_data.getFlatFields());

                          this.$.select_visualization.setFilters(select_data.getFilters());

                          this.$.select_visualization.ready();

74249687   Luigi Serra   Cross browser con...
153
                  }

c011cd54   Luigi Serra   selection control...
154
              },

2b235978   Luigi Serra   Controllet cross ...
155
  

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

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

c011cd54   Luigi Serra   selection control...
158
  

0f6424fe   root   update new data-s...
159
160
161
162
163
164
165
                  $.ajax({

                      url: e.detail.url,

                      dataType: "json",

                      success: function(data){

  //                        this.dataUrl = e.detail.url

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

                          slider.chevronRight(true);

7a8b7446   Renato De Donato   filters data-sevc
166
                          select_dataset.$.selected_url.invalid = false;

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

0f6424fe   root   update new data-s...
168
169
170
                      error: function(){

  //                        this.jsonData = undefined;

                          slider.chevronRight(false);

7a8b7446   Renato De Donato   filters data-sevc
171
                          select_dataset.$.selected_url.invalid = true;

0f6424fe   root   update new data-s...
172
173
                      }

                  });

e0e4a976   Renato De Donato   data-sevc-control...
174
  

7a8b7446   Renato De Donato   filters data-sevc
175
                  this.$.select_visualization.reset();

707a1508   root   update data-table...
176
177
178
179
180
181
182
              },

  

              _allowThirdStep : function(e){

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

                      slider.chevronRight(true);

                  else

                      slider.chevronRight(false);

7a8b7446   Renato De Donato   filters data-sevc
183
184
  

                  //this.$.select_visualization.reset();

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

73bcce88   luigser   COMPONENTS
186
187
188
189
190
191
  

          });

  

      </script>

  

  </dom-module>