Blame view

controllets/data-sevc-controllet/co-datalets-creator-controllet.html 4.32 KB
89558a41   Renato De Donato   datatype, provide...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
  <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">

  

  <script src="../../locales/controllet_ln.js"></script>

  

  <link rel="import" href="../../bower_components/polymer/polymer.html">

  

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

  

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

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

  

  <dom-module id="co-datalets-creator-controllet">

  

      <template>

  

          <page-slider-controllet id="slider">

  

              <neon-animatable>

  

4f438cd9   Renato De Donato   datalets-modifier
21
                  <select-data-controllet id="select_data"></select-data-controllet>

89558a41   Renato De Donato   datatype, provide...
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
  

              </neon-animatable>

  

              <neon-animatable>

  

                  <select-visualization-controllet id="select_visualization" deep-url={{deepUrl}} datalets-list-url={{dataletsListUrl}}></select-visualization-controllet>

  

              </neon-animatable>

  

          </page-slider-controllet>

  

      </template>

  

      <script>

  

          Polymer({

  

              is : 'co-datalets-creator-controllet',

  

              listeners : {

                  'page-slider-controllet_selected' : '_updateSlider',

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

256ece27   Renato De Donato   new controllet
44
45
                  'filters-controllet_filters': '_allowThirdStep',

                  'aggregators-controllet_aggregators': '_allowThirdStep'

89558a41   Renato De Donato   datatype, provide...
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
              },

  

              properties : {

  

                  dataUrl : {

                      type  : String,

                      value : undefined

                  },

  

                  data : {

                      type : Array,

                      value : []

                  },

  

                  deepUrl : {

                      type : String,

                      value : undefined

                  },

  

                  dataletsListUrl : {

                      type : String ,

                      value : undefined

                  },

  

                  localization : {

                      type : String,

                      value : "en"

                  }

  

              },

  

              ready : function(){

                  ln["localization"] = this.localization;

  

4f438cd9   Renato De Donato   datalets-modifier
80
                  this.$.select_data.data = this.data;

3b5f4868   Renato De Donato   co-datalets-creator
81
                  this.$.select_data.dataUrl = this.dataUrl;

89558a41   Renato De Donato   datatype, provide...
82
                  this.$.select_data.init();

3b5f4868   Renato De Donato   co-datalets-creator
83
84
                  this.$.select_visualization.dataUrl = this.dataUrl;

                  this.$.select_visualization.init();

89558a41   Renato De Donato   datatype, provide...
85
86
87
88
89
90
91
92
93
94
              },

  

              _updateSlider : function(e){

                  switch (e.detail.selected) {

                      case 0:

                          this.$.slider.setTitle(ln["slide2Title_" + this.localization], ln["slide2Subtitle_" + this.localization]);

  

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

                          this.$.slider.chevronRight(false);

  

3b5f4868   Renato De Donato   co-datalets-creator
95
                          if(this.$.slider.getPrevSelected() == 1)

89558a41   Renato De Donato   datatype, provide...
96
97
98
99
100
101
102
103
104
105
106
107
                              this.$.slider.chevronRight(true);

                          break;

                      case 1:

                          this.$.slider.setTitle(ln["slide3Title_" + this.localization], ln["slide3Subtitle_" + this.localization]);

  

                          this.$.slider.chevronLeft(true);

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

                  }

              },

  

              _allowThirdStep : function(){

                  this.$.slider.chevronRight(false);

256ece27   Renato De Donato   new controllet
108
                  var selectedFields = this.$.select_data.getSelectedFields();

89558a41   Renato De Donato   datatype, provide...
109
                  var filters = this.$.select_data.getFilters();

256ece27   Renato De Donato   new controllet
110
                  var aggregators = this.$.select_data.getAggregators();

89558a41   Renato De Donato   datatype, provide...
111
                  var data = this.$.select_data.getData();

256ece27   Renato De Donato   new controllet
112
                  if(selectedFields.length > 0) {

89558a41   Renato De Donato   datatype, provide...
113
                      this.$.select_visualization.init();

256ece27   Renato De Donato   new controllet
114
                      this.$.select_visualization.setSelectedFields(selectedFields);

89558a41   Renato De Donato   datatype, provide...
115
                      this.$.select_visualization.setFilters(filters);

256ece27   Renato De Donato   new controllet
116
                      this.$.select_visualization.setAggregators(aggregators);

89558a41   Renato De Donato   datatype, provide...
117
118
119
120
121
122
123
124
125
126
                      this.$.select_visualization.setData(data);

                      this.$.slider.chevronRight(true);

                  }

              }

  

          });

  

      </script>

  

  </dom-module>