Blame view

controllets/data-sevc-controllet/data-sevc-controllet.html 7.34 KB
0f6424fe   root   update new data-s...
1
2
3
4
5
  /********************************************************************************************************************************

  <!--<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
6
7
  

  <script defer src="../../bower_components/l20n/dist/compat/web/l20n.min.js"></script>

0f6424fe   root   update new data-s...
8
  /********************************************************************************************************************************

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
  

e0e4a976   Renato De Donato   data-sevc-control...
39
                  <datalet-selection-controllet id="datalet_selection" deep-url={{deepUrl}} datalets-list-url={{dataletsListUrl}} data-url={{dataUrl}} preselected-datalet={{selectedDatalet}}></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 : []

a31f0660   root   sevc-controllet i...
109
110
                  }

  

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

035bbee3   Luigi Serra   Datalets and cont...
112
  

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

e0e4a976   Renato De Donato   data-sevc-control...
114
115
116
117
118
                  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...
119
                  }

eae8bcd8   Renato De Donato   localization
120
121
122
123
124
  

  //                var languageLink = document.createElement("link");

  //                languageLink.rel = "localization";

  //                languageLink.href = "../../../locales/it.l20n";

  //                document.getElementsByTagName("head")[0].appendChild(languageLink);

73bcce88   luigser   COMPONENTS
125
              },

74249687   Luigi Serra   Cross browser con...
126
  

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

                  switch (e.detail.selected) {

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

0e9aeacd   root   localization l20n
130
131
                          document.l10n.formatValues('slide1Title', 'slide1Subtitle').then(A => slider.setTitle(A[0], A[1]));

  //                        slider.setTitle("SELECT DATASET", "Search or copy and paste the url of dataset.");

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:

0e9aeacd   root   localization l20n
138
139
                          document.l10n.formatValues('slide2Title', 'slide2Subtitle').then(A => slider.setTitle(A[0], A[1]));

  //                        slider.setTitle("SELECT DATA", "Select the fields from tree-view. The multi-table will show the values related to the selected fields.");

e0e4a976   Renato De Donato   data-sevc-control...
140
141
142
143
144
145
146
                          if(this.modify){

                              slider.chevronLeft("invisible");

                              slider.setAvatar("2");

                          }

                          else{

                              slider.chevronLeft(true);

                          }

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

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

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

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

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

0e9aeacd   root   localization l20n
152
153
                          document.l10n.formatValues('slide3Title', 'slide3Subtitle').then(A => slider.setTitle(A[0], A[1]));

  //                        slider.setTitle("SELECT VISUALIZATION", "Select a visualization, fill out inputs and labels (optional).");

707a1508   root   update data-table...
154
155
                          slider.chevronLeft(true);

                          slider.chevronRight("invisible");

0e9aeacd   root   localization l20n
156
157
                          this.$.datalet_selection.setFields(tree_view_multi_table.getFlatFields());

                          this.$.datalet_selection.ready();

74249687   Luigi Serra   Cross browser con...
158
                  }

c011cd54   Luigi Serra   selection control...
159
              },

2b235978   Luigi Serra   Controllet cross ...
160
  

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

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

c011cd54   Luigi Serra   selection control...
163
  

0f6424fe   root   update new data-s...
164
165
166
167
168
169
170
                  $.ajax({

                      url: e.detail.url,

                      dataType: "json",

                      success: function(data){

  //                        this.dataUrl = e.detail.url

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

                          slider.chevronRight(true);

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

0f6424fe   root   update new data-s...
172
173
174
175
176
                      error: function(){

  //                        this.jsonData = undefined;

                          slider.chevronRight(false);

                      }

                  });

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

                  this.$.datalet_selection.reset();

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

  

              _allowThirdStep : function(e){

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

                      slider.chevronRight(true);

                  else

                      slider.chevronRight(false);

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

73bcce88   luigser   COMPONENTS
187
188
189
190
191
192
  

          });

  

      </script>

  

  </dom-module>