Blame view

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

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

  /********************************************************************************************************************************

ae17a8dc   Luigi Serra   Controllet and da...
7
  

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

938d1928   Luigi Serra   Update documentat...
9
  

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

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

73bcce88   luigser   COMPONENTS
16
  

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

74249687   Luigi Serra   Cross browser con...
18
  

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

486a1c48   Luigi Serra   selection control...
20
  

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

0e9aeacd   root   localization l20n
22
  

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

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

24be6abb   Luigi Serra   selection control...
28
  

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

a31f0660   root   sevc-controllet i...
30
  

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

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

73bcce88   luigser   COMPONENTS
34
  

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

73bcce88   luigser   COMPONENTS
36
  

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

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

73bcce88   luigser   COMPONENTS
40
  

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

c011cd54   Luigi Serra   selection control...
42
  

73bcce88   luigser   COMPONENTS
43
      </template>

74249687   Luigi Serra   Cross browser con...
44
  

73bcce88   luigser   COMPONENTS
45
46
      <script>

  

73bcce88   luigser   COMPONENTS
47
48
49
50
          Polymer({

  

              is : 'data-sevc-controllet',

  

73bcce88   luigser   COMPONENTS
51
              listeners : {

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

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

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

73bcce88   luigser   COMPONENTS
55
56
57
58
              },

  

              properties : {

  

73bcce88   luigser   COMPONENTS
59
60
                  deepUrl : {

                      type : String,

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

73bcce88   luigser   COMPONENTS
62
                  },

0f6424fe   root   update new data-s...
63
64
65
  

                  dataletsListUrl : {

                      type : String ,

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

73bcce88   luigser   COMPONENTS
67
                  },

0f6424fe   root   update new data-s...
68
69
  

                  datasets : {

73bcce88   luigser   COMPONENTS
70
                      type : Array,

24be6abb   Luigi Serra   selection control...
71
72
                      value : undefined

                  },

a31f0660   root   sevc-controllet i...
73
  

e0e4a976   Renato De Donato   data-sevc-control...
74
75
76
77
78
                  suggestedDatasets : {

                      type : Array,

                      value : undefined

                  },

  

0f6424fe   root   update new data-s...
79
80
81
82
                  dataUrl : {

                      type  : String,

                      value : undefined

                  },

a31f0660   root   sevc-controllet i...
83
  

0f6424fe   root   update new data-s...
84
85
86
                  jsonData : {

                      type  : Object,

                      value : undefined

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

  

                  modify : {

                      type  : Boolean,

                      value : false

                  },

  

                  selectedDatalet : {

                      type  : String,

                      value : undefined

                  },

  

                  selectedFields : {

                      type  : Array,

                      value : []

                  },

  

                  dataletPreset : {

                      type  : Object,

                      value : []

a31f0660   root   sevc-controllet i...
107
108
                  }

  

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

035bbee3   Luigi Serra   Datalets and cont...
110
  

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

e0e4a976   Renato De Donato   data-sevc-control...
112
113
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"];

  

                  }

73bcce88   luigser   COMPONENTS
119
              },

74249687   Luigi Serra   Cross browser con...
120
  

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

                  switch (e.detail.selected) {

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

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

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

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

                              slider.chevronRight(true);

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

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

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

                              slider.chevronLeft("invisible");

                              slider.setAvatar("2");

                          }

                          else{

                              slider.chevronLeft(true);

                          }

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

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

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

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

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

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

                          slider.chevronRight("invisible");

0e9aeacd   root   localization l20n
150
151
                          this.$.datalet_selection.setFields(tree_view_multi_table.getFlatFields());

                          this.$.datalet_selection.ready();

74249687   Luigi Serra   Cross browser con...
152
                  }

c011cd54   Luigi Serra   selection control...
153
              },

2b235978   Luigi Serra   Controllet cross ...
154
  

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

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

c011cd54   Luigi Serra   selection control...
157
  

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

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

  //                        this.jsonData = undefined;

                          slider.chevronRight(false);

                      }

                  });

e0e4a976   Renato De Donato   data-sevc-control...
171
172
  

                  this.$.datalet_selection.reset();

707a1508   root   update data-table...
173
174
175
176
177
178
179
              },

  

              _allowThirdStep : function(e){

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

                      slider.chevronRight(true);

                  else

                      slider.chevronRight(false);

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

73bcce88   luigser   COMPONENTS
181
182
183
184
185
186
  

          });

  

      </script>

  

  </dom-module>