Blame view

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

6d2a2a1e   Andrea Petta   language handling
6
7
8
  <!--<script defer src="../../bower_components/l20n/dist/compat/web/l20n.min.js"></script>-->

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

  

ae17a8dc   Luigi Serra   Controllet and da...
9
  

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

938d1928   Luigi Serra   Update documentat...
11
  

0f6424fe   root   update new data-s...
12
13
14
15
  <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...
16
17
  

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

73bcce88   luigser   COMPONENTS
18
  

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

74249687   Luigi Serra   Cross browser con...
20
  

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

486a1c48   Luigi Serra   selection control...
22
  

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

0e9aeacd   root   localization l20n
24
  

e0e4a976   Renato De Donato   data-sevc-control...
25
26
27
                  <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
28
  

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

24be6abb   Luigi Serra   selection control...
30
  

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

a31f0660   root   sevc-controllet i...
32
  

e0e4a976   Renato De Donato   data-sevc-control...
33
                  <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...
34
  

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

73bcce88   luigser   COMPONENTS
36
  

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

73bcce88   luigser   COMPONENTS
38
  

e8219f9a   Renato De Donato   datalet-mod
39
                  <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
40
  

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

73bcce88   luigser   COMPONENTS
42
  

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

c011cd54   Luigi Serra   selection control...
44
  

73bcce88   luigser   COMPONENTS
45
      </template>

74249687   Luigi Serra   Cross browser con...
46
  

73bcce88   luigser   COMPONENTS
47
48
      <script>

  

73bcce88   luigser   COMPONENTS
49
50
51
52
          Polymer({

  

              is : 'data-sevc-controllet',

  

73bcce88   luigser   COMPONENTS
53
              listeners : {

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

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

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

73bcce88   luigser   COMPONENTS
57
58
59
60
              },

  

              properties : {

  

73bcce88   luigser   COMPONENTS
61
62
                  deepUrl : {

                      type : String,

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

73bcce88   luigser   COMPONENTS
64
                  },

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

                  dataletsListUrl : {

                      type : String ,

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

73bcce88   luigser   COMPONENTS
69
                  },

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

                  datasets : {

73bcce88   luigser   COMPONENTS
72
                      type : Array,

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

                  },

a31f0660   root   sevc-controllet i...
75
  

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

                      type : Array,

                      value : undefined

                  },

  

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

                      type  : String,

                      value : undefined

                  },

a31f0660   root   sevc-controllet i...
85
  

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

                      type  : Object,

                      value : undefined

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

  

                  modify : {

                      type  : Boolean,

                      value : false

                  },

  

                  selectedDatalet : {

                      type  : String,

                      value : undefined

                  },

  

                  selectedFields : {

                      type  : Array,

                      value : []

                  },

  

                  dataletPreset : {

                      type  : Object,

                      value : []

6d2a2a1e   Andrea Petta   language handling
109
110
111
112
113
                  },

  

                  localization : {

                      type : String,

                      value : "en"

a31f0660   root   sevc-controllet i...
114
115
                  }

  

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

035bbee3   Luigi Serra   Datalets and cont...
117
  

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

e0e4a976   Renato De Donato   data-sevc-control...
119
120
121
122
123
                  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...
124
                  }

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

73bcce88   luigser   COMPONENTS
126
              },

74249687   Luigi Serra   Cross browser con...
127
  

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

                  switch (e.detail.selected) {

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

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

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

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

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

                              slider.chevronRight(true);

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

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

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

e0e4a976   Renato De Donato   data-sevc-control...
139
140
                          if(this.modify){

                              slider.chevronLeft("invisible");

e0e4a976   Renato De Donato   data-sevc-control...
141
142
143
144
                          }

                          else{

                              slider.chevronLeft(true);

                          }

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

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

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

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

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

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

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

                          slider.chevronRight("invisible");

0e9aeacd   root   localization l20n
153
154
                          this.$.datalet_selection.setFields(tree_view_multi_table.getFlatFields());

                          this.$.datalet_selection.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);

5c96a7bc   Renato De Donato   controllet invali...
168
                          dataset_selection.$.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);

5c96a7bc   Renato De Donato   controllet invali...
173
                          dataset_selection.$.selected_url.invalid = true;

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

                  });

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

                  this.$.datalet_selection.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);

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

73bcce88   luigser   COMPONENTS
186
187
188
189
190
191
  

          });

  

      </script>

  

  </dom-module>