a31f0660
root
sevc-controllet i...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
<link rel="import" href="../../bower_components/polymer/polymer.html">
<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">
<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-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/iron-icons.html">
<link rel="import" href="../../bower_components/iron-icon/iron-icon.html">
<link rel="import" href="../../bower_components/paper-dialog/paper-dialog.html">
<link rel="import" href="../../bower_components/paper-dialog-scrollable/paper-dialog-scrollable.html">
<link rel="import" href="../../datalets/datasetexplorer-datalet/datasetexplorer-datalet.html">
<!--<script src="../../datalets/shared_js/d3.js"></script>-->
|
4bf5f658
root
update tree map, ...
|
29
30
|
<link rel="import" href="paper-input-search.html">
|
a31f0660
root
sevc-controllet i...
|
31
32
33
34
35
|
<dom-module id="dataset-selection-controllet">
<template>
<style is="custom-style">
|
e0e4a976
Renato De Donato
data-sevc-control...
|
36
37
38
39
40
41
|
:host {
--paper-dropdown-menu-icon: {
color: #2196F3;
};
}
|
a31f0660
root
sevc-controllet i...
|
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
paper-tabs {
font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 16px;
font-weight: bold;
--paper-tabs-selection-bar-color: #2196F3;
}
paper-tab {
transition: all 1.0s;
}
paper-tab.iron-selected {
background-color: #B6B6B6;
}
paper-tab:hover {
color: #2196F3;
}
paper-tab[disabled] {
color: #B6B6B6;
}
|
e0e4a976
Renato De Donato
data-sevc-control...
|
65
66
67
68
69
70
71
72
73
74
|
paper-dropdown-menu {
/*display: block;*/
width: 45%;
margin-bottom: 32px;
--paper-input-container-focus-color: #2196F3;
}
paper-dropdown-menu paper-item {
white-space: nowrap;
}
|
0f6424fe
root
update new data-s...
|
75
76
|
paper-input-search {
|
a31f0660
root
sevc-controllet i...
|
77
78
79
80
81
|
width: 45%;
margin-bottom: 32px;
--paper-input-container-focus-color: #2196F3;
}
|
0f6424fe
root
update new data-s...
|
82
83
84
85
|
paper-input-search paper-item {
white-space: nowrap;
}
|
a31f0660
root
sevc-controllet i...
|
86
87
88
89
90
|
paper-item.iron-selected {
background-color: #2196F3;
color: #FFFFFF;
}
|
e0e4a976
Renato De Donato
data-sevc-control...
|
91
92
|
.ddl_container {
position: relative;
|
4bf5f658
root
update tree map, ...
|
93
94
|
}
|
e0e4a976
Renato De Donato
data-sevc-control...
|
95
96
97
98
99
100
101
102
|
.info_button {
/*background-color: red;*/
position: absolute;
top: 18px;
left: 45%;
}
/*paper-menu{*/
|
e8487078
Renato De Donato
data-sevc: MODIFY...
|
103
|
/*/!*visibility: visible ! important;*!/*/
|
e0e4a976
Renato De Donato
data-sevc-control...
|
104
105
|
/*}*/
|
a31f0660
root
sevc-controllet i...
|
106
|
/*paper-item[focused] {*/
|
e8487078
Renato De Donato
data-sevc: MODIFY...
|
107
|
/*background: #FFFFFF;*/
|
a31f0660
root
sevc-controllet i...
|
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
/*}*/
paper-textarea {
width: 90%;
margin-bottom: 32px;
--paper-input-container-focus-color: #2196F3;
}
paper-icon-button {
color: #2196F3;
--paper-icon-button-ink-color: #2196F3;
}
paper-icon-button[disabled] {
color: #B6B6B6;
}
#material_container {
margin-top: 8px;
/*height: 55vh;*/
}
#div_selection {
padding-left: 10%;
padding-top: 64px;
/*padding-bottom: 64px;*/
}
#dialog_info {
border: 2px solid #2196F3;
background-color: #E0E0E0;
position: fixed;
top: 232px;
width: 60%;
height: auto;
/*overflow: auto;*/
}
#div_datasetexplorer {
|
f6aff0c5
Renato De Donato
loader
|
147
|
/*padding-top: 48px;*/
|
a31f0660
root
sevc-controllet i...
|
148
149
150
151
152
|
}
</style>
<paper-material id="material_container" elevation="5">
|
4a58f4fc
Renato De Donato
treemap placeholder
|
153
|
<paper-tabs selected="{{selected}}">
|
e0e4a976
Renato De Donato
data-sevc-control...
|
154
|
<paper-tab noink>LIST VIEW</paper-tab>
|
0f6424fe
root
update new data-s...
|
155
|
<paper-tab noink>TREE MAP VIEW</paper-tab>
|
a31f0660
root
sevc-controllet i...
|
156
157
158
159
160
161
162
163
|
<paper-tab noink disabled>MOST POPULAR</paper-tab>
</paper-tabs>
<neon-animated-pages selected="{{selected}}" entry-animation="fade-in-animation" exit-animation="fade-out-animation">
<neon-animatable>
<div id="div_selection">
|
e0e4a976
Renato De Donato
data-sevc-control...
|
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
<div class="ddl_container">
<paper-input-search id="input_search" label="Available datasets">
<paper-menu class="dropdown-content">
<template is="dom-repeat" items={{filteredDatasets}} as="dataset">
<paper-item id={{index}} on-tap="_selectDataUrl">{{dataset.name}}</paper-item>
<!--<paper-item id={{index}} on-tap="_selectDataUrl">{{_addHTMLSpace(dataset.name)}}</paper-item>-->
</template>
</paper-menu>
</paper-input-search>
<div class="info_button">
<paper-icon-button id="info_dataset" disabled on-click="_showInfo" icon="info-outline" title="dataset info"></paper-icon-button>
</div>
</div>
|
fb432ae9
Renato De Donato
suggested
|
179
|
<template is="dom-if" if={{isSuggested}}>
|
e0e4a976
Renato De Donato
data-sevc-control...
|
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
|
<div class="ddl_container">
<paper-dropdown-menu label="Suggested datasets">
<paper-menu class="dropdown-content">
<template is="dom-repeat" items={{suggestedDatasets}} as="dataset">
<paper-item id={{index}} on-tap="_selectDataUrl">{{dataset.name}}</paper-item>
<!--<paper-item id={{index}} on-tap="_selectDataUrl">{{_addHTMLSpace(dataset.name)}}</paper-item>-->
</template>
</paper-menu>
</paper-dropdown-menu>
<div class="info_button">
<paper-icon-button id="info_s_dataset" disabled on-click="_showInfo" icon="info-outline" title="dataset info"></paper-icon-button>
</div>
</div>
</template>
|
0f6424fe
root
update new data-s...
|
196
|
|
a31f0660
root
sevc-controllet i...
|
197
198
|
<paper-textarea id="selected_url" label="Selected url" value={{dataUrl}}></paper-textarea>
|
e0e4a976
Renato De Donato
data-sevc-control...
|
199
|
<!--aggiustami anche dialog...-->
|
a31f0660
root
sevc-controllet i...
|
200
201
202
203
204
205
206
207
208
|
<paper-dialog id="dialog_info">
<h2 id="dialog_name"></h2>
<p id="dialog_description"></p>
</paper-dialog>
</div>
</neon-animatable>
<neon-animatable>
|
f6aff0c5
Renato De Donato
loader
|
209
210
|
<div id="div_datasetexplorer"></div>
<!--<datasetexplorer-datalet class="datasetexplorer" data-url="/openwall/api/datasetTree" fields='["result,provider_name","result,organization_name","result,package_name","result,resource_name","result,url","result,w"]'></datasetexplorer-datalet>-->
|
4a58f4fc
Renato De Donato
treemap placeholder
|
211
|
<!--<datasetexplorer-datalet id="datasetexplorer" data-url="/oxwall_x.y.z/openwall/api/datasetTree" fields='["result,provider_name","result,organization_name","result,package_name","result,resource_name","result,url","result,w"]'></datasetexplorer-datalet>-->
|
f6aff0c5
Renato De Donato
loader
|
212
|
<!--</div>-->
|
a31f0660
root
sevc-controllet i...
|
213
214
215
|
</neon-animatable>
<neon-animatable>
|
e0e4a976
Renato De Donato
data-sevc-control...
|
216
|
<!--popular-->
|
a31f0660
root
sevc-controllet i...
|
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
|
</neon-animatable>
</neon-animated-pages>
</paper-material>
</template>
<script>
Polymer({
is : 'dataset-selection-controllet',
properties : {
selected : {
type : Number,
value : 0
},
datasets : {
type : Array,
value : undefined
},
|
0f6424fe
root
update new data-s...
|
243
244
245
246
247
|
filteredDatasets : {
type : Array,
value : []
},
|
e0e4a976
Renato De Donato
data-sevc-control...
|
248
249
250
251
252
|
suggestedDatasets : {
type : Array,
value : undefined
},
|
fb432ae9
Renato De Donato
suggested
|
253
254
255
256
257
|
isSuggested : {
type : Boolean,
value : false
},
|
a31f0660
root
sevc-controllet i...
|
258
259
260
261
262
263
264
265
266
|
dataUrl : {
type : String,
value : undefined,
observer : '_fireDataUrl'
}
},
listeners: {
|
0f6424fe
root
update new data-s...
|
267
268
|
'datasetexplorer-datalet_data-url': '_selectDataUrl_treeMap',
'paper-input-search_input-value' : '_filterDatasets'
|
a31f0660
root
sevc-controllet i...
|
269
270
271
|
},
ready : function(){
|
f6aff0c5
Renato De Donato
loader
|
272
|
$(this.$.material_container).perfectScrollbar();
|
a31f0660
root
sevc-controllet i...
|
273
274
275
276
277
278
279
|
$(this.$.dialog_info).perfectScrollbar();
},
attached : function(){
this._resize();
var that = this;
window.addEventListener("resize", function() { that._resize(); });
|
0f6424fe
root
update new data-s...
|
280
281
|
this.filteredDatasets = this.datasets;
|
0f6424fe
root
update new data-s...
|
282
|
|
e0e4a976
Renato De Donato
data-sevc-control...
|
283
|
if(this.suggestedDatasets)
|
fb432ae9
Renato De Donato
suggested
|
284
|
this.isSuggested = true;
|
4a58f4fc
Renato De Donato
treemap placeholder
|
285
286
|
this._loadTreeMap();
|
e0e4a976
Renato De Donato
data-sevc-control...
|
287
288
|
},
|
fb432ae9
Renato De Donato
suggested
|
289
290
291
292
293
294
|
// _isSuggested : function(){
// if(this.suggestedDatasets)
// return true;
// return false;
// },
|
0f6424fe
root
update new data-s...
|
295
|
_filterDatasets : function(e){
|
47c1dcd5
root
selectio-controll...
|
296
|
var filter = e.detail.inputValue;
|
0f6424fe
root
update new data-s...
|
297
298
299
300
301
302
303
|
var filteredDatasets = [];
for (var i in this.datasets){
if(this.datasets[i].name.toLowerCase().indexOf(filter.toLowerCase()) != -1)
filteredDatasets.push(this.datasets[i]);
}
this.filteredDatasets = filteredDatasets;
|
a31f0660
root
sevc-controllet i...
|
304
305
306
|
},
_loadTreeMap : function(){
|
4a58f4fc
Renato De Donato
treemap placeholder
|
307
308
309
310
|
var h = $("#material_container").height() - 48;
var w = $("#material_container").width();
// if(this.selected != 1 && this.$.div_datasetexplorer.innerHTML == "")
|
3501c407
Renato De Donato
treemap placeholder
|
311
|
this.$.div_datasetexplorer.innerHTML = "<datasetexplorer-datalet width=\""+w+"\" height=\""+h+"\" data-url=\"/openwall/api/datasetTree\" fields='[\"result,provider_name\",\"result,organization_name\",\"result,package_name\",\"result,resource_name\",\"result,url\",\"result,w\"]'></datasetexplorer-datalet>";
|
a31f0660
root
sevc-controllet i...
|
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
|
},
_selectDataUrl_treeMap : function(e){
var url = e.detail.url;
url = url.split('/');
var index = url.indexOf('resource')
if (index != -1) { // ckan
var resourceId = url[index + 1];
url = "http://ckan.routetopa.eu/api/action/datastore_search?resource_id=" + resourceId;
} else
url = "sorry, data provider not supported yet";
this.dataUrl = url;
this.selected=0;
},
_selectDataUrl : function(e){
|
47c1dcd5
root
selectio-controll...
|
330
|
var dataset = this.filteredDatasets[parseInt(e.target.id)]
|
a31f0660
root
sevc-controllet i...
|
331
|
|
e0e4a976
Renato De Donato
data-sevc-control...
|
332
|
// this.$.input_search.value = "";
|
a31f0660
root
sevc-controllet i...
|
333
334
|
this.dataUrl = dataset.url;
|
e0e4a976
Renato De Donato
data-sevc-control...
|
335
336
337
338
339
340
341
|
// if(dataset.description != ""){
// this.$.info_button.removeAttribute("disabled");
// this.$.dialog_name.innerHTML = dataset.name;
// this.$.dialog_description.innerHTML = dataset.description;
// }
// else
// this.$.info_button.setAttribute("disabled", "true");
|
a31f0660
root
sevc-controllet i...
|
342
343
344
345
346
347
348
349
350
351
|
},
_showInfo : function(){
this.$.dialog_info.open();
},
_fireDataUrl : function(){
this.fire('dataset-selection-controllet_data-url', {url: this.dataUrl});
},
|
0f6424fe
root
update new data-s...
|
352
353
354
355
|
// _addHTMLSpace : function(name){
// return name.replace(/ /g, ' ');
// },
|
a31f0660
root
sevc-controllet i...
|
356
357
358
359
360
361
362
363
364
365
366
|
_resize : function(){
var h = Math.max(document.documentElement.clientHeight, window.innerHeight || 0) - 16;
h = h - 64 - 8; //height with page scroller
$("#material_container").height(h);
}
});
</script>
</dom-module>
|