fb05b400
Renato De Donato
controllet 2.0, n...
|
1
|
<link rel="import" href="../../bower_components/polymer/polymer.html">
|
a53fbbed
Renato De Donato
select-dataset ne...
|
2
3
4
5
6
7
8
9
|
<link rel="import" href="../../bower_components/paper-tabs/paper-tabs.html">
<link rel="import" href="../../bower_components/paper-tabs/paper-tab.html">
<link rel="import" href="../../bower_components/neon-animation/neon-animation.html">
<link rel="import" href="../../bower_components/neon-animation/neon-animatable.html">
<link rel="import" href="../../bower_components/neon-animation/neon-animations.html">
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
10
11
|
<link rel="import" href="../../bower_components/iron-flex-layout/iron-flex-layout.html">
<!--<link rel="import" href="../../bower_components/app-layout/app-toolbar/app-toolbar.html">-->
|
a748d9bc
Renato De Donato
ala NUMBER bug
|
12
|
<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
13
14
15
|
<link rel="import" href="../../bower_components/paper-styles/color.html">
<link rel="import" href="../../bower_components/paper-styles/typography.html">
<link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html">
|
a748d9bc
Renato De Donato
ala NUMBER bug
|
16
|
<link rel="import" href="../../bower_components/iron-icons/iron-icons.html">
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
17
18
|
<link rel="import" href="../../bower_components/iron-image/iron-image.html">
<link rel="import" href="../../bower_components/iron-list/iron-list.html">
|
a748d9bc
Renato De Donato
ala NUMBER bug
|
19
|
|
a53fbbed
Renato De Donato
select-dataset ne...
|
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
<link rel="import" href="../../bower_components/paper-dropdown-menu/paper-dropdown-menu.html">
<link rel="import" href="../../bower_components/paper-menu/paper-menu.html">
<link rel="import" href="../../bower_components/paper-item/paper-item.html">
<link rel="import" href="../../bower_components/paper-input/paper-input.html">
<link rel="import" href="../../bower_components/paper-input/paper-textarea.html">
<link rel="import" href="../../bower_components/paper-material/paper-material.html" />
<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
<link rel="import" href="../../bower_components/iron-icons/hardware-icons.html">
<!--<link rel="import" href="../../bower_components/iron-icons/iron-icons.html">-->
<link rel="import" href="../../bower_components/paper-checkbox/paper-checkbox.html">
|
382b55e7
Renato De Donato
ortelio
|
36
|
<link rel="import" href="ortelio-controllet.html">
|
a53fbbed
Renato De Donato
select-dataset ne...
|
37
|
<link rel="import" href="../../datalets/datasetexplorer-datalet/datasetexplorer-datalet.html">
|
a748d9bc
Renato De Donato
ala NUMBER bug
|
38
|
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
39
|
<dom-module id="select-dataset-controllet">
|
a748d9bc
Renato De Donato
ala NUMBER bug
|
40
|
<template>
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
41
|
<style>
|
a53fbbed
Renato De Donato
select-dataset ne...
|
42
43
44
45
46
47
48
49
50
|
:host {
--paper-dropdown-menu-icon: {
color: #000000;
};
--paper-dropdown-menu-ripple: {
color: #FFFFFF;
};
/*--paper-tab-ink: {*/
/*color: #FFFFFF;*/
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
51
|
/*};*/
|
a53fbbed
Renato De Donato
select-dataset ne...
|
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
}
iron-list {
--iron-list-items-container: {
margin:16px 16px 8px 16px;
};
}
paper-textarea {
width: 100%;
--paper-input-container-focus-color: #2196F3;
}
paper-input {
--paper-input-container-focus-color: #2196F3;
}
paper-dropdown-menu {
width: 100%;
--paper-input-container-focus-color: #2196F3;
}
paper-item.iron-selected {
background-color: #2196F3;
color: #FFFFFF;
}
paper-checkbox {
height: 24px;
/*margin-top: 8px*/
--paper-checkbox-checked-color: #2196F3;
--paper-checkbox-checked-ink-color: #FFFFFF;
--paper-checkbox-unchecked-color: #000000;
--paper-checkbox-unchecked-ink-color: #FFFFFF;
--paper-checkbox-label-color: #000000;
}
paper-icon-button{
height: 48px;
width: 48px;
padding: 0px;
--paper-icon-button-ink-color: #FFFFFF;
}
paper-icon-button:hover{
color: #2196F3;
}
paper-icon-button[disabled]{
color: #B6B6B6;
}
paper-icon-button.clear {
width: 24px;
height: 24px;
padding: 0px 4px;
color: #F44336;
--paper-icon-button-ink-color: #FFFFFF;
}
paper-tabs {
font-weight: bold;
}
paper-tab {
transition: all 1.0s;
}
paper-tab.iron-selected {
background-color: #2196F3;
color: #FFFFFF;
}
paper-tab:not(.iron-selected):hover {
color: #2196F3;
}
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
128
|
.item {
|
a53fbbed
Renato De Donato
select-dataset ne...
|
129
130
131
132
|
/*@apply(--layout-horizontal);*/
display: flex;
padding: 11px;
border: 1px solid #B6B6B6;
|
190145a5
Renato De Donato
style
|
133
|
border-radius: 4px;
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
134
135
|
cursor: pointer;
margin-bottom: 8px;
|
a53fbbed
Renato De Donato
select-dataset ne...
|
136
|
background-color: #E0E0E0;
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
137
138
|
}
|
cd9f822e
Renato De Donato
split 1st step
|
139
140
141
142
143
|
.item.expanded {
/*border: 2px solid #2196F3;*/
border-color: #2196F3;
}
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
144
|
.pad {
|
a53fbbed
Renato De Donato
select-dataset ne...
|
145
146
|
@apply(--layout-flex);
/*@apply(--layout-vertical);*/
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
147
|
}
|
a53fbbed
Renato De Donato
select-dataset ne...
|
148
|
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
149
|
.primary {
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
150
|
font-weight: bold;
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
151
|
}
|
a53fbbed
Renato De Donato
select-dataset ne...
|
152
153
154
|
.item.expanded .primary {
color: #2196F3;
|
a748d9bc
Renato De Donato
ala NUMBER bug
|
155
|
}
|
a53fbbed
Renato De Donato
select-dataset ne...
|
156
|
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
157
|
.longText {
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
158
|
display: none;
|
a748d9bc
Renato De Donato
ala NUMBER bug
|
159
|
}
|
a53fbbed
Renato De Donato
select-dataset ne...
|
160
|
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
161
162
163
|
.item.expanded .longText {
display: block;
}
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
164
|
|
a53fbbed
Renato De Donato
select-dataset ne...
|
165
166
167
|
#select_dataset_container {
margin-top: 8px;
}
|
a748d9bc
Renato De Donato
ala NUMBER bug
|
168
|
|
a53fbbed
Renato De Donato
select-dataset ne...
|
169
|
#select_dataset_container * {
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
170
171
|
font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 16px;
|
a53fbbed
Renato De Donato
select-dataset ne...
|
172
173
|
line-height: 24px;
}
|
a748d9bc
Renato De Donato
ala NUMBER bug
|
174
|
|
a53fbbed
Renato De Donato
select-dataset ne...
|
175
176
177
178
|
#select_dataset_container #neon_container {
height: calc(100% - 172px);
width: calc(100% - 8px);
}
|
a748d9bc
Renato De Donato
ala NUMBER bug
|
179
|
|
cd9f822e
Renato De Donato
split 1st step
|
180
181
|
#select_dataset_container #list_info {
display: flex;
|
a53fbbed
Renato De Donato
select-dataset ne...
|
182
|
height: calc(100% - 48px);
|
cd9f822e
Renato De Donato
split 1st step
|
183
184
185
186
|
width: calc(100% + 8px);/*bad*/
}
#select_dataset_container #list_container {
|
a53fbbed
Renato De Donato
select-dataset ne...
|
187
|
position: relative;
|
cd9f822e
Renato De Donato
split 1st step
|
188
189
|
height: 100%;
width: 50%;
|
382b55e7
Renato De Donato
ortelio
|
190
|
border-left: 4px solid #B6B6B6;
|
cd9f822e
Renato De Donato
split 1st step
|
191
192
193
194
195
196
197
|
}
#select_dataset_container #info_container {
position: relative;
height: 100%;
width: 50%;
border-right: 4px solid #B6B6B6;
|
cd9f822e
Renato De Donato
split 1st step
|
198
199
200
201
202
203
204
205
206
207
208
|
}
#select_dataset_container #info {
position: relative;
height: calc(100% - 56px);
width: calc(100% - 56px);
padding: 11px;
border: 1px solid #B6B6B6;
border-radius: 4px;
background-color: #E0E0E0;
margin: 16px;
|
a748d9bc
Renato De Donato
ala NUMBER bug
|
209
210
|
}
|
a53fbbed
Renato De Donato
select-dataset ne...
|
211
212
213
214
215
216
217
218
219
|
#select_dataset_container #treemap_container {
/*height: calc(100% - 244px);*/
/*width: calc(100% - 8px);*/
height: calc(100% - 48px);
width: 100%;
border: 4px solid #B6B6B6;
border-top: 0px;
border-bottom: 0px;
position: relative;
|
a748d9bc
Renato De Donato
ala NUMBER bug
|
220
221
|
}
|
a53fbbed
Renato De Donato
select-dataset ne...
|
222
|
#select_dataset_container #header {
|
3388b02b
Renato De Donato
shadow x Andrea
|
223
224
225
226
227
228
|
position: relative;
z-index: 1;
-webkit-box-shadow: 0 30px 24px -12px rgba(0, 0, 0, 0.14), 0 20px 30px -9px rgba(0, 0, 0, 0.12), 0 20px 10px -19px rgba(0, 0, 0, 0.4);
-moz-box-shadow: 0 30px 24px -12px rgba(0, 0, 0, 0.14), 0 20px 30px -9px rgba(0, 0, 0, 0.12), 0 20px 10px -19px rgba(0, 0, 0, 0.4);
box-shadow: 0 30px 24px -12px rgba(0, 0, 0, 0.14), 0 20px 30px -9px rgba(0, 0, 0, 0.12), 0 20px 10px -19px rgba(0, 0, 0, 0.4);
|
a748d9bc
Renato De Donato
ala NUMBER bug
|
229
|
background-color: #B6B6B6;
|
a53fbbed
Renato De Donato
select-dataset ne...
|
230
231
232
|
display: flex;
padding: 0px 4px;
}
|
a748d9bc
Renato De Donato
ala NUMBER bug
|
233
|
|
3388b02b
Renato De Donato
shadow x Andrea
|
234
235
236
237
238
239
240
241
242
243
244
245
246
247
|
#select_dataset_container #footer_list {
position: relative;
z-index: 1;
-webkit-box-shadow: 0 -30px 24px -12px rgba(0, 0, 0, 0.14), 0 -20px 30px -9px rgba(0, 0, 0, 0.12), 0 -20px 10px -19px rgba(0, 0, 0, 0.4);
-moz-box-shadow: 0 -30px 24px -12px rgba(0, 0, 0, 0.14), 0 -20px 30px -9px rgba(0, 0, 0, 0.12), 0 -20px 10px -19px rgba(0, 0, 0, 0.4);
box-shadow: 0 -30px 24px -12px rgba(0, 0, 0, 0.14), 0 -20px 30px -9px rgba(0, 0, 0, 0.12), 0 -20px 10px -19px rgba(0, 0, 0, 0.4);
}
.noshadow {
-webkit-box-shadow: none !important;
-moz-box-shadow: none !important;
box-shadow: none !important;
}
|
a53fbbed
Renato De Donato
select-dataset ne...
|
248
249
250
251
252
253
254
255
256
257
258
259
260
261
|
#select_dataset_container #footer_list,
#select_dataset_container #footer_treemap {
width: 100%;
background-color: #B6B6B6;
display: flex;
padding: 0px 4px;
}
#select_dataset_container #url {
height: 76px;/*100*/
border: 4px solid #B6B6B6;
border-top: 0px;
padding: 0px 16px;
margin-top: -4px;
|
a748d9bc
Renato De Donato
ala NUMBER bug
|
262
|
}
|
a53fbbed
Renato De Donato
select-dataset ne...
|
263
264
265
266
267
268
269
270
271
272
273
274
275
|
#header .header_block {
width: 20%;
height: 40px;
padding: 4px 16px 4px 16px;
}
/*.header_block:nth-child(2), .header_block:nth-child(3), .header_block:nth-child(3), .header_block:nth-child(4){*/
/*visibility: hidden;*/
/*}*/
#header .header_block:nth-child(4) {
text-align: center;
|
a748d9bc
Renato De Donato
ala NUMBER bug
|
276
277
|
}
|
a53fbbed
Renato De Donato
select-dataset ne...
|
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
|
.footer_block {
width: calc((100% - 0px) / 3);
height: 24px;
padding: 12px 8px 12px 8px;
text-align: center;
}
.footer_block:nth-child(2) {
height: 48px;
padding: 0px 8px;
}
#suggested_div {
visibility: hidden;
}
|
c5fa9cdb
Renato De Donato
info style
|
293
294
295
296
297
298
|
/*.info_resource_name {*/
/*color: #2196F3;*/
/*font-weight: bold;*/
/*line-height: 48px;*/
/*}*/
|
382b55e7
Renato De Donato
ortelio
|
299
300
301
302
303
304
305
306
|
/*#ortelio {*/
/*/!*height: calc(100% - 172px);*!/*/
/*/!*width: calc(100% - 8px);*!/*/
/*height: 100%;*/
/*width: 100%;*/
/*background-color: red;*/
/*}*/
|
a748d9bc
Renato De Donato
ala NUMBER bug
|
307
308
|
</style>
|
a53fbbed
Renato De Donato
select-dataset ne...
|
309
|
<paper-material id="select_dataset_container" elevation="5">
|
a748d9bc
Renato De Donato
ala NUMBER bug
|
310
|
|
a53fbbed
Renato De Donato
select-dataset ne...
|
311
|
<paper-tabs selected="{{selected}}" no-bar>
|
382b55e7
Renato De Donato
ortelio
|
312
|
<paper-tab on-tap="_refreshList" noink><span id="listView"></span></paper-tab>
|
3388b02b
Renato De Donato
shadow x Andrea
|
313
|
<paper-tab on-tap="_noShadow" noink><span id="treeMapView"></span></paper-tab>
|
382b55e7
Renato De Donato
ortelio
|
314
|
<paper-tab on-tap="_hideSearch" noink><span id="extendedSearch"></span></paper-tab>
|
a53fbbed
Renato De Donato
select-dataset ne...
|
315
|
</paper-tabs>
|
a748d9bc
Renato De Donato
ala NUMBER bug
|
316
|
|
a53fbbed
Renato De Donato
select-dataset ne...
|
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
|
<div id="header">
<div class="header_block">
<paper-dropdown-menu id="ddl_provider" label="" no-label-float>
<paper-menu class="dropdown-content" selected="0">
<paper-item id="0" on-tap="_filter"></paper-item>
<template is="dom-repeat" items={{_toArray(providers)}} as="provider">
<!--<paper-item id={{provider.value.id}} style$="background: {{_getProviderColor(provider.value.id)}};">{{provider.value.title}}</paper-item>-->
<paper-item id={{provider.value.id}} on-tap="_filter">{{provider.value.title}}</paper-item>
</template>
</paper-menu>
</paper-dropdown-menu>
</div>
<div class="header_block">
</div>
<div class="header_block">
</div>
<div class="header_block">
</div>
<div class="header_block">
<paper-input id="datasets_filter" value={{filter}} no-label-float label="">
<iron-icon class="search" icon="search" prefix></iron-icon>
<paper-icon-button class="clear" suffix on-click="_clearInput" icon="clear" tabindex="0"></paper-icon-button>
</paper-input>
</div>
|
a748d9bc
Renato De Donato
ala NUMBER bug
|
341
342
|
</div>
|
a53fbbed
Renato De Donato
select-dataset ne...
|
343
344
345
|
<neon-animated-pages id="neon_container" selected="{{selected}}" entry-animation="fade-in-animation" exit-animation="fade-out-animation">
<neon-animatable>
|
cd9f822e
Renato De Donato
split 1st step
|
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
|
<div id="list_info">
<div id="list_container">
<iron-list id="list" items="{{shownDatasets}}" selection-enabled>
<template>
<div>
<div class$="{{getClassForItem(selected)}}" on-tap="_selectDataUrl" style$="background: {{_getColorForItem(item)}};">
<span style="display:none;">{{item.url}}</span>
<div class="pad">
<div class="primary">{{item.resource_name}}</div>
<!--<div class="longText">-->
<!--<template is="dom-repeat" items="{{_stringToArray(item.metas)}}" as="mata">-->
<!--<b>{{mata.name}}:</b>-->
<!--<span inner-h-t-m-l="{{mata.value}}"></span> <br>-->
<!--</template>-->
<!--</div>-->
|
a53fbbed
Renato De Donato
select-dataset ne...
|
361
|
</div>
|
cd9f822e
Renato De Donato
split 1st step
|
362
|
<iron-icon icon$="{{_getIconForItem(item)}}" style$="color: {{_getColorForIcon(item)}};"></iron-icon>
|
a53fbbed
Renato De Donato
select-dataset ne...
|
363
|
</div>
|
a53fbbed
Renato De Donato
select-dataset ne...
|
364
|
</div>
|
cd9f822e
Renato De Donato
split 1st step
|
365
366
367
368
369
370
371
|
</template>
</iron-list>
</div>
<div id="info_container">
<div id="info">
</div>
</div>
|
a53fbbed
Renato De Donato
select-dataset ne...
|
372
373
374
375
376
377
378
379
380
381
382
383
|
</div>
<div id="footer_list">
<div class="footer_block"><span id="showing"></span> {{shownPrev}} <span id="to"></span> {{shownNext}} <span id="of"></span> {{length}} <span id="datasets"></span></div>
<div class="footer_block">
<paper-icon-button id="slider_chevron_left" class="chevron-left" on-click="_onPrevClick" icon="chevron-left"></paper-icon-button>
<paper-icon-button id="slider_chevron_right" class="chevron-right" on-click="_onNextClick" icon="chevron-right"></paper-icon-button>
</div>
<div id="suggested_div" class="footer_block">
<!--<template is="dom-if" if={{suggestedDatasets}}>-->
<paper-checkbox checked on-change="showSuggested"><span id="suggested_datasets"></span></paper-checkbox>
<!--</template>-->
|
a748d9bc
Renato De Donato
ala NUMBER bug
|
384
|
</div>
|
a53fbbed
Renato De Donato
select-dataset ne...
|
385
386
387
388
389
390
391
392
393
394
395
396
|
</div>
</neon-animatable>
<neon-animatable>
<div id="treemap_container"></div>
<div id="footer_treemap">
<div class="footer_block"><span id="showing2"></span> {{tLength}} <span id="datasets2"></span></div>
<div class="footer_block"></div>
<div class="footer_block"></div>
</div>
</neon-animatable>
|
a748d9bc
Renato De Donato
ala NUMBER bug
|
397
|
|
382b55e7
Renato De Donato
ortelio
|
398
399
400
401
402
403
|
<neon-animatable>
<!--<div id="ortelio">-->
<ortelio-controllet datasets={{datasets}}></ortelio-controllet>
<!--</div>-->
</neon-animatable>
|
a53fbbed
Renato De Donato
select-dataset ne...
|
404
405
406
407
|
</neon-animated-pages>
<div id="url">
<paper-textarea id="selected_url" label="" value={{dataUrl}} error-message={{errorMessage}}></paper-textarea>
|
a748d9bc
Renato De Donato
ala NUMBER bug
|
408
409
|
</div>
|
a53fbbed
Renato De Donato
select-dataset ne...
|
410
|
</paper-material>
|
a748d9bc
Renato De Donato
ala NUMBER bug
|
411
412
413
414
|
</template>
<script>
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
415
416
417
418
|
HTMLImports.whenReady(function() {
Polymer({
is: 'select-dataset-controllet',
properties: {
|
a53fbbed
Renato De Donato
select-dataset ne...
|
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
|
datasets: {
type: Object,
value: undefined
},
filteredDatasets : {
type : Array,
value : undefined
},
shownDatasets : {
type : Array,
value : undefined
},
suggestedDatasets : {
type : Array,
value : undefined
},
providers : {
type : Array,
value : undefined
},
dataUrl : {
type : String,
value : undefined,
observer : '_fireDataUrl'
},
filter : {
type : String,
value : "",
observer : '_filter'
},
selected : {
type : Number,
value : 0
},
prev : {type : Number, value : undefined},
next : {type : Number, value : undefined},
shownPrev : {type : Number, value : undefined},
shownNext : {type : Number, value : undefined},
length : {type : Number, value : undefined},
tLength : {type : Number, computed : 'treemapLength(length)'},
step : {type : Number, value : 20},
colors : {
type : Array,
value : ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"]
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
464
|
}
|
a748d9bc
Renato De Donato
ala NUMBER bug
|
465
|
},
|
a53fbbed
Renato De Donato
select-dataset ne...
|
466
467
468
469
470
|
listeners: {
'datasetexplorer-datalet_data-url': '_selectDataUrl_treeMap'
},
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
471
472
|
ready : function() {
$(this.$.list_container).perfectScrollbar();
|
cd9f822e
Renato De Donato
split 1st step
|
473
|
$(this.$.info).perfectScrollbar();
|
a53fbbed
Renato De Donato
select-dataset ne...
|
474
475
|
// this.$.selected_url.invalid = true;
|
a748d9bc
Renato De Donato
ala NUMBER bug
|
476
477
|
},
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
478
|
attached: function() {
|
a53fbbed
Renato De Donato
select-dataset ne...
|
479
480
|
this._resize();
var that = this;
|
20799010
Renato De Donato
treemap resize
|
481
|
window.addEventListener("resize", function() { that._resize(); that._loadTreeMap();});
|
a53fbbed
Renato De Donato
select-dataset ne...
|
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
|
this.providers = this.datasets["result"]["providers"];
this.datasets = this.datasets["result"]["datasets"];
if(this.suggestedDatasets) {
this.tempDatasets = this.datasets;
this.datasets = this.suggestedDatasets.concat(this.datasets);
this.$.suggested_div.style.visibility = "visible";
}
this.filteredDatasets = this.datasets;
this.prev = 1;
this.next = this.step;
this.length = this.filteredDatasets.length;
this.shownPrev = Math.min(this.prev, this.length);
this.shownNext = Math.min(this.next, this.length);
this.shownDatasets = this.filteredDatasets.slice(this.prev-1, this.next);
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
502
|
this.$.list.scrollTarget = this.ownerDocument.documentElement;
|
a53fbbed
Renato De Donato
select-dataset ne...
|
503
504
505
506
507
508
509
510
511
|
this._translate();
this._loadTreeMap();
},
_translate : function(){
this.$.listView.innerHTML = ln["listView_" + ln["localization"]];
this.$.treeMapView.innerHTML = ln["treeMapView_" + ln["localization"]];
|
382b55e7
Renato De Donato
ortelio
|
512
|
this.$.extendedSearch.innerHTML = ln["extendedSearch_" + ln["localization"]];
|
a53fbbed
Renato De Donato
select-dataset ne...
|
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
|
this.$.ddl_provider.setAttribute("label", ln["provider_" + ln["localization"]]);
this.$.datasets_filter.setAttribute("label", ln["search_" + ln["localization"]]);
this.$.suggested_datasets.innerHTML = ln["suggestedDatasets_" + ln["localization"]];
this.$.showing.innerHTML = ln["showing_" + ln["localization"]];
this.$.showing2.innerHTML = ln["showing_" + ln["localization"]];
this.$.to.innerHTML = ln["to_" + ln["localization"]];
this.$.of.innerHTML = ln["of_" + ln["localization"]];
this.$.datasets.innerHTML = ln["datasets_" + ln["localization"]];
this.$.datasets2.innerHTML = ln["datasets_" + ln["localization"]];
this.$.selected_url.setAttribute("label", ln["selectedUrl_" + ln["localization"]]);
this.errorMessage = ln["wrongUrl_" + ln["localization"]];
|
a748d9bc
Renato De Donato
ala NUMBER bug
|
528
|
},
|
a53fbbed
Renato De Donato
select-dataset ne...
|
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
|
showSuggested : function(e) {
if(e.target.checked)
this.datasets = this.suggestedDatasets.concat(this.tempDatasets);
else
this.datasets = this.tempDatasets;
this._filter();
},
_loadTreeMap : function(){
var h = $("#neon_container").height() - 48;
var w = $("#neon_container").width();
var data = JSON.stringify({result : {providers: this.providers, datasets: this.filteredDatasets}}).replace(/'/g, "");
if(this.filteredDatasets.length > 0)
this.$.treemap_container.innerHTML = "<datasetexplorer-datalet data='"+data+"' width=\""+w+"\" height=\""+h+"\" fields='[\"result,datasets,provider_name\",\"result,datasets,organization_name\",\"result,datasets,package_name\",\"result,datasets,resource_name\",\"result,datasets,url\",\"result,datasets,w\",\"result,datasets,metas\"]'></datasetexplorer-datalet>";
else
this.$.treemap_container.innerHTML = "";
},
_filter : function() {
if(this.filteredDatasets) {
this.async(function () {
var ddl_provider = $(this.$.ddl_provider).find("paper-menu")[0].selectedItem;
var name = ddl_provider.innerHTML.trim();
var id = this._getIdByProviderName(name);
this.prev = 1;
this.next = this.step;
if (id) {
//filtered by provider name
this.filteredDatasets = this.datasets.filter(function (el) {
return el.provider_name == "p:" + id;
});
}
else {
this.filteredDatasets = this.datasets;
}
//filtered by filter
var filter = this.filter;
this.filteredDatasets = this.filteredDatasets.filter(function (el) {
return el.resource_name.toLowerCase().indexOf(filter.toLowerCase()) > -1;
});
this.length = this.filteredDatasets.length;
this.shownPrev = Math.min(this.prev, this.length);
this.shownNext = Math.min(this.next, this.length);
this.shownDatasets = this.filteredDatasets.slice(this.prev - 1, this.next);
$("#list_container").animate({scrollTop: 0}, 0);
this._loadTreeMap();
}, 0);
}
},
_refreshList : function() {
this.shownDatasets = this.filteredDatasets.slice(this.prev - 1, this.next);
|
382b55e7
Renato De Donato
ortelio
|
589
590
591
592
593
|
this.$.header.style.display = "flex";
this.$.header.style.visibility = "visible";
// this.$.url.style.marginTop = "-4px";
|
3388b02b
Renato De Donato
shadow x Andrea
|
594
595
596
597
|
this.$.header.className = this.$.header.className.replace(" noshadow", "");
},
_noShadow : function() {
|
382b55e7
Renato De Donato
ortelio
|
598
599
600
601
|
this.$.header.style.display = "flex";
this.$.header.style.visibility = "visible";
// this.$.url.style.marginTop = "-4px";
|
3388b02b
Renato De Donato
shadow x Andrea
|
602
|
this.$.header.className += " noshadow";
|
a53fbbed
Renato De Donato
select-dataset ne...
|
603
604
|
},
|
382b55e7
Renato De Donato
ortelio
|
605
606
607
608
609
610
|
_hideSearch : function() {
// this.$.header.style.display = "none";
this.$.header.style.visibility = "hidden";
// this.$.url.style.marginTop = "44px";
},
|
a53fbbed
Renato De Donato
select-dataset ne...
|
611
612
|
_clearInput : function() {
this.$.datasets_filter.value = "";
|
a748d9bc
Renato De Donato
ala NUMBER bug
|
613
|
},
|
a53fbbed
Renato De Donato
select-dataset ne...
|
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
|
_getIdByProviderName : function(name) {
for(var id in this.providers) {
if (this.providers[id].title == name)
return this.providers[id].id;
}
},
// iconForItem: function(item) {
// return item ? (item.integer < 50 ? 'star-border' : 'info-outline') : '';
// },
treemapLength : function(length) {
var ddl_provider = $(this.$.ddl_provider).find("paper-menu")[0].selectedItem;
var name = ddl_provider.innerHTML.trim();
var id = this._getIdByProviderName(name);
if(this.suggestedDatasets && !id)
return Math.max(length - this.suggestedDatasets.length, 0);
return length;
},
_getColorForIcon : function(item) {
var ddl_provider = $(this.$.ddl_provider).find("paper-menu")[0].selectedItem;
var name = ddl_provider.innerHTML.trim();
var id = this._getIdByProviderName(name);
if (id) {
return this.colors[0];
}
if(!item.provider_name) {
return "#00BCD4";
}
var id = item.provider_name.substring(2, item.provider_name.length);
var i = this.getProviderById(id) % this.colors.length;
return this.colors[i];
},
_getColorForItem : function(item) {
// var ddl_provider = $(this.$.ddl_provider).find("paper-menu")[0].selectedItem;
// var name = ddl_provider.innerHTML.trim();
// var id = this._getIdByProviderName(name);
// if (id) {
// return this.colors[0];
// }
if(!item.provider_name) {
return "#FFEB3B";
}
// var id = item.provider_name.substring(2, item.provider_name.length);
// var i = this.getProviderById(id) % this.colors.length;
// return this.colors[i];
},
_getIconForItem : function(item) {
return item.provider_name ? 'bookmark' : 'star';
},
// _getProviderColor: function(id) {
// var i = this.getProviderById(id) % this.colors.length;
// return this.colors[i];
// },
getClassForItem: function(selected) {
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
676
|
return selected ? 'item expanded' : 'item';
|
a53fbbed
Renato De Donato
select-dataset ne...
|
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
|
},
getProviderById: function(providerId) {
var i = 0;
for(var id in this.providers){
if(this.providers[id].id == providerId)
return i;
i++;
}
},
_onPrevClick : function(){
if(this.prev != 1) {
this.prev -= this.step;
this.next -= this.step;
this.shownPrev = Math.min(this.prev, this.length);
this.shownNext = Math.min(this.next, this.length);
this.shownDatasets = this.filteredDatasets.slice(this.prev - 1, this.next);
}
$("#list_container").animate({ scrollTop: 0}, 0);
},
_onNextClick : function(){
if(this.next < this.length) {
this.prev += this.step;
this.next += this.step;
this.shownPrev = Math.min(this.prev, this.length);
this.shownNext = Math.min(this.next, this.length);
this.shownDatasets = this.filteredDatasets.slice(this.prev - 1, this.next);
}
$("#list_container").animate({ scrollTop: 0}, 0);
},
_stringToArray: function(obj) {
obj = JSON.parse(obj);
return Object.keys(obj).map(function(key) {
return {
name: key,
value: obj[key]
};
});
},
_toArray: function(obj) {
return Object.keys(obj).map(function(key) {
return {
name: key,
value: obj[key]
};
});
},
_selectDataUrl : function(){
this.async(function () {
if(this.$.list.selectedItem) {
|
cd9f822e
Renato De Donato
split 1st step
|
734
735
|
var metas = JSON.parse(this.$.list.selectedItem.metas);
|
c5fa9cdb
Renato De Donato
info style
|
736
737
738
|
var html = "<span style=\"color: #2196F3; font-weight: bold;\">" + this.$.list.selectedItem.resource_name + "</span><br><br>";
/*font-weight: bold;*/
/*line-height: 48px;*/
|
cd9f822e
Renato De Donato
split 1st step
|
739
740
741
742
|
for(var i in metas)
html += "<b>" + i + ":</b> " + metas[i] + "<br>";
this.$.info.innerHTML = html;
|
a53fbbed
Renato De Donato
select-dataset ne...
|
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
|
var url = this.$.list.selectedItem.url;
// Check if CKAN
var strDatasetPos = url.indexOf('/dataset/');
var strResourcePos = (strDatasetPos >= 0) ? url.indexOf('/resource/') : -1;
if (strDatasetPos >= 0 && strResourcePos > strDatasetPos) {
var urlSegment1 = url.substring(0, strDatasetPos);
var urlResourceEnd = url.indexOf('/', strResourcePos + 10);
var resourceId = url.substring(strResourcePos + 10, urlResourceEnd);
url = urlSegment1 + "/api/action/datastore_search?resource_id=" + resourceId;
}
// Check if OPENDATASOFT
var strExploreDatasetPos = url.indexOf('/explore/dataset/');
if (strExploreDatasetPos >= 0) {
var urlSegment1 = url.substring(0, strExploreDatasetPos);
var datasetEnd = url.indexOf(strExploreDatasetPos + 17, '/');
var datasetId = url.substring(strExploreDatasetPos + 17, datasetEnd >= 0 ? datasetEnd : url.length);
url = urlSegment1 + '/api/records/1.0/search?dataset=' + datasetId;
}
this.dataUrl = this._addlimitUrl(url);
}
else {
this.dataUrl = "";
|
cd9f822e
Renato De Donato
split 1st step
|
768
|
this.$.info.innerHTML = "";
|
a53fbbed
Renato De Donato
select-dataset ne...
|
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
|
}
}, 0);
},
_selectDataUrl_treeMap : function(e) {
this.dataUrl = this._addlimitUrl(e.detail.url);
},
_fireDataUrl : function(){
this.fire('dataset-selection-controllet_data-url', {url: this.dataUrl});
},
_addlimitUrl : function(url){
//CKAN --> action no limit
if((url.indexOf("api/action") > -1) && !(url.indexOf("limit") > -1))
{
url += "&limit=99999";
}
//OpenDataSoft --> action no limit
if((url.indexOf("api/records") > -1) && !(url.indexOf("rows") > -1)){
url += "&rows=10000";
}
return url;
},
_resize : function(){
var h = Math.max(document.documentElement.clientHeight, window.innerHeight || 0) - 16;
h = h - 64 - 8; //height with page scroller
$("#select_dataset_container").height(h);
|
a748d9bc
Renato De Donato
ala NUMBER bug
|
798
|
}
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
799
|
});
|
a748d9bc
Renato De Donato
ala NUMBER bug
|
800
|
});
|
a748d9bc
Renato De Donato
ala NUMBER bug
|
801
|
</script>
|
a748d9bc
Renato De Donato
ala NUMBER bug
|
802
|
</dom-module>
|