Commit b4fdbae24dc70e7ea1e1ddb9060c7415b5027163

Authored by Luigi Serra
2 parents a3eb2652 564f0a81

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

controllets/animated-grid-controllet/animated-grid-controllet.html
@@ -146,6 +146,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN @@ -146,6 +146,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
146 146
147 var target = event.target; 147 var target = event.target;
148 148
  149 + if(target.classList[0] != "grid-item")
  150 + return;
  151 +
149 // configure the page animation 152 // configure the page animation
150 this.sharedElements = { 153 this.sharedElements = {
151 'hero': target, 154 'hero': target,
datalets/base-datalet/base-datalet.html
@@ -80,16 +80,17 @@ Example : @@ -80,16 +80,17 @@ Example :
80 width: 100%; 80 width: 100%;
81 } 81 }
82 82
  83 +
83 </style> 84 </style>
84 85
85 <div id="base_datalet_imgWaitDatalet"> 86 <div id="base_datalet_imgWaitDatalet">
86 <img id="image_spin" src="static/images/spin.svg"> 87 <img id="image_spin" src="static/images/spin.svg">
87 88
88 </div> 89 </div>
89 -  
90 <div id="base_datalet_container"> 90 <div id="base_datalet_container">
91 - <b>Source: </b><span id="domain"></span>  
92 - <b> </b><span id="domainPage"></span> 91 + <b> Source:</b><span id="domain"></span>
  92 + <b> </b><span id="domainPage">
  93 + </span>
93 <div id="base_datalet_rtp"> 94 <div id="base_datalet_rtp">
94 <div id="rtp">Powered by ROUTE-TO-PA</div> 95 <div id="rtp">Powered by ROUTE-TO-PA</div>
95 <div><a href="http://www.routetopa.eu/"><img id="rtpalogo" src="static/images/rtpalogo.png" ></a></div> 96 <div><a href="http://www.routetopa.eu/"><img id="rtpalogo" src="static/images/rtpalogo.png" ></a></div>
@@ -134,8 +135,6 @@ Example : @@ -134,8 +135,6 @@ Example :
134 var urlDatalet; 135 var urlDatalet;
135 if(this.dataUrl != undefined){ 136 if(this.dataUrl != undefined){
136 137
137 - urlSource = this.dataUrl.split("/")[0] + "//" + this.dataUrl.split("/")[2];  
138 -  
139 var apiIdResource = "resource_show?id="; 138 var apiIdResource = "resource_show?id=";
140 139
141 //Resourceid of a datalet 140 //Resourceid of a datalet
@@ -148,10 +147,10 @@ Example : @@ -148,10 +147,10 @@ Example :
148 queryFinal = this.dataUrl.substring(this.dataUrl.indexOf("api"), this.dataUrl.indexOf("datastore_search")); 147 queryFinal = this.dataUrl.substring(this.dataUrl.indexOf("api"), this.dataUrl.indexOf("datastore_search"));
149 148
150 urlDatalet = queryInitial + queryFinal + apiIdResource + resultIdDatalet; 149 urlDatalet = queryInitial + queryFinal + apiIdResource + resultIdDatalet;
  150 + urlSource = this.dataUrl.split("/")[0] + "//" + this.dataUrl.split("/")[2];
151 151
  152 + this.$.domainPage.innerHTML = '<a href=' + urlSource + ' target=' + "_blank>" + urlSource + '</a>'+ "." ;
152 this.requestDataletData(urlDatalet); 153 this.requestDataletData(urlDatalet);
153 - //String source to define for Issy  
154 - this.$.domain.textContent = this.dataUrl.split("/")[0] + "//" + this.dataUrl.split("/")[2];  
155 } 154 }
156 }, 155 },
157 /** 156 /**
@@ -214,10 +213,9 @@ Example : @@ -214,10 +213,9 @@ Example :
214 urlDatalet = urlDatasetDownload.replace(/\/download\/.*/, ''); 213 urlDatalet = urlDatasetDownload.replace(/\/download\/.*/, '');
215 urlSource = this.dataUrl.split("/")[0] + "//" + this.dataUrl.split("/")[2]; 214 urlSource = this.dataUrl.split("/")[0] + "//" + this.dataUrl.split("/")[2];
216 215
217 - //this.$.domain.textContent = this.dataUrl.split("/")[0] + "//" + this.dataUrl.split("/")[2];  
218 216
219 - //this.$.domainPage.innerHTML = '<a href=' + urlSource + ' target=' + "_blank>" + " urlSource" + '</a>';  
220 - this.$.domainPage.innerHTML = '<a href=' + urlDatalet + ' target=' + "_blank>" + " Dataset's page" + '</a>'; 217 + this.$.domainPage.innerHTML += " (" + ' <a href=' + urlDatalet + ' target=' + "_blank>" + "Dataset's page" + '</a>' + " )";
  218 +
221 } 219 }
222 } 220 }
223 }); 221 });
datalets/datasetexplorer-datalet/datasetexplorer-datalet.html
@@ -30,6 +30,7 @@ @@ -30,6 +30,7 @@
30 --> 30 -->
31 31
32 <link rel="import" href="../base-ajax-json-jsonpath-datalet/base-ajax-json-jsonpath-datalet.html"> 32 <link rel="import" href="../base-ajax-json-jsonpath-datalet/base-ajax-json-jsonpath-datalet.html">
  33 +<link rel="import" href="../base-ajax-json-jsonpath-datalet/base-ajax-json-jsonpath-datalet.html">
33 34
34 <!-- 35 <!--
35 36
@@ -120,11 +121,10 @@ Example: @@ -120,11 +121,10 @@ Example:
120 121
121 } 122 }
122 </style> 123 </style>
123 - <div id="treemap_placeholder"><img class="spinner" src="spin.svg" /></div> 124 + <div id="treemap_placeholder"></div>
124 <base-ajax-json-jsonpath-datalet data-url="{{dataUrl}}" fields="{{fields}}" data="{{data}}"></base-ajax-json-jsonpath-datalet> 125 <base-ajax-json-jsonpath-datalet data-url="{{dataUrl}}" fields="{{fields}}" data="{{data}}"></base-ajax-json-jsonpath-datalet>
125 </template> 126 </template>
126 127
127 - <!--<script src="../shared_js/d3.js"></script>-->  
128 <script src="../shared_js/d3.js"></script> 128 <script src="../shared_js/d3.js"></script>
129 <script src="js/buildtreemap.js"></script> 129 <script src="js/buildtreemap.js"></script>
130 <script> 130 <script>
datalets/datasetexplorer-datalet/js/buildtreemap.js
@@ -28,8 +28,6 @@ function build(root, place_holder, select_listener) { @@ -28,8 +28,6 @@ function build(root, place_holder, select_listener) {
28 .ratio(height / width * 0.5 * (1 + Math.sqrt(5))) 28 .ratio(height / width * 0.5 * (1 + Math.sqrt(5)))
29 .round(false); 29 .round(false);
30 30
31 - d3.select("#" + place_holder).selectAll('*').remove();  
32 -  
33 var svg = d3.select("#" + place_holder) 31 var svg = d3.select("#" + place_holder)
34 .append("svg") 32 .append("svg")
35 .attr("width", width + margin.left + margin.right) 33 .attr("width", width + margin.left + margin.right)
@@ -179,9 +177,29 @@ function build(root, place_holder, select_listener) { @@ -179,9 +177,29 @@ function build(root, place_holder, select_listener) {
179 } 177 }
180 178
181 if (!d._children[0]._children) { 179 if (!d._children[0]._children) {
182 - //grandparent.dispatchEvent(new CustomEvent('select', { detail: d._children[0].name }));  
183 if (select_listener) { 180 if (select_listener) {
184 - select_listener(d._children[0].name); 181 + var url = d._children[0].name;
  182 +
  183 + // Check if CKAN
  184 + var strDatasetPos = url.indexOf('/dataset/');
  185 + var strResourcePos = (strDatasetPos >= 0) ? url.indexOf('/resource/') : -1;
  186 + if (strDatasetPos >= 0 && strResourcePos > strDatasetPos) {
  187 + var urlSegment1 = url.substring(0, strDatasetPos);
  188 + var urlResourceEnd = url.indexOf('/', strResourcePos + 10);
  189 + var resourceId = url.substring(strResourcePos + 10, urlResourceEnd);
  190 + url = urlSegment1 + "/api/action/datastore_search?resourceid=" + resourceId;
  191 + }
  192 +
  193 + // Check if OPENDATASOFT
  194 + var strExploreDatasetPos = url.indexOf('/explore/dataset/');
  195 + if (strExploreDatasetPos >= 0) {
  196 + var urlSegment1 = url.substring(0, strExploreDatasetPos);
  197 + var datasetEnd = url.indexOf(strExploreDatasetPos + 17, '/');
  198 + var datasetId = url.substring(strExploreDatasetPos + 17, datasetEnd >= 0 ? datasetEnd : url.length);
  199 + url = urlSegment1 + '/api/records/1.0/search?dataset=' + datasetId;
  200 + }
  201 +
  202 + select_listener(url);
185 } 203 }
186 204
187 var dataurl = d._children[0].name; 205 var dataurl = d._children[0].name;
@@ -211,7 +229,8 @@ function build(root, place_holder, select_listener) { @@ -211,7 +229,8 @@ function build(root, place_holder, select_listener) {
211 d.each(function(){ 229 d.each(function(){
212 var text = d3.select(this), 230 var text = d3.select(this),
213 d = text[0][0].__data__, 231 d = text[0][0].__data__,
214 - words = d.name.trim().split(/\s+|\./).reverse(), 232 + name = d.name.trim(),
  233 + words = name.search(/\s+/) >= 0 ? name.split(/\s+/).reverse() : [name],
215 word = words.pop(), 234 word = words.pop(),
216 line = [word], 235 line = [word],
217 lineNumber = 0, 236 lineNumber = 0,
@@ -234,7 +253,8 @@ function build(root, place_holder, select_listener) { @@ -234,7 +253,8 @@ function build(root, place_holder, select_listener) {
234 .append("tspan") 253 .append("tspan")
235 .attr("x", fx(d.x) + 6) 254 .attr("x", fx(d.x) + 6)
236 .attr("y", fy(d.y) + 6) 255 .attr("y", fy(d.y) + 6)
237 - .attr("dy", lineNumber++ * lineHeight + dy + "em"); 256 + .attr("dy", lineNumber++ * lineHeight + dy + "em")
  257 + .text(word);
238 var width = fx(d.x + d.dx) - fx(d.x) - 12; 258 var width = fx(d.x + d.dx) - fx(d.x) - 12;
239 var height = fy(d.y + d.dy) - fy(d.y) - 6; 259 var height = fy(d.y + d.dy) - fy(d.y) - 6;
240 260
datalets/datasetexplorer-datalet/spin.svg deleted
1 -<?xml version="1.0" encoding="utf-8"?><svg width='198px' height='198px' xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" class="uil-spin"><rect x="0" y="0" width="100" height="100" fill="none" class="bk"></rect><g transform="translate(50 50)"><g transform="rotate(0) translate(34 0)"><circle cx="0" cy="0" r="8" fill="#1976d2"><animate attributeName="opacity" from="1" to="0.1" begin="0s" dur="1s" repeatCount="indefinite"></animate><animateTransform attributeName="transform" type="scale" from="1.5" to="1" begin="0s" dur="1s" repeatCount="indefinite"></animateTransform></circle></g><g transform="rotate(45) translate(34 0)"><circle cx="0" cy="0" r="8" fill="#1976d2"><animate attributeName="opacity" from="1" to="0.1" begin="0.12s" dur="1s" repeatCount="indefinite"></animate><animateTransform attributeName="transform" type="scale" from="1.5" to="1" begin="0.12s" dur="1s" repeatCount="indefinite"></animateTransform></circle></g><g transform="rotate(90) translate(34 0)"><circle cx="0" cy="0" r="8" fill="#1976d2"><animate attributeName="opacity" from="1" to="0.1" begin="0.25s" dur="1s" repeatCount="indefinite"></animate><animateTransform attributeName="transform" type="scale" from="1.5" to="1" begin="0.25s" dur="1s" repeatCount="indefinite"></animateTransform></circle></g><g transform="rotate(135) translate(34 0)"><circle cx="0" cy="0" r="8" fill="#1976d2"><animate attributeName="opacity" from="1" to="0.1" begin="0.37s" dur="1s" repeatCount="indefinite"></animate><animateTransform attributeName="transform" type="scale" from="1.5" to="1" begin="0.37s" dur="1s" repeatCount="indefinite"></animateTransform></circle></g><g transform="rotate(180) translate(34 0)"><circle cx="0" cy="0" r="8" fill="#1976d2"><animate attributeName="opacity" from="1" to="0.1" begin="0.5s" dur="1s" repeatCount="indefinite"></animate><animateTransform attributeName="transform" type="scale" from="1.5" to="1" begin="0.5s" dur="1s" repeatCount="indefinite"></animateTransform></circle></g><g transform="rotate(225) translate(34 0)"><circle cx="0" cy="0" r="8" fill="#1976d2"><animate attributeName="opacity" from="1" to="0.1" begin="0.62s" dur="1s" repeatCount="indefinite"></animate><animateTransform attributeName="transform" type="scale" from="1.5" to="1" begin="0.62s" dur="1s" repeatCount="indefinite"></animateTransform></circle></g><g transform="rotate(270) translate(34 0)"><circle cx="0" cy="0" r="8" fill="#1976d2"><animate attributeName="opacity" from="1" to="0.1" begin="0.75s" dur="1s" repeatCount="indefinite"></animate><animateTransform attributeName="transform" type="scale" from="1.5" to="1" begin="0.75s" dur="1s" repeatCount="indefinite"></animateTransform></circle></g><g transform="rotate(315) translate(34 0)"><circle cx="0" cy="0" r="8" fill="#1976d2"><animate attributeName="opacity" from="1" to="0.1" begin="0.87s" dur="1s" repeatCount="indefinite"></animate><animateTransform attributeName="transform" type="scale" from="1.5" to="1" begin="0.87s" dur="1s" repeatCount="indefinite"></animateTransform></circle></g></g></svg>  
2 \ No newline at end of file 0 \ No newline at end of file