Commit b9c01bab556e6277220a4e996c574ea88f165803

Authored by pina
2 parents bd478cd0 2b65b828

Merge branch 'master' of http://service.routetopa.eu:7480/WebCompDev/COMPONENTS

controllets/data-sevc-controllet/data-sevc-controllet.html
@@ -135,7 +135,7 @@ @@ -135,7 +135,7 @@
135 // slider.setTitle("SELECT DATA", "Select the fields from tree-view. The multi-table will show the values related to the selected fields."); 135 // slider.setTitle("SELECT DATA", "Select the fields from tree-view. The multi-table will show the values related to the selected fields.");
136 if(this.modify){ 136 if(this.modify){
137 slider.chevronLeft("invisible"); 137 slider.chevronLeft("invisible");
138 - slider.setAvatar("2"); 138 +// slider.setAvatar("2");
139 } 139 }
140 else{ 140 else{
141 slider.chevronLeft(true); 141 slider.chevronLeft(true);
controllets/datalet-selection-controllet/datalet-selection-controllet.html
@@ -209,7 +209,7 @@ @@ -209,7 +209,7 @@
209 <paper-dropdown-menu id={{ddl_index}} label={{item.name}}> 209 <paper-dropdown-menu id={{ddl_index}} label={{item.name}}>
210 <paper-menu class="dropdown-content"> 210 <paper-menu class="dropdown-content">
211 <template is="dom-repeat" items={{fields}}> 211 <template is="dom-repeat" items={{fields}}>
212 - <paper-item id={{index}} on-tap="_addInput">{{item}}</paper-item> 212 + <paper-item id={{index}} on-tap="_addInput">{{_fieldName(item)}}</paper-item>
213 <!--{{_fieldName(item)}}--> 213 <!--{{_fieldName(item)}}-->
214 </template> 214 </template>
215 </paper-menu> 215 </paper-menu>
@@ -374,8 +374,10 @@ @@ -374,8 +374,10 @@
374 374
375 //this.modify = true;//da eliminare in futuro 375 //this.modify = true;//da eliminare in futuro
376 if(this.preselectedDatalet){ 376 if(this.preselectedDatalet){
  377 + if(this.modify)
  378 + this._preselectDatalet();
  379 +
377 this.modify = true; 380 this.modify = true;
378 - this._preselectDatalet();  
379 this.preselectedDatalet = undefined; 381 this.preselectedDatalet = undefined;
380 } 382 }
381 }, 383 },
@@ -425,22 +427,29 @@ @@ -425,22 +427,29 @@
425 }, 427 },
426 428
427 _preselectDatalet : function() { 429 _preselectDatalet : function() {
  430 + this.type = "undefined";
  431 + this.$.selectedDatalet_request.url = this.deepUrl + this.preselectedDatalet + "-datalet";
  432 + this.$.selectedDatalet_request.generateRequest();
  433 +
428 this.selectedDatalet = this.preselectedDatalet; 434 this.selectedDatalet = this.preselectedDatalet;
429 this.selectedFields = this._copy(this.fields); 435 this.selectedFields = this._copy(this.fields);
430 436
431 - var inputs = document.getElementsByTagName("paper-dropdown-menu");  
432 - for(var i=0; i < inputs.length; i++)  
433 - $(inputs[i]).find("paper-menu")[0].select(i); 437 + this.async(function() {
  438 + this.selectedFields = this._copy(this.fields);
434 439
435 - //set info labels options  
436 - var labels = this.$.datalet_selection_labels.querySelectorAll("paper-textarea");  
437 - for (var i = 0; i < labels.length; i++)  
438 - labels[i].value = this.dataletPreset[labels[i].label]; 440 + var inputs = document.getElementsByTagName("paper-dropdown-menu");
  441 + for (var i = 0; i < inputs.length; i++)
  442 + $(inputs[i]).find("paper-menu")[0].select(i);
439 443
440 - var labels = this.$.datalet_selection_labels.querySelectorAll("paper-input");  
441 - for (var i = 0; i < labels.length; i++)  
442 - labels[i].value = this.dataletPreset[labels[i].label]; 444 + //set info labels options
  445 + var labels = this.$.datalet_selection_labels.querySelectorAll("paper-textarea");
  446 + for (var i = 0; i < labels.length; i++)
  447 + labels[i].value = this.dataletPreset[labels[i].label];
443 448
  449 + var labels = this.$.datalet_selection_labels.querySelectorAll("paper-input");
  450 + for (var i = 0; i < labels.length; i++)
  451 + labels[i].value = this.dataletPreset[labels[i].label];
  452 + }, 300);
444 453
445 this.loadPreview = true; 454 this.loadPreview = true;
446 this._loadDatalet(this.selectedFields); 455 this._loadDatalet(this.selectedFields);
@@ -461,6 +470,7 @@ @@ -461,6 +470,7 @@
461 var selection = inputs.selection; 470 var selection = inputs.selection;
462 inputs = []; 471 inputs = [];
463 for (var i in this.fields) 472 for (var i in this.fields)
  473 +// for (var i = 0; i < Math.max(this.fields.length, 8); i++)//error
464 inputs.push({name: name + " " + i, description: description, selection: selection}); 474 inputs.push({name: name + " " + i, description: description, selection: selection});
465 } 475 }
466 476
@@ -482,8 +492,12 @@ @@ -482,8 +492,12 @@
482 _addInput : function(e){ 492 _addInput : function(e){
483 var selectedFields = this._copy(this.selectedFields); 493 var selectedFields = this._copy(this.selectedFields);
484 494
485 - var index = $(e.target).parents("paper-dropdown-menu")[0].id;  
486 - selectedFields[index] = e.target.innerHTML.trim(); 495 +// var index = $(e.target).parents("paper-dropdown-menu")[0].id;
  496 +// selectedFields[index] = e.target.innerHTML.trim();
  497 +
  498 + var ddl_index = $(e.target).parents("paper-dropdown-menu")[0].id;
  499 + var index = e.target.id;
  500 + selectedFields[ddl_index] = this.fields[index];
487 501
488 this.selectedFields = this._copy(selectedFields); 502 this.selectedFields = this._copy(selectedFields);
489 503
@@ -546,7 +560,16 @@ @@ -546,7 +560,16 @@
546 ComponentService.deep_url = this.deepUrl; 560 ComponentService.deep_url = this.deepUrl;
547 ComponentService.getComponent(dataletParams); 561 ComponentService.getComponent(dataletParams);
548 562
549 -// this.async(function(){this.$.add_button.removeAttribute("disabled");}, 1000); 563 +// console.log(this.params);
  564 +
  565 +
  566 +// this.async(function(){
  567 +// if(this.$.datalet_selection_datalet_placeholder.children[1])
  568 +// this.$.datalet_selection_datalet_placeholder.children[1].behavior.setParameters(this.params);
  569 +// this.$.add_button.removeAttribute("disabled");
  570 +// }, 300);
  571 +
  572 +// this.async(function(){this.$.add_button.removeAttribute("disabled");}, 300);
550 this.$.add_button.removeAttribute("disabled"); 573 this.$.add_button.removeAttribute("disabled");
551 }, 574 },
552 575
@@ -557,7 +580,7 @@ @@ -557,7 +580,7 @@
557 if(this.selectedFields[i]) 580 if(this.selectedFields[i])
558 selectedFields.push(this.selectedFields[i]); 581 selectedFields.push(this.selectedFields[i]);
559 582
560 - console.log(this.params); 583 +// console.log(this.params);
561 584
562 var data = { 585 var data = {
563 dataUrl : this.dataUrl, 586 dataUrl : this.dataUrl,
controllets/fullsize-page-with-card-controllet/fullsize-page-with-card-controllet.html
@@ -117,14 +117,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN @@ -117,14 +117,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
117 }, 117 },
118 118
119 _computeCardClass: function(color) { 119 _computeCardClass: function(color) {
120 - //var cls = 'card';  
121 - //return cls + ' ' + color;  
122 this.$.card = color; 120 this.$.card = color;
123 }, 121 },
124 122
125 _computeFixedBackgroundClass: function(color) { 123 _computeFixedBackgroundClass: function(color) {
126 - //var cls = 'fixed';  
127 - //return cls + ' ' + color + '-l';  
128 this.$.fixed = color; 124 this.$.fixed = color;
129 } 125 }
130 126
datalets/areachart-datalet/areachart-datalet.html
@@ -50,7 +50,7 @@ Example: @@ -50,7 +50,7 @@ Example:
50 50
51 <dom-module id="areachart-datalet"> 51 <dom-module id="areachart-datalet">
52 <template> 52 <template>
53 - <highcharts-datalet id="charts" data-url="{{dataUrl}}" fields="{{fields}}"></highcharts-datalet> 53 + <highcharts-datalet id="charts" data-url="{{dataUrl}}" fields="{{fields}}" title="{{title}}" description="{{description}}"></highcharts-datalet>
54 </template> 54 </template>
55 <script> 55 <script>
56 56
datalets/barchart-datalet/barchart-datalet.html
@@ -50,7 +50,7 @@ Example: @@ -50,7 +50,7 @@ Example:
50 50
51 <dom-module name="barchart-datalet"> 51 <dom-module name="barchart-datalet">
52 <template> 52 <template>
53 - <highcharts-datalet id="charts" data-url="{{dataUrl}}" fields="{{fields}}" data="{{data}}"></highcharts-datalet> 53 + <highcharts-datalet id="charts" data-url="{{dataUrl}}" fields="{{fields}}" data="{{data}}" title="{{title}}" description="{{description}}"></highcharts-datalet>
54 </template> 54 </template>
55 <script> 55 <script>
56 56
@@ -117,7 +117,6 @@ Example: @@ -117,7 +117,6 @@ Example:
117 } 117 }
118 }; 118 };
119 119
120 -  
121 BarchartDatalet = Polymer({ 120 BarchartDatalet = Polymer({
122 is: 'barchart-datalet', 121 is: 'barchart-datalet',
123 122
@@ -176,7 +175,6 @@ Example: @@ -176,7 +175,6 @@ Example:
176 * @method ready 175 * @method ready
177 */ 176 */
178 ready: function(){ 177 ready: function(){
179 -  
180 this.behavior = $.extend(true, {}, HighchartsComponentBehavior, BarchartBehavior); 178 this.behavior = $.extend(true, {}, HighchartsComponentBehavior, BarchartBehavior);
181 this.async(function(){this.behavior.init(this)},0); 179 this.async(function(){this.behavior.init(this)},0);
182 } 180 }
datalets/base-ajax-json-jsonpath-datalet/base-ajax-json-jsonpath-datalet.html
@@ -52,7 +52,7 @@ Example : @@ -52,7 +52,7 @@ Example :
52 52
53 <dom-module id="base-ajax-json-jsonpath-datalet"> 53 <dom-module id="base-ajax-json-jsonpath-datalet">
54 <template> 54 <template>
55 - <base-datalet data-url="{{dataUrl}}" fields="{{fields}}" data="{{data}}"></base-datalet> 55 + <base-datalet data-url="{{dataUrl}}" fields="{{fields}}" data="{{data}}" title="{{title}}" description="{{description}}"></base-datalet>
56 </template> 56 </template>
57 57
58 <script src="static/js/vendor/jsonpath-0.8.5.js"></script> 58 <script src="static/js/vendor/jsonpath-0.8.5.js"></script>
datalets/base-datalet/base-datalet.html
@@ -64,41 +64,40 @@ Example : @@ -64,41 +64,40 @@ Example :
64 text-decoration: underline; 64 text-decoration: underline;
65 } 65 }
66 #base_datalet_container { 66 #base_datalet_container {
67 - /*display: flex;*/  
68 font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif; 67 font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
69 - /*color: #212121;*/  
70 padding-top: 2px; 68 padding-top: 2px;
71 - /*padding: 16px;*/  
72 border-top: 2px solid #B6B6B6; 69 border-top: 2px solid #B6B6B6;
73 } 70 }
74 #base_datalet_rtp { 71 #base_datalet_rtp {
75 - /*background-color: red;*/  
76 display: flex; 72 display: flex;
77 padding-top: 4px; 73 padding-top: 4px;
78 } 74 }
79 #rtp { 75 #rtp {
80 - /*width: 152px;*/  
81 padding-top: 8px; 76 padding-top: 8px;
82 padding-right: 8px; 77 padding-right: 8px;
83 font-size: small; 78 font-size: small;
84 } 79 }
85 #rtpalogo { 80 #rtpalogo {
86 - height:32px; 81 + height: 32px;
87 width: 32px; 82 width: 32px;
88 } 83 }
89 #base_datalet_spin { 84 #base_datalet_spin {
90 - height:64px; 85 + height: 64px;
91 width: 100%; 86 width: 100%;
  87 + margin-top: 64px;
92 } 88 }
93 - /*#base_datalet_info{*/  
94 - /*padding-top: 8px;*/  
95 - /*/!*background-color: green;*!/*/  
96 - /*width: 100%;*/  
97 - /*/!*font-size: small;*!/*/  
98 - /*}*/ 89 +
99 #base_datalet_source_link{ 90 #base_datalet_source_link{
100 padding-top: 12px; 91 padding-top: 12px;
101 } 92 }
  93 +
  94 + #span_title{
  95 + font-size: small;
  96 + }
  97 +
  98 + #span_description{
  99 + color: #727272;
  100 + }
102 </style> 101 </style>
103 102
104 <div id="base_datalet_imgWaitDatalet"> 103 <div id="base_datalet_imgWaitDatalet">
@@ -108,7 +107,7 @@ Example : @@ -108,7 +107,7 @@ Example :
108 <div id="base_datalet_container"> 107 <div id="base_datalet_container">
109 108
110 <div id="base_datalet_title_description"> 109 <div id="base_datalet_title_description">
111 - <span id="span_title" style="font-size: small"><b>{{title}}</b><span id="span_description" style="color: #727272"> - {{description}}</span></span> 110 + <span id="span_title"><b>{{title}}</b> <span id="span_description">{{description}}</span></span>
112 </div> 111 </div>
113 112
114 <div id="base_datalet_source_link"> 113 <div id="base_datalet_source_link">
@@ -131,50 +130,9 @@ Example : @@ -131,50 +130,9 @@ Example :
131 BaseDatalet = Polymer({ 130 BaseDatalet = Polymer({
132 is: 'base-datalet', 131 is: 'base-datalet',
133 132
134 - properties: {  
135 -  
136 - title : {  
137 - type : String,  
138 - value : ""  
139 - },  
140 -  
141 - description : {  
142 - type : String,  
143 - value : ""  
144 - },  
145 -  
146 - hideFooter : {  
147 - type : Boolean,  
148 - value : false  
149 - }  
150 -  
151 - },  
152 -  
153 - objectDatalet: {  
154 - /**  
155 - * It contains the json data from async xhr call returned from core-ajax core component  
156 - *  
157 - * @attribute json_resultDatalet  
158 - * @type object  
159 - * @default 'null'.  
160 - */  
161 - json_resultDatalet: {  
162 - type: Object,  
163 - value: {}  
164 - }  
165 - },  
166 -  
167 - _setFooter: function() {  
168 - if (this.title == "" && this.description == "")  
169 - this.$.base_datalet_title_description.innerHTML = "";  
170 - else if (this.description == "")  
171 - this.$.span_description.innerHTML = "";  
172 -  
173 - if (this.hideFooter) {  
174 - this.$.base_datalet_source_link.innerHTML = "";  
175 - this.$.base_datalet_rtp.innerHTML = "";  
176 - }  
177 - 133 + hideFooter: function() {
  134 + this.$.base_datalet_container.innerHTML = "";
  135 + this.$.base_datalet_container.style.border = 0;
178 }, 136 },
179 137
180 /** 138 /**
@@ -188,13 +146,14 @@ Example : @@ -188,13 +146,14 @@ Example :
188 * from the entire URL and set the text content of the datalet footer. 146 * from the entire URL and set the text content of the datalet footer.
189 * @method ready 147 * @method ready
190 */ 148 */
191 - ready: function(){  
192 - this._setFooter();  
193 149
194 - if(this.dataUrl != undefined) { 150 + attached: function(){
  151 + if(this.title != "" && this.description != "")
  152 + this.description = "- " + this.description;
  153 + },
195 154
196 - //cKan organized with or not catalog  
197 - var queryInitial = this.dataUrl.substring(0, this.dataUrl.indexOf("api")); //SOURCE 155 + ready: function(){
  156 + if(this.dataUrl != undefined) {
198 157
199 var urlSource = this.dataUrl.split("/")[0] + "//" + this.dataUrl.split("/")[2]; 158 var urlSource = this.dataUrl.split("/")[0] + "//" + this.dataUrl.split("/")[2];
200 this.$.base_datalet_source.innerHTML = urlSource; 159 this.$.base_datalet_source.innerHTML = urlSource;
@@ -204,101 +163,29 @@ Example : @@ -204,101 +163,29 @@ Example :
204 //OpenDataSoft check 163 //OpenDataSoft check
205 if(this.dataUrl.indexOf("/records/") > -1 ) 164 if(this.dataUrl.indexOf("/records/") > -1 )
206 { 165 {
207 - //Resourceid of a datalet  
208 - var query = this.dataUrl.substring(this.dataUrl.indexOf("?"), this.dataUrl.length);  
209 - var params = this.decomponeQueryString(query);  
210 - var resultIssyIdDatalet = params["dataset"];  
211 - var resultIssyAPI = "explore/dataset/";  
212 - var urlPageDatasetIssy = queryInitial + resultIssyAPI + resultIssyIdDatalet + "/";  
213 -  
214 - this.$.base_datalet_link.setAttribute("href", urlPageDatasetIssy); 166 + this.$.base_datalet_link.setAttribute("href", urlSource + "/explore/dataset/" + this.dataUrl.substring(this.dataUrl.indexOf("=")+1,this.dataUrl.indexOf("&")));
215 } 167 }
216 - else 168 + // CKAN
  169 + else if(this.dataUrl.indexOf("datastore_search?resource_id") > -1 )
217 { 170 {
218 - //CKAN portal  
219 - var urlDatalet;  
220 -  
221 - var apiIdResource = "resource_show?id=";  
222 -  
223 - //Resourceid of a datalet  
224 - var query = this.dataUrl.substring(this.dataUrl.indexOf("?"), this.dataUrl.length);  
225 - var params = this.decomponeQueryString(query);  
226 - //CKAN  
227 - var resultIdDatalet = params["resource_id"];  
228 -  
229 - //cKan organized with or not catalog  
230 - var queryFinal = this.dataUrl.substring(this.dataUrl.indexOf("api"), this.dataUrl.indexOf("datastore_search"));  
231 -  
232 - urlDatalet = queryInitial + queryFinal + apiIdResource + resultIdDatalet;  
233 - this.requestDataletData(urlDatalet); 171 + var comp = this;
  172 + $.ajax({
  173 + url: this.dataUrl.replace("datastore_search?resource_id", "resource_show?id"),
  174 + dataType: "json",
  175 + success: function(e){
  176 + comp.$.base_datalet_link.setAttribute("href", urlSource + "/dataset/" + e.result.package_id + "/resource/" + e.result.id);
  177 + }
  178 + });
234 } 179 }
235 } 180 }
236 -  
237 }, 181 },
  182 +
238 /** 183 /**
239 * Set the domain url to show in the footer 184 * Set the domain url to show in the footer
240 */ 185 */
241 setDomain: function(url){ 186 setDomain: function(url){
242 this.$.domain.textContent = url; 187 this.$.domain.textContent = url;
243 }, 188 },
244 - /**  
245 - * Get the (key, value) query string parameters  
246 - **/  
247 - decomponeQueryString: function (querystring) {  
248 - // remove any preceding url and split  
249 - querystring = querystring.substring(querystring.indexOf('?')+1).split('&');  
250 - var params = {}, pair, d = decodeURIComponent;  
251 - // march and parse  
252 - for (var i = querystring.length - 1; i >= 0; i--) {  
253 - pair = querystring[i].split('=');  
254 - params[d(pair[0])] = d(pair[1]);  
255 - }  
256 - return params;  
257 - },  
258 - /**  
259 - * Make an AJAX call to the dataset URL to retrieve package_id  
260 - *  
261 - * @method urlDatalet  
262 - */  
263 - requestDataletData: function(urlDatalet){  
264 - var comp = this;  
265 - $.ajax({  
266 - url: urlDatalet, //url con package  
267 - dataType: "json",  
268 - success: function(e){  
269 - comp.handleDataletResponse(e);  
270 - }  
271 - });  
272 - },  
273 - /**  
274 - * Called when core-ajax component receive the json data from called url.  
275 - *  
276 - * @method handleResponse  
277 - */  
278 - handleDataletResponse: function(e) {  
279 - this.objectDatalet.json_resultDatalet.value = e;  
280 - //packageId of a give datalet  
281 - packageIdDatalet = this.objectDatalet.json_resultDatalet.value.result.package_id;  
282 - resourceId = this.objectDatalet.json_resultDatalet.value.result.id;  
283 -  
284 - //url complete of download  
285 - urlDatasetDownload = this.objectDatalet.json_resultDatalet.value.result.url;  
286 -  
287 - if(this.dataUrl != undefined){  
288 - //static url  
289 - lastStringResourceId = this.dataUrl.split("/")[5];  
290 - resourceId = lastStringResourceId.split('=')[1];  
291 - var urlDatalet = this.dataUrl.split("/")[0]+ "//" + this.dataUrl.split("/")[2] + "/dataset/" + packageIdDatalet +"/resource/" +resourceId;  
292 -  
293 - urlDatalet = urlDatasetDownload.replace(/\/download\/.*/, '');  
294 - urlSource = this.dataUrl.split("/")[0] + "//" + this.dataUrl.split("/")[2];  
295 -  
296 - this.$.base_datalet_link.setAttribute("href", urlDatalet);  
297 - }  
298 - },  
299 -  
300 -  
301 -  
302 - }); 189 + });
303 </script> 190 </script>
304 </dom-module> 191 </dom-module>
305 \ No newline at end of file 192 \ No newline at end of file
datalets/base-datalet/static/js/BaseDataletBehavior.js
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 @license 2 @license
3 The MIT License (MIT) 3 The MIT License (MIT)
4 4
5 - Copyright (c) 2015 Dipartimento di Informatica - Università di Salerno - Italy 5 + Copyright (c) 2015 Dipartimento di Informatica - Universit� di Salerno - Italy
6 6
7 Permission is hereby granted, free of charge, to any person obtaining a copy 7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal 8 of this software and associated documentation files (the "Software"), to deal
@@ -74,6 +74,12 @@ var BaseDataletBehavior ={ @@ -74,6 +74,12 @@ var BaseDataletBehavior ={
74 factoryImpl: function(data_url, fields) { 74 factoryImpl: function(data_url, fields) {
75 this.data_url = data_url; 75 this.data_url = data_url;
76 this.fields = fields; 76 this.fields = fields;
  77 + },
  78 +
  79 + setParameters: function(params)
  80 + {
  81 + this.title = params['title'];
  82 + this.description = params['description'];
77 } 83 }
78 84
79 }; 85 };
80 \ No newline at end of file 86 \ No newline at end of file
datalets/base-datalet/static/js/BaseDataletBehaviors.js deleted
1 -/*  
2 -@license  
3 - The MIT License (MIT)  
4 -  
5 - Copyright (c) 2015 Dipartimento di Informatica - Università di Salerno - Italy  
6 -  
7 - Permission is hereby granted, free of charge, to any person obtaining a copy  
8 - of this software and associated documentation files (the "Software"), to deal  
9 - in the Software without restriction, including without limitation the rights  
10 - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell  
11 - copies of the Software, and to permit persons to whom the Software is  
12 - furnished to do so, subject to the following conditions:  
13 -  
14 - The above copyright notice and this permission notice shall be included in  
15 - all copies or substantial portions of the Software.  
16 -  
17 - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  
18 - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  
19 - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE  
20 - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  
21 - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,  
22 - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN  
23 - THE SOFTWARE.  
24 -*/  
25 -  
26 -var BaseDataletBehavior ={  
27 -  
28 - properties: {  
29 -  
30 - /**  
31 - * It represent the dataset api url  
32 - *  
33 - * @attribute dataUrl  
34 - * @type string  
35 - * @default 'null'  
36 - */  
37 - dataUrl: {  
38 - type: String,  
39 - value: ""  
40 - },  
41 -  
42 - /**  
43 - * It represents one or multiple fields selected by user  
44 - *  
45 - * @attribute fields  
46 - * @type Array  
47 - * @default empty  
48 - */  
49 - fields: {  
50 - type: String,  
51 - value: ""  
52 - },  
53 -  
54 - /**  
55 - * The selected and transformed data you can use in presentation phase  
56 - *  
57 - * @attribute data  
58 - * @type Array  
59 - * @default empty  
60 - */  
61 - data: {  
62 - type: Array,  
63 - value: []  
64 - }  
65 -  
66 - },  
67 -  
68 - factoryImpl: function(data_url, fields) {  
69 - this.data_url = data_url;  
70 - this.fields = fields;  
71 - }  
72 -  
73 -};  
74 -  
75 -var WorkcycleBehavior = {  
76 - /**  
77 - * A reference to Polymer object  
78 - *  
79 - */  
80 - _component: null,  
81 -  
82 - /**  
83 - * Request data from source(e.g. CKAN by api) using some kind of technology(e.g. Ajax)  
84 - *  
85 - * @method requestData  
86 - */  
87 - requestData: function(){  
88 - },  
89 -  
90 - /**  
91 - * Select the fields from data(typically json) previously retrieved by ajax request. The selection could be done by jsonPath but  
92 - * it depends on the representation data format(CKAN apies return a json representation of the dataset).  
93 - *  
94 - * @method selectData  
95 - */  
96 - selectData: function(){  
97 - },  
98 -  
99 - /**  
100 - * Filter data previously selected. An example of filterting could be an expression such "fields > 30" or "fields = 'AAA'"  
101 - * If you are using jsonPath to select the datas you can apply an expression directly in the jsonPath query string.  
102 - *  
103 - * @method filterData  
104 - */  
105 - filterData: function(){  
106 - },  
107 -  
108 - /**  
109 - * Transform the selected data in order to build the structure that the presentation phase needs.  
110 - *  
111 - * @method transformData  
112 - */  
113 - transformData: function(){  
114 - },  
115 -  
116 - /**  
117 - * Build the object/s for presentation layer.  
118 - *  
119 - * @method presentData  
120 - */  
121 - presentData: function(){  
122 -  
123 - },  
124 -  
125 - /**  
126 - * This method represents the entire datalet workcycle.  
127 - *  
128 - * @method runWorkcycle  
129 - */  
130 - runWorkcycle: function() {  
131 - this.selectData();  
132 - this.filterData();  
133 - this.transformData();  
134 - this.presentData();  
135 - },  
136 -  
137 - /**  
138 - * This method save the reference to the polymer object related to the datalet.  
139 - *  
140 - * @method init  
141 - */  
142 - init: function(component){  
143 - this._component = component;  
144 -  
145 - if(this.properties.data.length == 0){  
146 - this.requestData();  
147 - }else{  
148 - this.transformData();  
149 - this.presentData();  
150 - }  
151 - }  
152 -  
153 -};  
154 \ No newline at end of file 0 \ No newline at end of file
datalets/bubble3d-datalet/bubble3d-datalet.html
@@ -59,7 +59,7 @@ Examples: @@ -59,7 +59,7 @@ Examples:
59 59
60 <dom-module name="bubble3d-datalet"> 60 <dom-module name="bubble3d-datalet">
61 <template> 61 <template>
62 - <highcharts-datalet id="charts" data-url="{{dataUrl}}" fields="{{fields}}" data="{{data}}"></highcharts-datalet> 62 + <highcharts-datalet id="charts" data-url="{{dataUrl}}" fields="{{fields}}" data="{{data}}" title="{{title}}" description="{{description}}"></highcharts-datalet>
63 </template> 63 </template>
64 <script> 64 <script>
65 65
datalets/column3Dchart-datalet/column3Dchart-datalet.html
@@ -59,7 +59,7 @@ Example: @@ -59,7 +59,7 @@ Example:
59 <tr><td>Alpha Angle</td><td><input id="R0" type="range" min="0" max="45" value="15"/> <span id="R0-value" class="value"></span></td></tr> 59 <tr><td>Alpha Angle</td><td><input id="R0" type="range" min="0" max="45" value="15"/> <span id="R0-value" class="value"></span></td></tr>
60 <tr><td>Beta Angle</td><td><input id="R1" type="range" min="0" max="45" value="15"/> <span id="R1-value" class="value"></span></td></tr> 60 <tr><td>Beta Angle</td><td><input id="R1" type="range" min="0" max="45" value="15"/> <span id="R1-value" class="value"></span></td></tr>
61 </table> 61 </table>
62 - <highcharts-datalet id="charts" data-url="{{dataUrl}}" fields="{{fields}}" data="{{data}}"></highcharts-datalet> 62 + <highcharts-datalet id="charts" data-url="{{dataUrl}}" fields="{{fields}}" data="{{data}}" title="{{title}}" description="{{description}}"></highcharts-datalet>
63 </template> 63 </template>
64 64
65 <script> 65 <script>
datalets/columnchart-datalet/columnchart-datalet.html
@@ -50,7 +50,7 @@ Example: @@ -50,7 +50,7 @@ Example:
50 50
51 <dom-module id="columnchart-datalet"> 51 <dom-module id="columnchart-datalet">
52 <template> 52 <template>
53 - <highcharts-datalet id="charts" data-url="{{dataUrl}}" fields="{{fields}}" data="{{data}}"></highcharts-datalet> 53 + <highcharts-datalet id="charts" data-url="{{dataUrl}}" fields="{{fields}}" data="{{data}}" title="{{title}}" description="{{description}}"></highcharts-datalet>
54 </template> 54 </template>
55 <script> 55 <script>
56 56
datalets/datasetexplorer-datalet/datasetexplorer-datalet.html
@@ -64,7 +64,7 @@ Example: @@ -64,7 +64,7 @@ Example:
64 :host ::content #treemap_placeholder { 64 :host ::content #treemap_placeholder {
65 width: 100%; 65 width: 100%;
66 height: 70%; 66 height: 70%;
67 - min-height: 500px; 67 + /*min-height: 500px;*/
68 background: #ffffff; 68 background: #ffffff;
69 position: relative; 69 position: relative;
70 } 70 }
@@ -125,8 +125,7 @@ Example: @@ -125,8 +125,7 @@ Example:
125 children : [] 125 children : []
126 }, 126 },
127 127
128 - transformData: function(e)  
129 - { 128 + transformData: function(e){
130 var treemapData = []; 129 var treemapData = [];
131 DatasetexplorerBehavior.map.name = this._component.title; 130 DatasetexplorerBehavior.map.name = this._component.title;
132 131
@@ -225,6 +224,8 @@ Example: @@ -225,6 +224,8 @@ Example:
225 }, 224 },
226 225
227 ready: function(){ 226 ready: function(){
  227 + $(this).find("base-datalet")[0].hideFooter();
  228 +
228 this.behavior = $.extend(true, {}, BaseDataletBehavior, WorkcycleBehavior, AjaxJsonJsonPathBehavior, DatasetexplorerBehavior); 229 this.behavior = $.extend(true, {}, BaseDataletBehavior, WorkcycleBehavior, AjaxJsonJsonPathBehavior, DatasetexplorerBehavior);
229 this.async(function(){this.behavior.init(this)},0); 230 this.async(function(){this.behavior.init(this)},0);
230 } 231 }
datalets/datatable-datalet/datatable-datalet.html
@@ -54,7 +54,7 @@ Example: @@ -54,7 +54,7 @@ Example:
54 54
55 <table id="datatable" class="stripe row-border" cellspacing="0" style="height: auto; width: auto;"> 55 <table id="datatable" class="stripe row-border" cellspacing="0" style="height: auto; width: auto;">
56 </table> 56 </table>
57 - <base-ajax-json-jsonpath-datalet data-url="{{dataUrl}}" fields="{{fields}}" data="{{data}}"></base-ajax-json-jsonpath-datalet> 57 + <base-ajax-json-jsonpath-datalet data-url="{{dataUrl}}" fields="{{fields}}" data="{{data}}" title="{{title}}" description="{{description}}"></base-ajax-json-jsonpath-datalet>
58 </template> 58 </template>
59 59
60 <script type="text/javascript" src="js/DataTables/datatables.js"></script> 60 <script type="text/javascript" src="js/DataTables/datatables.js"></script>
datalets/donutpie3dchart-datalet/donutpie3dchart-datalet.html
@@ -49,7 +49,7 @@ Example: @@ -49,7 +49,7 @@ Example:
49 --> 49 -->
50 <dom-module id="donutpie3dchart-datalet"> 50 <dom-module id="donutpie3dchart-datalet">
51 <template> 51 <template>
52 - <highcharts-datalet id="charts" data-url="{{dataUrl}}" fields="{{fields}}" data="{{data}}"></highcharts-datalet> 52 + <highcharts-datalet id="charts" data-url="{{dataUrl}}" fields="{{fields}}" data="{{data}}" title="{{title}}" description="{{description}}"></highcharts-datalet>
53 </template> 53 </template>
54 <script> 54 <script>
55 55
datalets/dynamic-datatable-datalet/dynamic-datatable-datalet.html
@@ -121,6 +121,8 @@ Example: @@ -121,6 +121,8 @@ Example:
121 }, 121 },
122 122
123 ready: function(){ 123 ready: function(){
  124 + $(this).find("base-datalet")[0].hideFooter();
  125 +
124 this.behavior = $.extend(true, {}, BaseDataletBehavior, WorkcycleBehavior, AjaxJsonJsonPathBehavior, DynamicDatatableBehavior); 126 this.behavior = $.extend(true, {}, BaseDataletBehavior, WorkcycleBehavior, AjaxJsonJsonPathBehavior, DynamicDatatableBehavior);
125 this.async(function(){this.behavior.init(this)}, 0); 127 this.async(function(){this.behavior.init(this)}, 0);
126 }, 128 },
datalets/graph-datalet/graph-datalet.html
@@ -148,7 +148,6 @@ Example: @@ -148,7 +148,6 @@ Example:
148 scale = (1.0); 148 scale = (1.0);
149 //translate = [(width-scale*width)/2, ((height-scale*height)/4)]; 149 //translate = [(width-scale*width)/2, ((height-scale*height)/4)];
150 translate = [0, 0]; 150 translate = [0, 0];
151 - console.log("w: " + width + " h:" + height);  
152 this.svg.transition() 151 this.svg.transition()
153 .duration(750) 152 .duration(750)
154 .attr("transform", "translate(" + translate + ")scale(" + scale + ")") 153 .attr("transform", "translate(" + translate + ")scale(" + scale + ")")
@@ -237,7 +236,6 @@ Example: @@ -237,7 +236,6 @@ Example:
237 236
238 zoom: function() { 237 zoom: function() {
239 svg.attr("transform", "translate(" + d3.event.translate + ")scale(" + d3.event.scale + ")"); 238 svg.attr("transform", "translate(" + d3.event.translate + ")scale(" + d3.event.scale + ")");
240 - console.log(d3.event.scale);  
241 }, 239 },
242 240
243 text: function (t) 241 text: function (t)
@@ -361,7 +359,6 @@ Example: @@ -361,7 +359,6 @@ Example:
361 g.nodes[0].x = this.width / 2; 359 g.nodes[0].x = this.width / 2;
362 g.nodes[0].y = this.height / 8; 360 g.nodes[0].y = this.height / 8;
363 this.buildGraph(g); 361 this.buildGraph(g);
364 - console.log(g.nodes.length);  
365 } 362 }
366 }); 363 });
367 </script> 364 </script>
datalets/highcharts-datalet/highcharts-datalet.html
@@ -57,7 +57,7 @@ Example : @@ -57,7 +57,7 @@ Example :
57 57
58 <template> 58 <template>
59 <div id="container" style="width:auto; height:auto;"></div> 59 <div id="container" style="width:auto; height:auto;"></div>
60 - <base-ajax-json-jsonpath-datalet data-url="{{dataUrl}}" fields="{{fields}}" data="{{data}}"></base-ajax-json-jsonpath-datalet> 60 + <base-ajax-json-jsonpath-datalet data-url="{{dataUrl}}" fields="{{fields}}" data="{{data}}" title="{{title}}" description="{{description}}"></base-ajax-json-jsonpath-datalet>
61 </template> 61 </template>
62 62
63 <script src="static/js/highcharts.js"></script> 63 <script src="static/js/highcharts.js"></script>
@@ -82,6 +82,7 @@ Example : @@ -82,6 +82,7 @@ Example :
82 type: String, 82 type: String,
83 value: "line"//spline,time 83 value: "line"//spline,time
84 } 84 }
  85 +
85 }, 86 },
86 /** 87 /**
87 * Normalizes a number in agreement with javascript's conventions. Delete all NaN characters. Exception: number representing lat & long remain unchanged. 88 * Normalizes a number in agreement with javascript's conventions. Delete all NaN characters. Exception: number representing lat & long remain unchanged.
@@ -137,6 +138,9 @@ Example : @@ -137,6 +138,9 @@ Example :
137 138
138 setParameters: function(params) 139 setParameters: function(params)
139 { 140 {
  141 + this._component.title = params['title'];
  142 + this._component.description = params['description'];
  143 +
140 var chart = $(this._component.$.charts.$.container).highcharts(); 144 var chart = $(this._component.$.charts.$.container).highcharts();
141 145
142 chart.setTitle({text: params['title']}); 146 chart.setTitle({text: params['title']});
@@ -147,7 +151,8 @@ Example : @@ -147,7 +151,8 @@ Example :
147 return this.x + '<br/><br/><span style="fill:#7cb5ec" x="8" dy="15">●</span> ' + this.series.name + ': <b>' + this.y + ' ' + params['suffix'] + '</b>'; 151 return this.x + '<br/><br/><span style="fill:#7cb5ec" x="8" dy="15">●</span> ' + this.series.name + ': <b>' + this.y + ' ' + params['suffix'] + '</b>';
148 } 152 }
149 153
150 - }, 154 + }
  155 +
151 }; 156 };
152 157
153 var HighchartsComponentBehavior = $.extend(true, {}, BaseDataletBehavior, WorkcycleBehavior, AjaxJsonJsonPathBehavior, HighchartsBehavior); 158 var HighchartsComponentBehavior = $.extend(true, {}, BaseDataletBehavior, WorkcycleBehavior, AjaxJsonJsonPathBehavior, HighchartsBehavior);
datalets/leafletjs-datalet/leafletjs-datalet.html
@@ -56,7 +56,7 @@ Example: @@ -56,7 +56,7 @@ Example:
56 </style> 56 </style>
57 57
58 <div id="leafletjs"></div> 58 <div id="leafletjs"></div>
59 - <base-ajax-json-jsonpath-datalet data-url="{{dataUrl}}" fields="{{fields}}" data="{{data}}"></base-ajax-json-jsonpath-datalet> 59 + <base-ajax-json-jsonpath-datalet data-url="{{dataUrl}}" fields="{{fields}}" data="{{data}}" title="{{title}}" description="{{description}}"></base-ajax-json-jsonpath-datalet>
60 60
61 </template> 61 </template>
62 62
datalets/linechart-datalet/linechart-datalet.html
@@ -50,7 +50,7 @@ Example: @@ -50,7 +50,7 @@ Example:
50 50
51 <dom-module id="linechart-datalet"> 51 <dom-module id="linechart-datalet">
52 <template> 52 <template>
53 - <highcharts-datalet id="charts" data-url="{{dataUrl}}" fields="{{fields}}" data="{{data}}"></highcharts-datalet> 53 + <highcharts-datalet id="charts" data-url="{{dataUrl}}" fields="{{fields}}" data="{{data}}" title="{{title}}" description="{{description}}"></highcharts-datalet>
54 </template> 54 </template>
55 <script> 55 <script>
56 56
datalets/piechart-datalet/piechart-datalet.html
@@ -49,7 +49,7 @@ Example: @@ -49,7 +49,7 @@ Example:
49 --> 49 -->
50 <dom-module id="piechart-datalet"> 50 <dom-module id="piechart-datalet">
51 <template> 51 <template>
52 - <highcharts-datalet id="charts" data-url="{{dataUrl}}" fields="{{fields}}" data="{{data}}"></highcharts-datalet> 52 + <highcharts-datalet id="charts" data-url="{{dataUrl}}" fields="{{fields}}" data="{{data}}" title="{{title}}" description="{{description}}"></highcharts-datalet>
53 </template> 53 </template>
54 <script> 54 <script>
55 55
datalets/preview-datalet/preview-datalet.html
@@ -129,7 +129,7 @@ Example: @@ -129,7 +129,7 @@ Example:
129 * 129 *
130 */ 130 */
131 ready: function(){ 131 ready: function(){
132 - this.$.base.setDomain(this.url.split("/")[0] + "//" + this.url.split("/")[2]); 132 + //this.$.base.setDomain(this.url.split("/")[0] + "//" + this.url.split("/")[2]);
133 } 133 }
134 }); 134 });
135 </script> 135 </script>
datalets/treemap-datalet/treemap-datalet.html
@@ -105,7 +105,7 @@ Example: @@ -105,7 +105,7 @@ Example:
105 } 105 }
106 </style> 106 </style>
107 <div id="treemap_placeholder"></div> 107 <div id="treemap_placeholder"></div>
108 - <base-ajax-json-jsonpath-datalet data-url="{{dataUrl}}" fields="{{fields}}" data="{{data}}"></base-ajax-json-jsonpath-datalet> 108 + <base-ajax-json-jsonpath-datalet data-url="{{dataUrl}}" fields="{{fields}}" data="{{data}}" title="{{title}}" description="{{description}}"></base-ajax-json-jsonpath-datalet>
109 </template> 109 </template>
110 110
111 <script src="../shared_js/d3.js"></script> 111 <script src="../shared_js/d3.js"></script>