Commit 4bd2f9c2936561d1ccd713656f639d01380e6726
1 parent
02e7d683
data-table
Showing
2 changed files
with
217 additions
and
3 deletions
controllets/data-sevc-controllet/data-sevc-controllet_old.html
0 → 100755
1 | +<script src="../shared_js/perfect-scrollbar/js/min/perfect-scrollbar.jquery.min.js"></script> | ||
2 | +<link rel="stylesheet" href="../shared_js/perfect-scrollbar/css/perfect-scrollbar.min.css"> | ||
3 | + | ||
4 | +<script src="../../locales/controllet_ln.js"></script> | ||
5 | + | ||
6 | +<link rel="import" href="../../bower_components/polymer/polymer.html"> | ||
7 | + | ||
8 | +<link rel="import" href="../page-slider-controllet/page-slider-controllet.html"> | ||
9 | + | ||
10 | +<link rel="import" href="../select-dataset-controllet/select-dataset-controllet.html"> | ||
11 | +<link rel="import" href="../select-data-controllet/select-data-controllet.html" /> | ||
12 | +<link rel="import" href="../select-visualization-controllet/select-visualization-controllet.html" /> | ||
13 | + | ||
14 | +<dom-module id="data-sevc-controllet"> | ||
15 | + | ||
16 | + <template> | ||
17 | + | ||
18 | + <page-slider-controllet id="slider"> | ||
19 | + | ||
20 | + <neon-animatable> | ||
21 | + | ||
22 | + <template is="dom-if" if={{!modify}}> | ||
23 | + <select-dataset-controllet id="select_dataset" data={{data}} datasets={{datasets}} suggested-datasets={{suggestedDatasets}}></select-dataset-controllet> | ||
24 | + </template> | ||
25 | + | ||
26 | + </neon-animatable> | ||
27 | + | ||
28 | + <neon-animatable> | ||
29 | + | ||
30 | + <select-data-controllet id="select_data" data-url={{dataUrl}} preselected-fields={{selectedFields}} datalet-preset="{{dataletPreset}}"></select-data-controllet> | ||
31 | + | ||
32 | + </neon-animatable> | ||
33 | + | ||
34 | + <neon-animatable> | ||
35 | + | ||
36 | + <select-visualization-controllet id="select_visualization" deep-url={{deepUrl}} datalets-list-url={{dataletsListUrl}} data-url={{dataUrl}} preselected-datalet={{selectedDatalet}} datalet-preset={{dataletPreset}}></select-visualization-controllet> | ||
37 | + | ||
38 | + </neon-animatable> | ||
39 | + | ||
40 | + </page-slider-controllet> | ||
41 | + | ||
42 | + </template> | ||
43 | + | ||
44 | + <script> | ||
45 | + | ||
46 | + Polymer({ | ||
47 | + | ||
48 | + is : 'data-sevc-controllet', | ||
49 | + | ||
50 | + listeners : { | ||
51 | + 'page-slider-controllet_selected' : '_updateSlider', | ||
52 | + 'dataset-selection-controllet_data-url' : '_allowSecondStep', | ||
53 | + 'tree-view-controllet_selected-fields' : '_allowThirdStep' | ||
54 | + }, | ||
55 | + | ||
56 | + properties : { | ||
57 | + | ||
58 | + deepUrl : { | ||
59 | + type : String, | ||
60 | + value : undefined | ||
61 | + }, | ||
62 | + | ||
63 | + dataletsListUrl : { | ||
64 | + type : String , | ||
65 | + value : undefined | ||
66 | + }, | ||
67 | + | ||
68 | + datasets : { | ||
69 | + type : Array, | ||
70 | + value : undefined | ||
71 | + }, | ||
72 | + | ||
73 | + suggestedDatasets : { | ||
74 | + type : Array, | ||
75 | + value : undefined | ||
76 | + }, | ||
77 | + | ||
78 | + dataUrl : { | ||
79 | + type : String, | ||
80 | + value : undefined | ||
81 | + }, | ||
82 | + | ||
83 | + jsonData : { | ||
84 | + type : Object, | ||
85 | + value : undefined | ||
86 | + }, | ||
87 | + | ||
88 | + modify : { | ||
89 | + type : Boolean, | ||
90 | + value : false | ||
91 | + }, | ||
92 | + | ||
93 | + selectedDatalet : { | ||
94 | + type : String, | ||
95 | + value : undefined | ||
96 | + }, | ||
97 | + | ||
98 | + selectedFields : { | ||
99 | + type : Array, | ||
100 | + value : [] | ||
101 | + }, | ||
102 | + | ||
103 | + dataletPreset : { | ||
104 | + type : Object, | ||
105 | + value : [] | ||
106 | + }, | ||
107 | + | ||
108 | + localization : { | ||
109 | + type : String, | ||
110 | + value : "en" | ||
111 | + } | ||
112 | + | ||
113 | + }, | ||
114 | + | ||
115 | + ready : function(){ | ||
116 | + if(this.selectedDatalet){ | ||
117 | + this.modify = true; | ||
118 | + this.$.slider.selected = 1; | ||
119 | + this.dataUrl = this.dataletPreset["data-url"]; | ||
120 | + } | ||
121 | + ln["localization"] = this.localization; | ||
122 | + }, | ||
123 | + | ||
124 | + _updateSlider : function(e){ | ||
125 | + switch (e.detail.selected) { | ||
126 | + case 0: | ||
127 | + slider.setTitle(ln["slide1Title_" + this.localization], ln["slide1Subtitle_" + this.localization]); | ||
128 | + slider.chevronLeft("invisible"); | ||
129 | + slider.chevronRight(false); | ||
130 | + if(slider.getPrevSelected() == 1) | ||
131 | + slider.chevronRight(true); | ||
132 | + break; | ||
133 | + case 1: | ||
134 | + slider.setTitle(ln["slide2Title_" + this.localization], ln["slide2Subtitle_" + this.localization]); | ||
135 | + if(this.modify){ | ||
136 | + slider.chevronLeft("invisible"); | ||
137 | + } | ||
138 | + else{ | ||
139 | + slider.chevronLeft(true); | ||
140 | + } | ||
141 | + slider.chevronRight(false); | ||
142 | + this._allowThirdStep({detail: {fields: select_data.getSelectedFields()}}); | ||
143 | + if(this.modify){ | ||
144 | + this.$.select_visualization.setFields(select_data.getSelectedFields()); | ||
145 | + this.$.select_visualization.setFilters(select_data.getFilters()); | ||
146 | + } | ||
147 | + break; | ||
148 | + case 2: | ||
149 | + slider.setTitle(ln["slide3Title_" + this.localization], ln["slide3Subtitle_" + this.localization]); | ||
150 | + slider.chevronLeft(true); | ||
151 | + slider.chevronRight("invisible"); | ||
152 | + | ||
153 | + this.$.select_visualization.setFields(select_data.getSelectedFields()); | ||
154 | + this.$.select_visualization.setFilters(select_data.getFilters()); | ||
155 | + if(this.modify) { | ||
156 | + this.$.select_visualization.show();//resize | ||
157 | + } | ||
158 | + } | ||
159 | + }, | ||
160 | + | ||
161 | + _allowSecondStep : function(e){ | ||
162 | + if(e.detail.url == "") { | ||
163 | + slider.chevronRight(false); | ||
164 | + select_dataset.$.selected_url.invalid = false; | ||
165 | + return; | ||
166 | + } | ||
167 | + | ||
168 | + this.dataUrl = e.detail.url; | ||
169 | + | ||
170 | + var that = this; | ||
171 | + | ||
172 | + $.ajax({ | ||
173 | + url: e.detail.url, | ||
174 | + dataType: "json", | ||
175 | + success: function(data){ | ||
176 | +// this.dataUrl = e.detail.url | ||
177 | +// this.jsonData = JSON.stringify(data); | ||
178 | + slider.chevronRight(true); | ||
179 | + select_dataset.$.selected_url.invalid = false; | ||
180 | + | ||
181 | + that.$.select_data._init(); | ||
182 | + }, | ||
183 | + error: function(){ | ||
184 | +// this.jsonData = undefined; | ||
185 | + slider.chevronRight(false); | ||
186 | + select_dataset.$.selected_url.invalid = true; | ||
187 | + | ||
188 | + that.$.select_data._reset(); | ||
189 | + } | ||
190 | + }); | ||
191 | + | ||
192 | + //NOT HERE ma quando VADO al secondo passo e l'url è cambiato | ||
193 | +// this.$.select_data._init(); | ||
194 | + this.$.select_visualization.reset(); | ||
195 | + }, | ||
196 | + | ||
197 | + _allowThirdStep : function(e){ | ||
198 | + if(e.detail.fields.length > 0) | ||
199 | + slider.chevronRight(true); | ||
200 | + else | ||
201 | + slider.chevronRight(false); | ||
202 | + | ||
203 | + //this.$.select_visualization.reset(); | ||
204 | + } | ||
205 | + | ||
206 | + }); | ||
207 | + | ||
208 | + </script> | ||
209 | + | ||
210 | +</dom-module> | ||
0 | \ No newline at end of file | 211 | \ No newline at end of file |
controllets/data-table-controllet/data-table-controllet.html
@@ -283,9 +283,6 @@ | @@ -283,9 +283,6 @@ | ||
283 | _warning : function() {return ln["warning_" + ln["localization"]];}, | 283 | _warning : function() {return ln["warning_" + ln["localization"]];}, |
284 | 284 | ||
285 | setData : function(data) { | 285 | setData : function(data) { |
286 | -// this.data = data.slice(); | ||
287 | - | ||
288 | - //jsdatachecker | ||
289 | var converter = new DataTypeConverter(); | 286 | var converter = new DataTypeConverter(); |
290 | var result = converter.inferJsonDataType(data, ["*"]); | 287 | var result = converter.inferJsonDataType(data, ["*"]); |
291 | result = converter.cast(result); | 288 | result = converter.cast(result); |
@@ -302,6 +299,13 @@ | @@ -302,6 +299,13 @@ | ||
302 | this.shownPrev = Math.min(this.prev, this.length); | 299 | this.shownPrev = Math.min(this.prev, this.length); |
303 | this.shownNext = Math.min(this.next, this.length); | 300 | this.shownNext = Math.min(this.next, this.length); |
304 | this.shownData = this.data.slice(this.prev-1, this.next); | 301 | this.shownData = this.data.slice(this.prev-1, this.next); |
302 | + | ||
303 | + this._resize(); | ||
304 | + }, | ||
305 | + | ||
306 | + reset : function(){ | ||
307 | + this.setData([]); | ||
308 | + this.filter = ""; | ||
305 | }, | 309 | }, |
306 | 310 | ||
307 | _onPrevClick : function(){ | 311 | _onPrevClick : function(){ |