Commit f6aeed5a authored by Maxym Borodenko's avatar Maxym Borodenko

#272 JSP: Welcome page

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