Skip to content

Commit

Permalink
Statistics page updated and minor fix ckan api (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
robcalla committed May 21, 2019
1 parent 5c95e9b commit 0ba2d4a
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 33 deletions.
12 changes: 6 additions & 6 deletions Idra/src/main/java/it/eng/idra/api/ckan/CKANUtils.java
Expand Up @@ -370,7 +370,7 @@ public static Dataset toCkanDataset(DCATDataset dataset) {
}

if(ar_contactPoint.length()>0) {
extras.add(new Extra("contact_point",ar_contactPoint.toString()));
extras.add(new Extra("contact_point",ar_contactPoint.toString().replaceAll("\\\\\"", "'").replaceAll("\"", "")));
}


Expand All @@ -389,34 +389,34 @@ public static Dataset toCkanDataset(DCATDataset dataset) {
}

if(ar_conformsTo.length()>0) {
extras.add(new Extra("conforms_to",ar_conformsTo.toString()));
extras.add(new Extra("conforms_to",ar_conformsTo.toString().replaceAll("\\\\\"", "'").replaceAll("\"", "")));
}

for(SKOSConceptTheme t : dataset.getTheme()){
List<SKOSPrefLabel> labelTmp = t.getPrefLabel().stream().filter(x -> StringUtils.isNotBlank(x.getLanguage()) || StringUtils.isNotBlank(x.getValue())).collect(Collectors.toList());
if(labelTmp.isEmpty()) {
if(!labelTmp.isEmpty()) {
JSONArray ar = new JSONArray();
for(SKOSPrefLabel p : labelTmp) {
JSONObject tmpObj = new JSONObject();
tmpObj.put("language", p.getLanguage());
tmpObj.put("value", p.getValue());
ar.put(tmpObj);
}
extras.add(new Extra("theme",ar.toString()));
extras.add(new Extra("theme",ar.toString().replaceAll("\\\\\"", "'").replaceAll("\"", "")));
}
}

for(SKOSConceptSubject t : dataset.getSubject()){
List<SKOSPrefLabel> labelTmp = t.getPrefLabel().stream().filter(x -> StringUtils.isNotBlank(x.getLanguage()) || StringUtils.isNotBlank(x.getValue())).collect(Collectors.toList());
if(labelTmp.isEmpty()) {
if(!labelTmp.isEmpty()) {
JSONArray ar = new JSONArray();
for(SKOSPrefLabel p : labelTmp) {
JSONObject tmpObj = new JSONObject();
tmpObj.put("language", p.getLanguage());
tmpObj.put("value", p.getValue());
ar.put(tmpObj);
}
extras.add(new Extra("subject",ar.toString()));
extras.add(new Extra("subject",ar.toString().replaceAll("\\\\\"", "'").replaceAll("\"", "")));
}
}

Expand Down
76 changes: 66 additions & 10 deletions IdraPortal/src/main/webapp/css/navbar.css
Expand Up @@ -127,26 +127,82 @@

/* Small devices */
@media (max-width:830px) {
#header div.navbar.navbar-default .btn.btn-default {
margin-left: 10px;
}
/* #header div.navbar.navbar-default .btn.btn-default { */
/* margin-left: 10px; */
/* } */
/* #header div.navbar.navbar-default .navbar-header .navbar-brand { */
/* background-size: auto 39px; */
/* width: 190px; */
/* } */
}

@media (max-width: 480px){
.navbar-brand {
/*width: 370px !important;*/
width: 100px !important;
}

.navbar .nav.navbar-nav > li > a {
/*SYNCHRONICITY*/
@media (max-width: 894px) {

.navbar-header {
float: none;
}
.navbar-left,.navbar-right {
float: none !important;
}
.navbar-toggle {
display: block;
}
.navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.navbar-fixed-top {
top: 0;
border-width: 0 0 1px;
}
.navbar-collapse.collapse {
display: none!important;
}
.navbar-nav {
float: none!important;
margin-top: 7.5px;
}
.navbar-nav>li {
float: none;
}
.navbar-nav>li>a {
padding-top: 10px;
padding-bottom: 10px;
}
.collapse.in{
display:block !important;
}

.navbar .nav.navbar-nav > li > a {
padding: 10px 15px;
}

/* .container>.navbar-header, .container-fluid>.navbar-header, .container>.navbar-collapse, .container-fluid>.navbar-collapse{ */
/* margin-right: -15px; */
/* margin-left: -15px; */
/* } */
}

/* @media (max-width: 767px){ */

/* #header div.navbar.navbar-default .navbar-header .navbar-brand { */
/* height:60px; */
/* } */

/* .navbar-brand { */
/* width: 100px !important; */
/* } */

/* .navbar .nav.navbar-nav > li > a { */
/* padding: 10px 15px; */
/* } */

/* .navbar-form{ */
/* border: 0 !important; */
/* } */
/* } */

.navbar .navbar-toggle, .navbar .navbar-toggle:hover,
.navbar .navbar-toggle:focus {
background-color: #00b4ff;
Expand Down
13 changes: 7 additions & 6 deletions IdraPortal/src/main/webapp/statistics/Statistics.html
Expand Up @@ -42,7 +42,7 @@
<!-- </div> -->
</div>

<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
<md-card class="md-whiteframe-3dp"> <md-card-title>
<md-card-title-text layout-align="center"> <span
class="md-headline">{{'statisticsTop10Catalogues' | translate}}</span>
Expand All @@ -69,12 +69,12 @@
</md-card-content> </md-card>
</div>

<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
<md-card class="md-whiteframe-3dp"> <md-card-title>
<md-card-title-text layout-align="center"> <span
class="md-headline">{{'statisticsMostActiveCatalogues' |
translate}}</span> </md-card-title-text>
<md-select style="margin-top:0px;margin-bottom:5px;" ng-model="selectedPeriods"> <md-option
<md-select style="margin-top:0px;margin-bottom:0px;" ng-model="selectedPeriods"> <md-option
ng-repeat="option in periodsSelect" ng-value="option.days">{{option.text
| translate}}</md-option> </md-select>
</md-card-title>
Expand All @@ -85,6 +85,7 @@
chart-data="dataAddUpdate" chart-labels="labelsAddUpdate"
chart-series="seriesAddUpdate"
chart-options="{
responsive: true,
title:{
display:false,
text:'Most Active Catalogues'
Expand All @@ -98,7 +99,7 @@
</canvas></md-card-content> </md-card>
</div>

<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
<md-card class="md-whiteframe-3dp"> <md-card-title>
<md-card-title-text layout-align="center"> <span
class="md-headline">{{'statisticsCataloguesTechnologies' |
Expand All @@ -108,7 +109,7 @@
</md-card-content> </md-card>
</div>

<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
<md-card class="md-whiteframe-3dp"> <md-card-title>
<md-card-title-text layout-align="center"> <span
class="md-headline">{{'statisticsDistributionFormats' |
Expand All @@ -124,7 +125,7 @@
</md-card-content> </md-card>
</div>

<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
<md-card class="md-whiteframe-3dp"> <md-card-title>
<md-card-title-text layout-align="center"> <span
class="md-headline">{{'statisticsDistributionLicenses' |
Expand Down
24 changes: 13 additions & 11 deletions IdraPortal/src/main/webapp/statistics/statistics.js
Expand Up @@ -23,6 +23,8 @@ angular.module("IdraPlatform").controller('StatisticsCtrl',['$scope','Statistics
$scope.showBackFormat=false;
$scope.showBackLicense=false;

var maxPieDisplay = 8;

//Default 1 settimana
var end = new Date();
var start = new Date();
Expand Down Expand Up @@ -164,7 +166,7 @@ angular.module("IdraPlatform").controller('StatisticsCtrl',['$scope','Statistics

//$scope.formats.total+=x.cnt;

if($scope.formats.labels.length<10){
if($scope.formats.labels.length<maxPieDisplay){
if(x.format=="")
$scope.formats.labels.push("unknown");
else
Expand All @@ -178,7 +180,7 @@ angular.module("IdraPlatform").controller('StatisticsCtrl',['$scope','Statistics

});

if(formatsAll.labels.length >= 10 ){
if(formatsAll.labels.length >= maxPieDisplay ){
$scope.formats.labels.push("Others");
//$scope.formats.barChart[0].push(othCnt);
$scope.formats.pie.push(othCnt);
Expand All @@ -197,7 +199,7 @@ angular.module("IdraPlatform").controller('StatisticsCtrl',['$scope','Statistics

//$scope.licenses.total+=x.cnt;

if($scope.licenses.labels.length<10){
if($scope.licenses.labels.length<maxPieDisplay){
$scope.licenses.labels.push(x.license);
//$scope.licenses.barChart[0].push(x.cnt);
$scope.licenses.pie.push(x.cnt);
Expand All @@ -207,7 +209,7 @@ angular.module("IdraPlatform").controller('StatisticsCtrl',['$scope','Statistics

});

if(licensesAll.labels.length >= 10 ){
if(licensesAll.labels.length >= maxPieDisplay ){
$scope.licenses.labels.push("Others");
//$scope.licenses.barChart[0].push(othCnt1);
$scope.licenses.pie.push(othCnt1);
Expand Down Expand Up @@ -411,20 +413,20 @@ angular.module("IdraPlatform").controller('StatisticsCtrl',['$scope','Statistics

/*End OPTIONS*/

/*DrillDown*/
/*DrillDown*/
$scope.showTop10=function(category){
if(category=='format'){
$scope.showBackFormat=false;
//$scope.formats={labels:[],pie:[]};
$scope.formats.labels=[];
$scope.formats.pie=[];
for(i=0; i<10; i++){
for(i=0; i<maxPieDisplay; i++){
$scope.formats.labels.push(formatsAll.labels[i]);
$scope.formats.pie.push(formatsAll.pie[i]);
}

var others=0;
for(i=10;i<formatsAll.labels.length;i++){
for(i=maxPieDisplay;i<formatsAll.labels.length;i++){
others+=formatsAll.pie[i];
}
$scope.formats.labels.push("Others");
Expand All @@ -436,13 +438,13 @@ angular.module("IdraPlatform").controller('StatisticsCtrl',['$scope','Statistics
$scope.licenses.labels=[];
$scope.licenses.pie=[];

for(i=0; i<10; i++){
for(i=0; i<maxPieDisplay; i++){
$scope.licenses.labels.push(licensesAll.labels[i]);
$scope.licenses.pie.push(licensesAll.pie[i]);
}

var others=0;
for(i=10;i<licensesAll.labels.length;i++){
for(i=maxPieDisplay;i<licensesAll.labels.length;i++){
others+=licensesAll.pie[i];
}
$scope.licenses.labels.push("Others");
Expand All @@ -458,7 +460,7 @@ angular.module("IdraPlatform").controller('StatisticsCtrl',['$scope','Statistics
$scope.formats.pie=[];
// $scope.formats.total = formatsAll.total;

for(i=10; i<20; i++){
for(i=maxPieDisplay; i<20; i++){
$scope.formats.labels.push(formatsAll.labels[i]);
$scope.formats.pie.push(formatsAll.pie[i]);
}
Expand All @@ -478,7 +480,7 @@ angular.module("IdraPlatform").controller('StatisticsCtrl',['$scope','Statistics
$scope.licenses.labels=[];
$scope.licenses.pie=[];

for(i=10; i<20; i++){
for(i=maxPieDisplay; i<20; i++){
$scope.licenses.labels.push(licensesAll.labels[i]);
$scope.licenses.pie.push(licensesAll.pie[i]);
}
Expand Down

0 comments on commit 0ba2d4a

Please sign in to comment.