Blame view

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

e0e4a976   Renato De Donato   data-sevc-control...
22
23
24
                  <template is="dom-if" if={{!modify}}>

                      <dataset-selection-controllet id="dataset_selection" datasets={{datasets}} suggested-datasets={{suggestedDatasets}}></dataset-selection-controllet>

                  </template>

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

24be6abb   Luigi Serra   selection control...
26
  

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

a31f0660   root   sevc-controllet i...
28
  

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

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

73bcce88   luigser   COMPONENTS
32
  

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

73bcce88   luigser   COMPONENTS
34
  

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

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

73bcce88   luigser   COMPONENTS
38
  

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

c011cd54   Luigi Serra   selection control...
40
  

73bcce88   luigser   COMPONENTS
41
      </template>

74249687   Luigi Serra   Cross browser con...
42
  

73bcce88   luigser   COMPONENTS
43
44
      <script>

  

73bcce88   luigser   COMPONENTS
45
46
47
48
          Polymer({

  

              is : 'data-sevc-controllet',

  

73bcce88   luigser   COMPONENTS
49
              listeners : {

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

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

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

73bcce88   luigser   COMPONENTS
53
54
55
56
              },

  

              properties : {

  

73bcce88   luigser   COMPONENTS
57
58
                  deepUrl : {

                      type : String,

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

73bcce88   luigser   COMPONENTS
60
                  },

0f6424fe   root   update new data-s...
61
62
63
  

                  dataletsListUrl : {

                      type : String ,

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

73bcce88   luigser   COMPONENTS
65
                  },

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

                  datasets : {

73bcce88   luigser   COMPONENTS
68
                      type : Array,

24be6abb   Luigi Serra   selection control...
69
70
                      value : undefined

                  },

a31f0660   root   sevc-controllet i...
71
  

e0e4a976   Renato De Donato   data-sevc-control...
72
73
74
75
76
                  suggestedDatasets : {

                      type : Array,

                      value : undefined

                  },

  

0f6424fe   root   update new data-s...
77
78
79
80
                  dataUrl : {

                      type  : String,

                      value : undefined

                  },

a31f0660   root   sevc-controllet i...
81
  

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

                      type  : Object,

                      value : undefined

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

  

                  modify : {

                      type  : Boolean,

                      value : false

                  },

  

                  selectedDatalet : {

                      type  : String,

                      value : undefined

                  },

  

                  selectedFields : {

                      type  : Array,

                      value : []

                  },

  

                  dataletPreset : {

                      type  : Object,

                      value : []

a31f0660   root   sevc-controllet i...
105
106
                  }

  

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

035bbee3   Luigi Serra   Datalets and cont...
108
  

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

e0e4a976   Renato De Donato   data-sevc-control...
110
111
112
113
114
115
116
                  if(this.selectedDatalet){

                      this.modify = true;

                      this.$.slider.selected = 1;

  //                    console.log(this.selectedDatalet);

                      this.dataUrl = this.dataletPreset["data-url"];

  

                  }

73bcce88   luigser   COMPONENTS
117
              },

74249687   Luigi Serra   Cross browser con...
118
  

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

                  switch (e.detail.selected) {

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

0f6424fe   root   update new data-s...
122
                          slider.setTitle("SELECT DATASET", "Search or copy and paste the url of dataset.");

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

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

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

                              slider.chevronRight(true);

  

  //                        this.$.dataset_selection._fireDataUrl();

  //                        console.log(this.$.dataset_selection);

                          break;

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

e0e4a976   Renato De Donato   data-sevc-control...
132
133
134
135
136
137
138
139
                          slider.setTitle("SELECT DATA", "Select the fields from tree-view. The multi-table will show the values related to the selected fields.");

                          if(this.modify){

                              slider.chevronLeft("invisible");

                              slider.setAvatar("2");

                          }

                          else{

                              slider.chevronLeft(true);

                          }

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

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

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

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

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

e0e4a976   Renato De Donato   data-sevc-control...
145
                          slider.setTitle("SELECT VISUALIZATION", "Select a visualization, fill out inputs and labels (optional).");

707a1508   root   update data-table...
146
147
148
                          slider.chevronLeft(true);

                          slider.chevronRight("invisible");

                              //reset when?

0f6424fe   root   update new data-s...
149
150
                          this.$.datalet_selection.setFields(tree_view_multi_table.getFlatFields());//???

                          this.$.datalet_selection.ready();//???

74249687   Luigi Serra   Cross browser con...
151
                  }

c011cd54   Luigi Serra   selection control...
152
              },

2b235978   Luigi Serra   Controllet cross ...
153
  

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

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

c011cd54   Luigi Serra   selection control...
156
  

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

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

  //                        this.jsonData = undefined;

                          slider.chevronRight(false);

                      }

                  });

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

                  this.$.datalet_selection.reset();

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

  

              _allowThirdStep : function(e){

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

                      slider.chevronRight(true);

                  else

                      slider.chevronRight(false);

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

73bcce88   luigser   COMPONENTS
180
181
182
183
184
185
  

          });

  

      </script>

  

  </dom-module>