Blame view

controllets/data-sevc-controllet/data-sevc-controllet.html 5.88 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
  <link rel="import" href="../page-slider-controllet/page-slider-controllet.html">

a53fbbed   Renato De Donato   select-dataset ne...
9
  

a53fbbed   Renato De Donato   select-dataset ne...
10
  <link rel="import" href="../select-dataset-controllet/select-dataset-controllet.html">

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

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

a53fbbed   Renato De Donato   select-dataset ne...
13
  

938d1928   Luigi Serra   Update documentat...
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
  

89558a41   Renato De Donato   datatype, provide...
22
                  <select-dataset-controllet id="select_dataset" datasets={{datasets}} suggested-datasets={{suggestedDatasets}}></select-dataset-controllet>

0e9aeacd   root   localization l20n
23
  

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

24be6abb   Luigi Serra   selection control...
25
  

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

a31f0660   root   sevc-controllet i...
27
  

89558a41   Renato De Donato   datatype, provide...
28
                  <select-data-controllet id="select_data"></select-data-controllet>

a31f0660   root   sevc-controllet i...
29
  

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

73bcce88   luigser   COMPONENTS
31
  

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

73bcce88   luigser   COMPONENTS
33
  

89558a41   Renato De Donato   datatype, provide...
34
                  <select-visualization-controllet id="select_visualization" deep-url={{deepUrl}} datalets-list-url={{dataletsListUrl}}></select-visualization-controllet>

73bcce88   luigser   COMPONENTS
35
  

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

73bcce88   luigser   COMPONENTS
37
  

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

c011cd54   Luigi Serra   selection control...
39
  

73bcce88   luigser   COMPONENTS
40
      </template>

74249687   Luigi Serra   Cross browser con...
41
  

73bcce88   luigser   COMPONENTS
42
43
      <script>

  

73bcce88   luigser   COMPONENTS
44
45
46
47
          Polymer({

  

              is : 'data-sevc-controllet',

  

73bcce88   luigser   COMPONENTS
48
              listeners : {

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

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

89558a41   Renato De Donato   datatype, provide...
51
52
                  'select-fields-controllet_selected-fields' : '_allowThirdStep',

                  'filters-controllet_filters': '_allowThirdStep'

73bcce88   luigser   COMPONENTS
53
54
55
56
              },

  

              properties : {

  

0f6424fe   root   update new data-s...
57
                  datasets : {

89558a41   Renato De Donato   datatype, provide...
58
                      type : Object,

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

                  },

a31f0660   root   sevc-controllet i...
61
  

e0e4a976   Renato De Donato   data-sevc-control...
62
63
64
65
66
                  suggestedDatasets : {

                      type : Array,

                      value : undefined

                  },

  

89558a41   Renato De Donato   datatype, provide...
67
68
                  deepUrl : {

                      type : String,

0f6424fe   root   update new data-s...
69
                      value : undefined

e0e4a976   Renato De Donato   data-sevc-control...
70
71
                  },

  

89558a41   Renato De Donato   datatype, provide...
72
73
                  dataletsListUrl : {

                      type : String ,

e0e4a976   Renato De Donato   data-sevc-control...
74
75
76
                      value : undefined

                  },

  

6d2a2a1e   Andrea Petta   language handling
77
78
79
                  localization : {

                      type : String,

                      value : "en"

a31f0660   root   sevc-controllet i...
80
81
                  }

  

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

035bbee3   Luigi Serra   Datalets and cont...
83
  

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

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

73bcce88   luigser   COMPONENTS
86
              },

74249687   Luigi Serra   Cross browser con...
87
  

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

                  switch (e.detail.selected) {

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

89558a41   Renato De Donato   datatype, provide...
91
92
93
94
95
96
97
                          this.$.slider.setTitle(ln["slide1Title_" + this.localization], ln["slide1Subtitle_" + this.localization]);

  

                          this.$.slider.chevronLeft("invisible");

                          this.$.slider.chevronRight(false);

  

                          if(this.$.slider.getPrevSelected() == 1)

                              this.$.slider.chevronRight(true);

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

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

89558a41   Renato De Donato   datatype, provide...
100
101
102
103
104
105
106
                          this.$.slider.setTitle(ln["slide2Title_" + this.localization], ln["slide2Subtitle_" + this.localization]);

  

                          this.$.slider.chevronLeft(true);

                          this.$.slider.chevronRight(false);

  

                          if(this.$.slider.getPrevSelected() == 2)

                              this.$.slider.chevronRight(true);

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

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

89558a41   Renato De Donato   datatype, provide...
109
110
111
112
                          this.$.slider.setTitle(ln["slide3Title_" + this.localization], ln["slide3Subtitle_" + this.localization]);

  

                          this.$.slider.chevronLeft(true);

                          this.$.slider.chevronRight("invisible");

74249687   Luigi Serra   Cross browser con...
113
                  }

c011cd54   Luigi Serra   selection control...
114
              },

2b235978   Luigi Serra   Controllet cross ...
115
  

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

a53fbbed   Renato De Donato   select-dataset ne...
117
                  if(e.detail.url == "") {

89558a41   Renato De Donato   datatype, provide...
118
119
                      this.$.slider.chevronRight(false);

                      this.$.select_dataset.$.selected_url.invalid = false;

a53fbbed   Renato De Donato   select-dataset ne...
120
121
122
                      return;

                  }

  

89558a41   Renato De Donato   datatype, provide...
123
                  var that = this;

c011cd54   Luigi Serra   selection control...
124
  

0f6424fe   root   update new data-s...
125
126
127
                  $.ajax({

                      url: e.detail.url,

                      dataType: "json",

89558a41   Renato De Donato   datatype, provide...
128
129
130
131
132
133
134
135
136
137
                      success: function(){

                          that.$.select_dataset.$.selected_url.invalid = false;

                          var f = Object.create(providerFactory);

                          var provider = f.getProvider(e.detail.url);

                          var dataUrl = provider.addLimit(e.detail.url);

                          that.$.select_data.dataUrl = dataUrl;

                          that.$.select_data.init();

                          that.$.select_visualization.dataUrl = dataUrl;

                          that.$.select_visualization.init();

                          that.$.slider.chevronRight(true);

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

0f6424fe   root   update new data-s...
139
                      error: function(){

89558a41   Renato De Donato   datatype, provide...
140
141
                          that.$.slider.chevronRight(false);

                          that.$.select_dataset.$.selected_url.invalid = true;

0f6424fe   root   update new data-s...
142
143
                      }

                  });

707a1508   root   update data-table...
144
145
              },

  

89558a41   Renato De Donato   datatype, provide...
146
147
148
149
150
151
152
153
154
155
156
157
              _allowThirdStep : function(){

                  this.$.slider.chevronRight(false);

                  var fields = this.$.select_data.getSelectedFields();

                  var filters = this.$.select_data.getFilters();

                  var data = this.$.select_data.getData();

                  if(fields.length > 0) {

                      this.$.select_visualization.init();

                      this.$.select_visualization.setFields(fields);

                      this.$.select_visualization.setFilters(filters);

                      this.$.select_visualization.setData(data);

                      this.$.slider.chevronRight(true);

                  }

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

73bcce88   luigser   COMPONENTS
159
160
161
162
163
164
  

          });

  

      </script>

  

  </dom-module>