From 3099a31e3281595d72f9aaabbdf87d1b2d59d4d5 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Mon, 11 Sep 2023 10:48:34 +0200 Subject: [PATCH] Showing basic statistics (i.e. "X project published") via 'countByPhase'method [#25598] --- .classpath | 4 +- .../com.gwtplugins.gdt.eclipse.core.prefs | 2 +- .settings/org.eclipse.wst.common.component | 77 ++++++++++++++++--- CHANGELOG.md | 3 +- .../client/GeoportalDataViewerService.java | 2 + .../GeoportalDataViewerServiceAsync.java | 2 + .../layercollection/LayerCollectionPanel.java | 29 +++++++ .../LayerCollectionPanel.ui.xml | 2 + .../GeoportalDataViewerServiceImpl.java | 21 ++++- src/main/webapp/GeoportalDataViewer.css | 7 ++ 10 files changed, 132 insertions(+), 17 deletions(-) diff --git a/.classpath b/.classpath index 2e88564..4217d86 100644 --- a/.classpath +++ b/.classpath @@ -1,6 +1,6 @@ - + @@ -30,5 +30,5 @@ - + diff --git a/.settings/com.gwtplugins.gdt.eclipse.core.prefs b/.settings/com.gwtplugins.gdt.eclipse.core.prefs index 6671eb3..2d56c43 100644 --- a/.settings/com.gwtplugins.gdt.eclipse.core.prefs +++ b/.settings/com.gwtplugins.gdt.eclipse.core.prefs @@ -1,4 +1,4 @@ eclipse.preferences.version=1 -lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-3.6.0-SNAPSHOT +lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-3.6.0 warSrcDir=src/main/webapp warSrcDirIsOutput=false diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index f493311..8455444 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -1,5 +1,5 @@ - + @@ -90,8 +90,20 @@ - - + + + + + + + + + + + + + + @@ -183,7 +195,13 @@ - + + + + + + + @@ -275,7 +293,13 @@ - + + + + + + + @@ -367,7 +391,13 @@ - + + + + + + + @@ -459,7 +489,16 @@ - + + uses + + + + + + + + @@ -551,7 +590,13 @@ - + + + + + + + @@ -643,7 +688,13 @@ - + + + + + + + @@ -735,7 +786,13 @@ - + + + + + + + diff --git a/CHANGELOG.md b/CHANGELOG.md index a3af831..33ff76f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,10 +4,11 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [v3.6.0] +## [v3.6.0-SNAPSHOT] - GUI optimization [#25461] - Using the latest libraries version: gwt-ol.v8.4.1 (with openlayers.v6.6.1) and gwt.v2.10 +- Showing basic statistics (i.e. "X project published") via 'countByPhase' method [#25598] ## [v3.5.0] diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewerService.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewerService.java index 3c9d549..1be2b4c 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewerService.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewerService.java @@ -227,4 +227,6 @@ public interface GeoportalDataViewerService extends RemoteService { */ String getHTTPResponseForURL(String url); + Integer getCountFor(String profileID, String phase, String status); + } diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewerServiceAsync.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewerServiceAsync.java index a9b335b..257385c 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewerServiceAsync.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewerServiceAsync.java @@ -91,4 +91,6 @@ public interface GeoportalDataViewerServiceAsync { void getHTTPResponseForURL(String url, AsyncCallback callback); + void getCountFor(String profileID, String phase, String status, AsyncCallback callback); + } diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/layercollection/LayerCollectionPanel.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/layercollection/LayerCollectionPanel.java index a73c33e..df71b99 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/layercollection/LayerCollectionPanel.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/layercollection/LayerCollectionPanel.java @@ -66,6 +66,9 @@ public class LayerCollectionPanel extends Composite { @UiField HTMLPanel styleListPanel; + + @UiField + HTMLPanel statisticPanel; @UiField Button buttonLegend; @@ -109,6 +112,7 @@ public class LayerCollectionPanel extends Composite { buttonLegend.setType(ButtonType.LINK); legendPanel.setVisible(false); + statisticPanel.setVisible(false); GWT.log("Found available collection " + coll); String label = coll.getUcd().getName(); @@ -139,6 +143,31 @@ public class LayerCollectionPanel extends Composite { }); basePanel.add(checkbox); + + GeoportalDataViewerServiceAsync.Util.getInstance().getCountFor(collectionID, "Published", "OK", new AsyncCallback() { + + @Override + public void onFailure(Throwable caught) { + // TODO Auto-generated method stub + + } + + @Override + public void onSuccess(Integer result) { + + if(result!=null) { + String resultLabel = result+" project"; + if(result>1) { + resultLabel+="s"; + } + resultLabel+= " published"; + statisticPanel.setVisible(true); + statisticPanel.add(new HTML(resultLabel)); + } + + } + }); + ViewerConfiguration theConfig = GeoportalDataViewer.getStatus().getViewerConfig(); final GCubeCollection toOpen = theConfig.getAvailableCollections().get(collectionID); diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/layercollection/LayerCollectionPanel.ui.xml b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/layercollection/LayerCollectionPanel.ui.xml index afc4a62..9e3d6f1 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/layercollection/LayerCollectionPanel.ui.xml +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/layercollection/LayerCollectionPanel.ui.xml @@ -10,6 +10,8 @@ + + Layer Style diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/GeoportalDataViewerServiceImpl.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/GeoportalDataViewerServiceImpl.java index b991f8b..58300e6 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/GeoportalDataViewerServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/GeoportalDataViewerServiceImpl.java @@ -290,8 +290,8 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme ? new ZAxis(layerZAxis.getUnits(), layerZAxis.isPositive(), layerZAxis.getValues()) : null; - return new GeoInformationForWMSRequest(wmsServiceServiceEndpoint, validWMSRequest, layerName, versionWms, crs, - mapWmsNotStandard, styles, styles.isNcWms(), zAxis); + return new GeoInformationForWMSRequest(wmsServiceServiceEndpoint, validWMSRequest, layerName, versionWms, + crs, mapWmsNotStandard, styles, styles.isNcWms(), zAxis); } catch (Exception e) { String msg = "An error occurred during wms request validation for layer: " + layerName; LOG.error(msg, e); @@ -706,7 +706,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme GCubeSDILayer indexLayer = index.getLayer(); HashMap ogcLinks = indexLayer.getOgcLinks(); String wmsLink = ogcLinks.get("wms"); - LOG.info("wms link is {}", StringUtil.ellipsize(wmsLink, 150)); + LOG.info("wms link is {}", StringUtil.ellipsize(wmsLink, 150)); int lastCharOfthePath = wmsLink.indexOf("?"); String wmsPath = wmsLink.substring(0, lastCharOfthePath); for (GeoServerPlatformInfoDV geoserver : indexLayer.getPlatformInfos()) { @@ -1863,4 +1863,19 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme return HTTPRequestUtil.getResponse(url); } + @Override + public Integer getCountFor(String profileID, String phase, String status) { + LOG.debug("getCountFor profileID: " + profileID + ", phase: " + phase + ", status: " + status + "called"); + Integer integer = null; + try { + new GeoportalServiceIdentityProxy(this.getThreadLocalRequest()); + integer = GeoportalClientCaller.projects().getCountByPhaseFor(profileID, phase, status); + LOG.info("getCountFor profileID: " + profileID + ", phase: " + phase + ", status: " + status + + " returning: " + integer); + } catch (Exception e) { + LOG.error("Error occurred in getCountFor for profileID: " + profileID, e); + } + return integer; + } + } diff --git a/src/main/webapp/GeoportalDataViewer.css b/src/main/webapp/GeoportalDataViewer.css index 5ccfb17..f94ca63 100644 --- a/src/main/webapp/GeoportalDataViewer.css +++ b/src/main/webapp/GeoportalDataViewer.css @@ -776,6 +776,13 @@ Table Of Contents (TOC) color: gray; } +.statistic-style-panel { + margin-left: 25px; + font-size: 13px; + color: gray; + font-weight: bold; +} + .layer-style-panel-table-legend table td { padding-left: 5px; }