Blame view

controllets/data-sevc-controllet/data-sevc-controllet.html 7.15 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" />

fb05b400   Renato De Donato   controllet 2.0, n...
11
12
  <link rel="import" href="../select-visualization-controllet/select-visualization-controllet.html" />

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

938d1928   Luigi Serra   Update documentat...
13
14
  

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

73bcce88   luigser   COMPONENTS
15
  

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

74249687   Luigi Serra   Cross browser con...
17
  

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

486a1c48   Luigi Serra   selection control...
19
  

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

0e9aeacd   root   localization l20n
21
  

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

66cd5ab7   Andrea Petta   dataset explorer ...
23
                      <dataset-selection-controllet id="select_dataset" data={{data}} datasets={{datasets}} suggested-datasets={{suggestedDatasets}}></dataset-selection-controllet>

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

0e9aeacd   root   localization l20n
25
  

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

24be6abb   Luigi Serra   selection control...
27
  

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

a31f0660   root   sevc-controllet i...
29
  

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

a31f0660   root   sevc-controllet i...
31
  

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

73bcce88   luigser   COMPONENTS
33
  

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

73bcce88   luigser   COMPONENTS
35
  

fb05b400   Renato De Donato   controllet 2.0, n...
36
37
                  <!--<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>-->

                  <select-visualization-controllet id="select_visualization" deep-url={{deepUrl}} datalets-list-url={{dataletsListUrl}} data-url={{dataUrl}} preselected-datalet={{selectedDatalet}} datalet-preset={{dataletPreset}}></select-visualization-controllet>

73bcce88   luigser   COMPONENTS
38
  

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

73bcce88   luigser   COMPONENTS
40
  

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

c011cd54   Luigi Serra   selection control...
42
  

73bcce88   luigser   COMPONENTS
43
      </template>

74249687   Luigi Serra   Cross browser con...
44
  

73bcce88   luigser   COMPONENTS
45
46
      <script>

  

73bcce88   luigser   COMPONENTS
47
48
49
50
          Polymer({

  

              is : 'data-sevc-controllet',

  

73bcce88   luigser   COMPONENTS
51
              listeners : {

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

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

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

73bcce88   luigser   COMPONENTS
55
56
57
58
              },

  

              properties : {

  

73bcce88   luigser   COMPONENTS
59
60
                  deepUrl : {

                      type : String,

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

73bcce88   luigser   COMPONENTS
62
                  },

0f6424fe   root   update new data-s...
63
64
65
  

                  dataletsListUrl : {

                      type : String ,

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

73bcce88   luigser   COMPONENTS
67
                  },

0f6424fe   root   update new data-s...
68
69
  

                  datasets : {

73bcce88   luigser   COMPONENTS
70
                      type : Array,

24be6abb   Luigi Serra   selection control...
71
72
                      value : undefined

                  },

a31f0660   root   sevc-controllet i...
73
  

e0e4a976   Renato De Donato   data-sevc-control...
74
75
76
77
78
                  suggestedDatasets : {

                      type : Array,

                      value : undefined

                  },

  

0f6424fe   root   update new data-s...
79
80
81
82
                  dataUrl : {

                      type  : String,

                      value : undefined

                  },

a31f0660   root   sevc-controllet i...
83
  

0f6424fe   root   update new data-s...
84
85
86
                  jsonData : {

                      type  : Object,

                      value : undefined

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

  

                  modify : {

                      type  : Boolean,

                      value : false

                  },

  

                  selectedDatalet : {

                      type  : String,

                      value : undefined

                  },

  

                  selectedFields : {

                      type  : Array,

                      value : []

                  },

  

                  dataletPreset : {

                      type  : Object,

                      value : []

6d2a2a1e   Andrea Petta   language handling
107
108
109
110
111
                  },

  

                  localization : {

                      type : String,

                      value : "en"

a31f0660   root   sevc-controllet i...
112
113
                  }

  

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

035bbee3   Luigi Serra   Datalets and cont...
115
  

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

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

                      this.modify = true;

                      this.$.slider.selected = 1;

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

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

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

73bcce88   luigser   COMPONENTS
123
              },

74249687   Luigi Serra   Cross browser con...
124
  

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

                  switch (e.detail.selected) {

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

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

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

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

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

                              slider.chevronRight(true);

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

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

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

e0e4a976   Renato De Donato   data-sevc-control...
136
137
                          if(this.modify){

                              slider.chevronLeft("invisible");

e0e4a976   Renato De Donato   data-sevc-control...
138
139
140
141
                          }

                          else{

                              slider.chevronLeft(true);

                          }

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

7a8b7446   Renato De Donato   filters data-sevc
143
144
145
146
                          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...
147
                          break;

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

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

707a1508   root   update data-table...
150
151
                          slider.chevronLeft(true);

                          slider.chevronRight("invisible");

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

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

                          this.$.select_visualization.ready();

74249687   Luigi Serra   Cross browser con...
155
                  }

c011cd54   Luigi Serra   selection control...
156
              },

2b235978   Luigi Serra   Controllet cross ...
157
  

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

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

c011cd54   Luigi Serra   selection control...
160
  

0f6424fe   root   update new data-s...
161
162
163
164
165
166
167
                  $.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
168
                          select_dataset.$.selected_url.invalid = false;

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

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

  //                        this.jsonData = undefined;

                          slider.chevronRight(false);

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

0f6424fe   root   update new data-s...
174
175
                      }

                  });

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

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

707a1508   root   update data-table...
178
179
180
181
182
183
184
              },

  

              _allowThirdStep : function(e){

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

                      slider.chevronRight(true);

                  else

                      slider.chevronRight(false);

7a8b7446   Renato De Donato   filters data-sevc
185
186
  

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

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

73bcce88   luigser   COMPONENTS
188
189
190
191
192
193
  

          });

  

      </script>

  

  </dom-module>