Blame view

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

73bcce88   luigser   COMPONENTS
121
              },

74249687   Luigi Serra   Cross browser con...
122
  

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

                  switch (e.detail.selected) {

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

0e9aeacd   root   localization l20n
126
127
                          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...
128
                          slider.chevronLeft("invisible");

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

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

                              slider.chevronRight(true);

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

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

0e9aeacd   root   localization l20n
134
135
                          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...
136
137
138
139
140
141
142
                          if(this.modify){

                              slider.chevronLeft("invisible");

                              slider.setAvatar("2");

                          }

                          else{

                              slider.chevronLeft(true);

                          }

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

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

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

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

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

0e9aeacd   root   localization l20n
148
149
                          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...
150
151
                          slider.chevronLeft(true);

                          slider.chevronRight("invisible");

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

                          this.$.datalet_selection.ready();

74249687   Luigi Serra   Cross browser con...
154
                  }

c011cd54   Luigi Serra   selection control...
155
              },

2b235978   Luigi Serra   Controllet cross ...
156
  

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

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

c011cd54   Luigi Serra   selection control...
159
  

0f6424fe   root   update new data-s...
160
161
162
163
164
165
166
                  $.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...
167
                      },

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

  //                        this.jsonData = undefined;

                          slider.chevronRight(false);

                      }

                  });

e0e4a976   Renato De Donato   data-sevc-control...
173
174
  

                  this.$.datalet_selection.reset();

707a1508   root   update data-table...
175
176
177
178
179
180
181
              },

  

              _allowThirdStep : function(e){

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

                      slider.chevronRight(true);

                  else

                      slider.chevronRight(false);

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

73bcce88   luigser   COMPONENTS
183
184
185
186
187
188
  

          });

  

      </script>

  

  </dom-module>