Commit f6aeed5a authored by Maxym Borodenko's avatar Maxym Borodenko

#272 JSP: Welcome page

parent 19cae7d7
......@@ -225,4 +225,11 @@ public interface DatasetService {
*/
Dataset updateDatasetFile(Dataset dataset, RepositoryFile metadata) throws NoSuchRepositoryFileException;
/**
* Count the number of published datasets
*
* @return the number of published datasets
*/
long countPublished();
}
......@@ -476,6 +476,14 @@ public class DatasetServiceImpl implements DatasetService {
return lazyLoad(datasetRepository.save(loaded));
}
/**
* {@inheritDoc}
*/
@Override
public long countPublished() {
return datasetRepository.count(dataset.published.eq(true));
}
/**
* Copy values.
*
......
......@@ -88,6 +88,7 @@ public class HtmlController extends BaseController {
model.addAttribute("numberOfAccessions", statisticsService.numberOfAccessions());
model.addAttribute("numberOfActiveAccessions", statisticsService.numberOfActiveAccessions());
model.addAttribute("numberOfHistoricAccessions", statisticsService.numberOfHistoricAccessions());
model.addAttribute("numberOfPublishedDatasets", statisticsService.numberOfPublishedDatasets());
model.addAttribute("organizations", organizationService.list(new PageRequest(0, 5)));
......
/**
* Copyright 2014 Global Crop Diversity Trust
/*
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -12,7 +12,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
*/
package org.genesys2.server.service;
......@@ -28,14 +28,17 @@ public interface StatisticsService {
long numberOfInstitutes();
long numberOfAccessions();
long numberOfActiveAccessions();
long numberOfHistoricAccessions();
long numberOfPublishedDatasets();
PDCIStatistics statisticsPDCI(FaoInstitute faoInstitute);
PDCIStatistics statisticsPDCI(Organization organization);
PhenoStatistics statisticsPheno(FaoInstitute faoInstitute);
}
/**
* Copyright 2014 Global Crop Diversity Trust
/*
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -12,7 +12,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
*/
package org.genesys2.server.service.impl;
......@@ -20,6 +20,7 @@ import org.genesys2.server.model.genesys.PDCIStatistics;
import org.genesys2.server.model.genesys.PhenoStatistics;
import org.genesys2.server.model.impl.FaoInstitute;
import org.genesys2.server.model.impl.Organization;
import org.genesys.catalog.service.DatasetService;
import org.genesys2.server.service.GenesysService;
import org.genesys2.server.service.GeoService;
import org.genesys2.server.service.InstituteService;
......@@ -45,6 +46,9 @@ public class StatisticsServiceImpl implements StatisticsService {
@Autowired
private GenesysService genesysService;
@Autowired
private DatasetService datasetService;
@Override
@Cacheable(value = "statistics", key = "'stats.' + #root.methodName")
public long numberOfCountries() {
......@@ -75,6 +79,12 @@ public class StatisticsServiceImpl implements StatisticsService {
return genesysService.countAllHistoric();
}
@Override
@Cacheable(value = "statistics", key = "'stats.' + #root.methodName")
public long numberOfPublishedDatasets() {
return datasetService.countPublished();
}
@Override
@Cacheable(unless = "#result == null", value = "statistics", key = "'stats.' + #root.methodName + '-' + #faoInstitute.id")
public PDCIStatistics statisticsPDCI(FaoInstitute faoInstitute) {
......
......@@ -51,6 +51,9 @@ public class AddStuffInterceptor implements HandlerInterceptor, InitializingBean
@Value("${google.analytics.account}")
private String googleAnalyticsAccount;
@Value("${genesys.catalog.url}")
private String genesysCatalogUrl;
public abstract interface RandomString {
/// Get a random CDN server
public String getNext();
......@@ -108,6 +111,7 @@ public class AddStuffInterceptor implements HandlerInterceptor, InitializingBean
request.setAttribute("cdnServers", randomCdnServer);
request.setAttribute("baseUrl", baseUrl);
request.setAttribute("currentYear", LocalDate.now().getYear());
request.setAttribute("genesysCatalogUrl", genesysCatalogUrl);
if (googleAnalyticsAccount != null) {
request.setAttribute("googleAnalyticsAccount", googleAnalyticsAccount);
......
......@@ -209,3 +209,5 @@ itpgrfa.glis.ratelimit=20
partner.primary.uuid=39d3022b-dfca-45d8-98f1-3eeaa6c3e605
default.jwt.signingKey=genesys-signing-key-changeme
# Genesys Catalog URL
genesys.catalog.url=http://localhost:3000
......@@ -95,7 +95,7 @@ footer.copyright-statement=© 2013 - {0} Data Providers and the Crop Trust
menu.home=Home
menu.browse=Browse
menu.datasets=C&E Data
menu.datasets=Datasets
menu.descriptors=Descriptors
menu.countries=Countries
menu.institutes=Institutes
......@@ -830,6 +830,7 @@ share.link.placeholder=Please wait...
share.link.text=Please use the shortened version of the full URL to this page:
welcome.read-more=Read more about Genesys
welcome.quick-overview=Quick overview
twitter.latest-on-twitter=Latest on Twitter
video.play-video=Play video
......
......@@ -89,7 +89,6 @@ footer.copyright-statement=© 2013 - {0} مقدمو البيانات وشر
menu.home=الرئيسية
menu.browse=تصفح
menu.datasets=بيانات التوصيف والتقييم
menu.descriptors=الواصفات
menu.countries=الدول
menu.institutes=المنشآت
......
......@@ -89,7 +89,6 @@ footer.copyright-statement=© 2013 - {0} Datenanbieter und der Crop Trust
menu.home=Home
menu.browse=Browsen
menu.datasets=C&E-Daten
menu.descriptors=Deskriptoren
menu.countries=Länder
menu.institutes=Institute
......
......@@ -89,7 +89,6 @@ footer.copyright-statement=© 2013 - {0} Proveedores de datos y el Crop Trus
menu.home=Página de inicio
menu.browse=Navegar
menu.datasets=Datos de C&E
menu.descriptors=Descriptores
menu.countries=Países
menu.institutes=Instituciones
......
......@@ -89,7 +89,6 @@ footer.copyright-statement=‎© 2013 - {0} Data Providers and the Crop Trus
menu.home=صفحه اصلی
menu.browse=مرور
menu.datasets=داده‌های C&E
menu.descriptors=توصیف‌گرها
menu.countries=کشورها
menu.institutes=مؤسسات
......
......@@ -89,7 +89,6 @@ footer.copyright-statement=© 2013 - {0} Les fournisseurs de données et le
menu.home=Accueil
menu.browse=Naviguer
menu.datasets=Données C&E
menu.descriptors=Descripteurs
menu.countries=Pays
menu.institutes=Instituts
......
......@@ -89,7 +89,6 @@ footer.copyright-statement=© 2013 - {0} Provedores de dados e Crop Trust
menu.home=Início
menu.browse=Navegar
menu.datasets=Dados de caracterização e avaliação
menu.descriptors=Descritores
menu.countries=Países
menu.institutes=Institutos
......
......@@ -89,7 +89,6 @@ footer.copyright-statement=© 2013 - {0} Провайдеры данных
menu.home=На главную
menu.browse=Просмотреть
menu.datasets=Данные по характеристике и оценке
menu.descriptors=Дескрипторы
menu.countries=Страны
menu.institutes=Институты
......
......@@ -89,7 +89,6 @@ footer.copyright-statement=© 2013 - {0} 数据提供者与 Crop Trust
menu.home=首页
menu.browse=浏览
menu.datasets=评价鉴定数据
menu.descriptors=描述符
menu.countries=国家
menu.institutes=机构
......
......@@ -25,10 +25,6 @@
</div>
<ul class="nav navbar-nav nav-menu" id="navigation-menu">
<li class="pull-left menu-title" id="home-li">
<a class="menu-link" href="<c:url value="/welcome" />" title="<spring:message code="menu.home" />"><spring:message code="menu.home" />
</a>
</li>
<li class="dropdown pull-left menu-title" id="about-li" >
<a class="menu-link" id="about-a" href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> <spring:message code="menu.about" /> <span class="caret"></span>
</a>
......@@ -89,7 +85,11 @@
<a class="menu-link" href="<c:url value="/explore" />"> <spring:message code="menu.browse" />
</a>
</li>
<%-- <li><a href="<c:url value="/data/" />"><spring:message code="menu.datasets" /></a></li> --%>
<li class="pull-left menu-title" id="datasets-li">
<a class="menu-link" href="<c:url value='${genesysCatalogUrl}/datasets' />" title="<spring:message code="menu.datasets" />">
<spring:message code="menu.datasets" />
</a>
</li>
<%-- <li><a href="<c:url value="/descriptors/" />"><spring:message code="menu.descriptors" /></a></li> --%>
<li class="pull-left menu-title" id="geo-id">
<a class="menu-link" href="<c:url value="/geo/" />"> <spring:message code="menu.countries" />
......
......@@ -28,7 +28,7 @@
<div class="row no-space map">
<div id="stats" class="col-md-4 col-sm-12 col-xs-12">
<h2 class="short text-right pull-left">
<spring:message code="maps.accession-map" />
<spring:message code="welcome.quick-overview" />
</h2>
<div class="stats-map">
......@@ -39,11 +39,11 @@
<spring:message code="stats.number-of-accessions" arguments="${numberOfActiveAccessions}" />
</a>
</div>
<%-- <div class="one-stat">
<a href="<c:url value="/explore"><c:param name="filter" value='{"historic":[true]}' /></c:url>">
<spring:message code="stats.number-of-historic-accessions" arguments="${numberOfHistoricAccessions}" />
<div class="one-stat">
<a href="<c:url value="${genesysCatalogUrl}/datasets" />">
<spring:message code="stats.number-of-datasets" arguments="${numberOfPublishedDatasets}" />
</a>
</div> --%>
</div>
<div class="one-stat">
<a href="<c:url value="/wiews/active" />">
<spring:message code="stats.number-of-institutes" arguments="${numberOfInstitutes}" />
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment