Commit ad18ef24ffd6396ffd759ba4df496ec678038239
1 parent
a1dedcfa
plugin update
Showing
1 changed file
with
655 additions
and
0 deletions
controllets/dataset-table-controllet/dataset-table-controllet.html
0 → 100644
1 | +<link rel="import" href="../../bower_components/polymer/polymer.html" /> | |
2 | + | |
3 | +<link rel="import" href="../../bower_components/paper-material/paper-material.html" /> | |
4 | +<link rel="import" href="../../bower_components/paper-input/paper-input.html"> | |
5 | +<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html"> | |
6 | +<link rel="import" href="../../bower_components/iron-icons/iron-icons.html"> | |
7 | +<link rel="import" href="../../bower_components/paper-tooltip/paper-tooltip.html"> | |
8 | +<link rel="import" href="../../bower_components/paper-checkbox/paper-checkbox.html"> | |
9 | +<link rel="import" href="../../bower_components/paper-dialog/paper-dialog.html"> | |
10 | +<link rel="import" href="../data-table-controllet/data-table-controllet.html"> | |
11 | + | |
12 | +<script type="text/javascript" src="../../bower_components/JSDataChecker/jsdatachecker.min.js"></script> | |
13 | + | |
14 | +<dom-module id="dataset-table-controllet"> | |
15 | + | |
16 | + <template> | |
17 | + | |
18 | + <style is="custom-style"> | |
19 | + | |
20 | + paper-checkbox { | |
21 | + height: 24px; | |
22 | + /*margin-top: 8px*/ | |
23 | + --paper-checkbox-checked-color: #2196F3; | |
24 | + --paper-checkbox-checked-ink-color: #FFFFFF; | |
25 | + --paper-checkbox-unchecked-color: #000000; | |
26 | + --paper-checkbox-unchecked-ink-color: #FFFFFF; | |
27 | + --paper-checkbox-label-color: #000000; | |
28 | + } | |
29 | + | |
30 | + paper-input { | |
31 | + max-width: 288px; | |
32 | + --paper-input-container-focus-color: #2196F3; | |
33 | + } | |
34 | + | |
35 | + paper-icon-button.preview-close | |
36 | + { | |
37 | + height: 28px; | |
38 | + width: 28px; | |
39 | + } | |
40 | + | |
41 | + paper-icon-button{ | |
42 | + height: 48px; | |
43 | + width: 48px; | |
44 | + padding: 0px; | |
45 | + --paper-icon-button-ink-color: #FFFFFF; | |
46 | + } | |
47 | + | |
48 | + paper-icon-button.tools | |
49 | + { | |
50 | + height: 24px; | |
51 | + width: 24px; | |
52 | + padding: 0px; | |
53 | + --paper-icon-button-ink-color: #2196F3; | |
54 | + } | |
55 | + | |
56 | + paper-icon-button:hover{ | |
57 | + color: #2196F3; | |
58 | + } | |
59 | + | |
60 | + paper-icon-button.clear { | |
61 | + width: 24px; | |
62 | + height: 24px; | |
63 | + padding: 0px 4px; | |
64 | + color: #F44336; | |
65 | + --paper-icon-button-ink-color: #FFFFFF; | |
66 | + } | |
67 | + | |
68 | + paper-icon-button.order { | |
69 | + height: 24px; | |
70 | + width: 24px; | |
71 | + cursor: pointer; | |
72 | + } | |
73 | + | |
74 | + paper-icon-button.order:hover { | |
75 | + color: #FFFFFF; | |
76 | + } | |
77 | + | |
78 | + paper-tooltip { | |
79 | + --paper-tooltip-background: black; | |
80 | + } | |
81 | + | |
82 | + #data_table_container { | |
83 | + height: 100%; | |
84 | + width: 100%; | |
85 | + } | |
86 | + | |
87 | + #data_table_container * { | |
88 | + font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif; | |
89 | + font-size: 16px; | |
90 | + line-height: 24px; | |
91 | + } | |
92 | + | |
93 | + #data_table_container #header { | |
94 | + background: #B6B6B6; | |
95 | + height: 24px; | |
96 | + padding: 12px; | |
97 | + text-align: center; | |
98 | + font-weight: 700; | |
99 | + } | |
100 | + | |
101 | + #data_table_container table { | |
102 | + height: calc(100% - 96px); | |
103 | + width: 100%; | |
104 | + | |
105 | + border-spacing: 0px; | |
106 | + } | |
107 | + | |
108 | + #data_table_container tbody { | |
109 | + width: 100%; | |
110 | + display: block; | |
111 | + position: relative; | |
112 | + } | |
113 | + | |
114 | + #data_table_container .even-row{ | |
115 | + | |
116 | + } | |
117 | + | |
118 | + #data_table_container .odd-row{ | |
119 | + background: #E0E0E0; | |
120 | + } | |
121 | + | |
122 | + /*#data_table_container tr:nth-child(odd) { | |
123 | + background: #E0E0E0; | |
124 | + }*/ | |
125 | + | |
126 | + #data_table_container th, | |
127 | + #data_table_container td{ | |
128 | + height: 24px; | |
129 | + padding: 12px; | |
130 | + text-align: center; | |
131 | + max-width: 224px; | |
132 | + overflow: hidden; | |
133 | + white-space: nowrap; | |
134 | + text-overflow: ellipsis; | |
135 | + width: 1%; | |
136 | + vertical-align: middle; | |
137 | + } | |
138 | + | |
139 | + #data_table_container th { | |
140 | + background: #2196F3; | |
141 | + color: #FFFFFF; | |
142 | + font-weight: 700; | |
143 | + /*cursor: help;*/ | |
144 | + } | |
145 | + | |
146 | + #data_table_container td { | |
147 | + font-size: 14px; | |
148 | + padding: 4px; | |
149 | + } | |
150 | + | |
151 | + #data_table_container tfoot td { | |
152 | + height: 48px; | |
153 | + padding: 0px; | |
154 | + font-size: 16px; | |
155 | + background: #B6B6B6; | |
156 | + } | |
157 | + | |
158 | + #data_table_container #footer { | |
159 | + width: 100%; | |
160 | + height: 48px; | |
161 | + background: #B6B6B6; | |
162 | + | |
163 | + display: flex; | |
164 | + flex-direction: row; | |
165 | + } | |
166 | + | |
167 | + #data_table_container .footer_block { | |
168 | + height: 24px; | |
169 | + padding: 12px 8px; | |
170 | + text-align: right; | |
171 | + } | |
172 | + | |
173 | + #data_table_container .footer_block:nth-child(1) { | |
174 | + width: 30%; | |
175 | + overflow: hidden; | |
176 | + white-space: nowrap; | |
177 | + text-overflow: ellipsis; | |
178 | + } | |
179 | + | |
180 | + #data_table_container .footer_block:nth-child(2) { | |
181 | + width: 40%; | |
182 | + height: 48px; | |
183 | + padding: 0px 8px; | |
184 | + text-align: center; | |
185 | + } | |
186 | + | |
187 | + #data_table_container .footer_block:nth-child(3) { | |
188 | + width: 30%; | |
189 | + height: 40px; | |
190 | + padding: 4px 8px; | |
191 | + text-align: left; | |
192 | + } | |
193 | + | |
194 | + #data_table_container br { | |
195 | + display: block; | |
196 | + margin-top: 8px; | |
197 | + content: " "; | |
198 | + } | |
199 | + | |
200 | + #data_table_container p { | |
201 | + margin: 0; | |
202 | + padding: 0; | |
203 | + } | |
204 | + | |
205 | + #data_table_container p .type{ | |
206 | + font-weight: 700; | |
207 | + } | |
208 | + | |
209 | + #data_table_container p .warning{ | |
210 | + font-weight: 700; | |
211 | + color: #F44336; | |
212 | + } | |
213 | + | |
214 | + paper-dialog { | |
215 | + /*position: fixed;*/ | |
216 | + min-height: 80%; | |
217 | + min-width: 85%; | |
218 | + height: 80%; | |
219 | + width: 85%; | |
220 | + } | |
221 | + | |
222 | + paper-dialog > * | |
223 | + { | |
224 | + padding: 0; | |
225 | + margin: 0; | |
226 | + } | |
227 | + | |
228 | + .buttons_position | |
229 | + { | |
230 | + position: absolute; | |
231 | + top: 10px; | |
232 | + right: 10px; | |
233 | + } | |
234 | + | |
235 | + </style> | |
236 | + | |
237 | + <paper-material id="data_table_container" elevation="5"> | |
238 | + | |
239 | + <div id="header"> | |
240 | + <span id="selected_data"></span> | |
241 | + <div style="float: right; right: 10px"> | |
242 | + <paper-checkbox checked on-change="showAll"><span id="suggested_datasets">Last Version</span></paper-checkbox> | |
243 | + </div> | |
244 | + </div> | |
245 | + | |
246 | + <table> | |
247 | + <tbody id="tbody"> | |
248 | + <tr> | |
249 | + <template is="dom-repeat" items="{{fields}}"> | |
250 | + <th id="id_{{index}}"> | |
251 | + {{item.name}} | |
252 | + <paper-icon-button id="{{index}}" class="order" on-click="_order" icon="unfold-more"></paper-icon-button> | |
253 | + </th> | |
254 | + </template> | |
255 | + <th> | |
256 | + TOOLS | |
257 | + </th> | |
258 | + </tr> | |
259 | + <template is="dom-repeat" items="{{shownData}}"> | |
260 | + <tr class$="{{item.cssClass}}"> | |
261 | + <template is="dom-repeat" items="{{_toArray(item)}}"> | |
262 | + <template is="dom-if" if="{{!item.isLink}}"> | |
263 | + <td title="{{item.value}}">{{item.value}}</td> | |
264 | + </template> | |
265 | + <template is="dom-if" if="{{item.isLink}}"> | |
266 | + <td> | |
267 | + <template is="dom-repeat" items="{{item.value}}" as="user" > | |
268 | + <div class="ow_avatar"> | |
269 | + <a href="#"> | |
270 | + <img alt="" src="{{user}}" style="max-width: 100%;"> | |
271 | + </a> | |
272 | + </div> | |
273 | + </template> | |
274 | + </td> | |
275 | + </template> | |
276 | + </template> | |
277 | + <td> | |
278 | + <paper-icon-button class="tools" icon="open-in-new" on-click="_onOpenDatasetClick"></paper-icon-button> | |
279 | + <paper-icon-button class="tools" icon="file-download"></paper-icon-button> | |
280 | + <paper-icon-button class="tools" icon="content-copy"></paper-icon-button> | |
281 | + </td> | |
282 | + </tr> | |
283 | + </template> | |
284 | + </tbody> | |
285 | + </table> | |
286 | + | |
287 | + <!--<template is="dom-repeat" items="{{fields}}"> | |
288 | + <paper-tooltip for="{{_fieldId(index)}}" offset="8"> | |
289 | + <p> | |
290 | + <span class="type">{{_type()}}:</span> {{item.type}} | |
291 | + <template is="dom-if" if={{item.errorsDescription.length}}> | |
292 | + <br/> | |
293 | + <span class="warning">{{_warning()}}:</span> {{item.errorsDescription}} | |
294 | + </template> | |
295 | + </p> | |
296 | + </paper-tooltip> | |
297 | + </template>--> | |
298 | + | |
299 | + <div id="footer"> | |
300 | + <div class="footer_block"> | |
301 | + <span id="showing"></span> {{shownPrev}} <span id="to"></span> {{shownNext}} <span id="of"></span> {{length}} <span id="rows"></span> | |
302 | + </div> | |
303 | + <div class="footer_block"> | |
304 | + <paper-icon-button id="slider_chevron_left" class="chevron-left" on-click="_onPrevClick" icon="chevron-left"></paper-icon-button> | |
305 | + <paper-icon-button id="slider_chevron_right" class="chevron-right" on-click="_onNextClick" icon="chevron-right"></paper-icon-button> | |
306 | + </div> | |
307 | + <div class="footer_block"> | |
308 | + <paper-input id="filter" value={{filter}} no-label-float> | |
309 | + <iron-icon class="search" icon="search" prefix></iron-icon> | |
310 | + <paper-icon-button class="clear" suffix on-click="_clearInput" icon="clear"></paper-icon-button> | |
311 | + </paper-input> | |
312 | + </div> | |
313 | + </div> | |
314 | + | |
315 | + </paper-material> | |
316 | + | |
317 | + <paper-dialog modal id="paper_dialog"> | |
318 | + <data-table-controllet id="data_table_controllet" data='[{"ID":"1", "VER":"5", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
319 | + {"ID":"1", "VER":"4", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
320 | + {"ID":"1", "VER":"3", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
321 | + {"ID":"1", "VER":"2", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
322 | + {"ID":"1", "VER":"1", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
323 | + {"ID":"16", "VER":"4", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
324 | + {"ID":"16", "VER":"3", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
325 | + {"ID":"16", "VER":"2", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
326 | + {"ID":"16", "VER":"1", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
327 | + {"ID":"1", "VER":"4", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
328 | + {"ID":"1", "VER":"3", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
329 | + {"ID":"1", "VER":"2", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
330 | + {"ID":"1", "VER":"1", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
331 | + {"ID":"16", "VER":"4", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
332 | + {"ID":"16", "VER":"3", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
333 | + {"ID":"16", "VER":"2", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
334 | + {"ID":"16", "VER":"1", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
335 | + {"ID":"1", "VER":"4", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
336 | + {"ID":"1", "VER":"3", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
337 | + {"ID":"1", "VER":"2", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
338 | + {"ID":"1", "VER":"1", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
339 | + {"ID":"16", "VER":"4", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
340 | + {"ID":"16", "VER":"3", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
341 | + {"ID":"16", "VER":"2", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
342 | + {"ID":"16", "VER":"1", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
343 | + {"ID":"1", "VER":"4", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
344 | + {"ID":"1", "VER":"3", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
345 | + {"ID":"1", "VER":"2", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
346 | + {"ID":"1", "VER":"1", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
347 | + {"ID":"16", "VER":"4", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
348 | + {"ID":"16", "VER":"3", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
349 | + {"ID":"16", "VER":"2", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
350 | + {"ID":"16", "VER":"1", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
351 | + {"ID":"1", "VER":"4", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
352 | + {"ID":"1", "VER":"3", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
353 | + {"ID":"1", "VER":"2", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
354 | + {"ID":"1", "VER":"1", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
355 | + {"ID":"16", "VER":"4", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
356 | + {"ID":"16", "VER":"3", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
357 | + {"ID":"16", "VER":"2", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
358 | + {"ID":"16", "VER":"1", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
359 | + {"ID":"1", "VER":"4", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
360 | + {"ID":"1", "VER":"3", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
361 | + {"ID":"1", "VER":"2", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
362 | + {"ID":"1", "VER":"1", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
363 | + {"ID":"16", "VER":"4", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
364 | + {"ID":"16", "VER":"3", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
365 | + {"ID":"16", "VER":"2", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
366 | + {"ID":"16", "VER":"1", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
367 | + {"ID":"1", "VER":"4", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
368 | + {"ID":"1", "VER":"3", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
369 | + {"ID":"1", "VER":"2", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
370 | + {"ID":"1", "VER":"1", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
371 | + {"ID":"16", "VER":"4", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
372 | + {"ID":"16", "VER":"3", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
373 | + {"ID":"16", "VER":"2", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
374 | + {"ID":"16", "VER":"1", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
375 | + {"ID":"1", "VER":"4", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
376 | + {"ID":"1", "VER":"3", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
377 | + {"ID":"1", "VER":"2", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
378 | + {"ID":"1", "VER":"1", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
379 | + {"ID":"16", "VER":"4", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
380 | + {"ID":"16", "VER":"3", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
381 | + {"ID":"16", "VER":"2", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
382 | + {"ID":"16", "VER":"1", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
383 | + {"ID":"1", "VER":"4", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
384 | + {"ID":"1", "VER":"3", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
385 | + {"ID":"1", "VER":"2", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
386 | + {"ID":"1", "VER":"1", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
387 | + {"ID":"16", "VER":"4", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
388 | + {"ID":"16", "VER":"3", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
389 | + {"ID":"16", "VER":"2", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
390 | + {"ID":"16", "VER":"1", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
391 | + {"ID":"1", "VER":"4", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
392 | + {"ID":"1", "VER":"3", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
393 | + {"ID":"1", "VER":"2", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
394 | + {"ID":"1", "VER":"1", "USER":"http://172.16.15.77/ow_userfiles/plugins/base/avatars/avatar_1_1457965950.jpg", "Name":"Bilancio Battipaglia", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
395 | + {"ID":"16", "VER":"4", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
396 | + {"ID":"16", "VER":"3", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
397 | + {"ID":"16", "VER":"2", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
398 | + {"ID":"16", "VER":"1", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}, | |
399 | + {"ID":"17", "VER":"1", "USER":"https://www.google.it/images/branding/googleg/1x/googleg_standard_color_128dp.png", "Name":"Traffic Cameras", "Data":"07/06/2016", "METADATA":"Traffic, Cameras", "USED" : 10}]'> | |
400 | + | |
401 | + </data-table-controllet> | |
402 | + <div class="buttons buttons_position"> | |
403 | + <paper-icon-button dialog-confirm icon="close" class="preview-close"></paper-icon-button> | |
404 | + </div> | |
405 | + </paper-dialog> | |
406 | + | |
407 | + </template> | |
408 | + | |
409 | + <script> | |
410 | + | |
411 | + Polymer({ | |
412 | + | |
413 | + is : 'dataset-table-controllet', | |
414 | + | |
415 | + properties : { | |
416 | + | |
417 | + data : { | |
418 | + type : Array, | |
419 | + value : [] | |
420 | + }, | |
421 | + | |
422 | + filter : { | |
423 | + type : String, | |
424 | + value : undefined, | |
425 | + observer : '_filter' | |
426 | + } | |
427 | + | |
428 | + }, | |
429 | + | |
430 | + ready : function() { | |
431 | + this.step = 10; | |
432 | + }, | |
433 | + | |
434 | + attached : function(){ | |
435 | + $(this.$.tbody).perfectScrollbar(); | |
436 | + | |
437 | + this._resize(); | |
438 | + var that = this; | |
439 | + window.addEventListener("resize", function() { that._resize(); }); | |
440 | + | |
441 | + this._translate(); | |
442 | + | |
443 | + if(this.data.length > 0) | |
444 | + this.setData(this.data); | |
445 | + }, | |
446 | + | |
447 | + _translate : function(){ | |
448 | + this.$.selected_data.innerHTML = ln["selectedData_" + ln["localization"]]; | |
449 | + | |
450 | + this.$.showing.innerHTML = ln["showing_" + ln["localization"]]; | |
451 | + this.$.to.innerHTML = ln["to_" + ln["localization"]]; | |
452 | + this.$.of.innerHTML = ln["of_" + ln["localization"]]; | |
453 | + this.$.rows.innerHTML = ln["rows_" + ln["localization"]]; | |
454 | + | |
455 | + this.$.filter.setAttribute("label", ln["search_" + ln["localization"]]); | |
456 | + }, | |
457 | + | |
458 | + _type : function() {return ln["type_" + ln["localization"]];}, | |
459 | + _warning : function() {return ln["warning_" + ln["localization"]];}, | |
460 | + | |
461 | + _onOpenDatasetClick : function() { | |
462 | + this.$.paper_dialog.open(); | |
463 | + this.$.data_table_controllet._resize(); | |
464 | + }, | |
465 | + | |
466 | + setData : function(data) { | |
467 | + var converter = new DataTypeConverter(); | |
468 | + var result = converter.inferJsonDataType(data, ["*"]); | |
469 | + result = converter.cast(result); | |
470 | + delete result.types.ID; | |
471 | + this.fields = ArrayUtils.toFieldsArray(result.types); | |
472 | + this.originalData = result.dataset; | |
473 | + this.uniqueData = []; | |
474 | + var uniqueId = {}; | |
475 | + var cssClass = ["even-row", "odd-row"]; | |
476 | + var j = 0; | |
477 | + | |
478 | + for(var i=0; i<result.dataset.length; i++) { | |
479 | + if (!uniqueId[result.dataset[i].ID.toString()]) { | |
480 | + uniqueId[result.dataset[i].ID.toString()] = result.dataset[i].ID.toString(); | |
481 | + result.dataset[i]["cssClass"] = cssClass[j%2]; | |
482 | + this.uniqueData.push(result.dataset[i]); | |
483 | + j++; | |
484 | + } | |
485 | + result.dataset[i]["cssClass"] = cssClass[j%2]; | |
486 | + } | |
487 | + | |
488 | + this.data = this.uniqueData; | |
489 | + this.filter = ""; | |
490 | + $(".order").attr("icon", "unfold-more"); | |
491 | + | |
492 | + this.prev = 1; | |
493 | + this.next = this.step; | |
494 | + this.length = this.data.length; | |
495 | + | |
496 | + this.shownPrev = Math.min(this.prev, this.length); | |
497 | + this.shownNext = Math.min(this.next, this.length); | |
498 | + this.shownData = this.data.slice(this.prev-1, this.next); | |
499 | + | |
500 | + this._resize(); | |
501 | + }, | |
502 | + | |
503 | + reset : function(){ | |
504 | + this.setData([]); | |
505 | + $(this.$.tbody).animate({ scrollTop: 0}, 0); | |
506 | +// this.filter = ""; | |
507 | + }, | |
508 | + | |
509 | + showAll : function (e) { | |
510 | + | |
511 | + if(!e.target.checked) { | |
512 | + this.data = this.originalData; | |
513 | + }else{ | |
514 | + this.data = this.uniqueData; | |
515 | + } | |
516 | + this.length = this.data.length; | |
517 | + this.shownPrev = Math.min(this.prev, this.length); | |
518 | + this.shownNext = Math.min(this.next, this.length); | |
519 | + this.shownData = this.data.slice(this.prev-1, this.next); | |
520 | + }, | |
521 | + | |
522 | + _onPrevClick : function(){ | |
523 | + if(this.prev != 1) { | |
524 | + this.prev -= this.step; | |
525 | + this.next -= this.step; | |
526 | + | |
527 | + this.shownPrev = Math.min(this.prev, this.length); | |
528 | + this.shownNext = Math.min(this.next, this.length); | |
529 | + this.shownData = this.data.slice(this.prev - 1, this.next); | |
530 | + } | |
531 | + $(this.$.tbody).animate({ scrollTop: 0}, 0); | |
532 | + }, | |
533 | + | |
534 | + _onNextClick : function(){ | |
535 | + if(this.next < this.length) { | |
536 | + this.prev += this.step; | |
537 | + this.next += this.step; | |
538 | + | |
539 | + this.shownPrev = Math.min(this.prev, this.length); | |
540 | + this.shownNext = Math.min(this.next, this.length); | |
541 | + this.shownData = this.data.slice(this.prev - 1, this.next); | |
542 | + } | |
543 | + $(this.$.tbody).animate({ scrollTop: 0}, 0); | |
544 | + }, | |
545 | + | |
546 | + _filter : function(a, b) { | |
547 | + this.debounce('_filter', function () { | |
548 | + if(this.data.length) { | |
549 | + var filter = this.filter.toLowerCase(); | |
550 | + | |
551 | + if(filter == "") | |
552 | + this.shownData = this.data; | |
553 | + else { | |
554 | + var keys = Object.keys(this.data[0]); | |
555 | + this.shownData = this.data.filter(function (el) { | |
556 | + var values = keys.map(function (key) { | |
557 | + return el[key]; | |
558 | + }); | |
559 | + for (var i in values) | |
560 | + if (values[i] && String(values[i]).toLowerCase().indexOf(filter) > -1) | |
561 | + return true; | |
562 | + return false; | |
563 | + }); | |
564 | + } | |
565 | + | |
566 | + this.prev = 1; | |
567 | + this.next = this.step; | |
568 | + this.length = this.shownData.length; | |
569 | + | |
570 | + this.shownPrev = Math.min(this.prev, this.length); | |
571 | + this.shownNext = Math.min(this.next, this.length); | |
572 | + this.shownData = this.shownData.slice(this.prev - 1, this.next); | |
573 | + | |
574 | + $(this.$.tbody).animate({ scrollTop: 0}, 0); | |
575 | + } | |
576 | + }, 300); | |
577 | + }, | |
578 | + | |
579 | + _clearInput : function() { | |
580 | + this.$.filter.value = ""; | |
581 | + }, | |
582 | + | |
583 | + _order : function(e) { | |
584 | + t = $(e.target).parents("paper-icon-button")[0]; | |
585 | + | |
586 | + var icon = t.getAttribute("icon"); | |
587 | + var id = t.getAttribute("id"); | |
588 | + var field = this.fields[id]; | |
589 | + var reverse = false; | |
590 | + | |
591 | + if(icon.indexOf("unfold-more") > -1){ | |
592 | + t.setAttribute("icon", "arrow-drop-up"); | |
593 | + } | |
594 | + else if(icon.indexOf("arrow-drop-up") > -1){ | |
595 | + t.setAttribute("icon", "arrow-drop-down"); | |
596 | + reverse = true; | |
597 | + } | |
598 | + else if(icon.indexOf("arrow-drop-down") > -1){ | |
599 | + t.setAttribute("icon", "arrow-drop-up"); | |
600 | + } | |
601 | + | |
602 | + | |
603 | + if(field.type == "NUMBER") | |
604 | +// this.data = this.data.sort(this._sort_by(field.name, reverse, parseInt)); | |
605 | + this.data = this.data.sort(this._sort_by(field.name, reverse, function(a){return (isNaN(a) ? -Number.MAX_VALUE : a)})); | |
606 | + else | |
607 | + this.data = this.data.sort(this._sort_by(field.name, reverse, function(a){return (a ? a.toLowerCase() : "")})); | |
608 | + this._filter(); | |
609 | + }, | |
610 | + | |
611 | + _sort_by : function(field, reverse, primer){ | |
612 | + | |
613 | + var key = primer ? | |
614 | + function(x) {return primer(x[field])} : | |
615 | + function(x) {return x[field]}; | |
616 | + | |
617 | + reverse = !reverse ? 1 : -1; | |
618 | + | |
619 | + return function (a, b) { | |
620 | + return a = key(a), b = key(b), reverse * ((a > b) - (b > a)); | |
621 | + } | |
622 | + }, | |
623 | + | |
624 | + _toArray: function(obj) { | |
625 | + var regExp = new RegExp(/(https?:\/\/[^\s]+)/g); | |
626 | + return Object.keys(obj).map(function(key) { | |
627 | + if(key != "ID" && key != "cssClass") { | |
628 | + var test = regExp.test(obj[key]); | |
629 | + return { | |
630 | + key: key, | |
631 | + value: test ? obj[key].split(",") : obj[key], | |
632 | + isLink: test | |
633 | + } | |
634 | + } | |
635 | + }); | |
636 | + }, | |
637 | + | |
638 | + _fieldId: function(index) { | |
639 | + return "id_" + index; | |
640 | + }, | |
641 | + | |
642 | + _resize : function(){ | |
643 | + this.async(function() { | |
644 | + var h = $(this.$.data_table_container).height() - 96; | |
645 | + var w = $(this.$.data_table_container).width(); | |
646 | + $(this.$.tbody).width(w).height(h); | |
647 | + $(this.$.tbody).perfectScrollbar('update'); | |
648 | + }, 1); | |
649 | + } | |
650 | + | |
651 | + }); | |
652 | + | |
653 | + </script> | |
654 | + | |
655 | +</dom-module> | |
0 | 656 | \ No newline at end of file | ... | ... |