-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GeoServer cloud version to webui home page
- Loading branch information
Showing
4 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...webui/src/main/java/org/geoserver/cloud/web/ui/GeoServerCloudHomePageContentProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* (c) 2022 Open Source Geospatial Foundation - all rights reserved This code is licensed under the | ||
* GPL 2.0 license, available at the root application directory. | ||
*/ | ||
package org.geoserver.cloud.web.ui; | ||
|
||
import org.apache.wicket.Component; | ||
import org.apache.wicket.markup.html.WebMarkupContainer; | ||
import org.geoserver.security.GeoServerSecurityManager; | ||
import org.geoserver.web.GeoServerHomePageContentProvider; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.info.BuildProperties; | ||
|
||
/** | ||
* Adds gs-cloud version info to the home page from spring-boot's {@link BuildProperties} | ||
* | ||
* @since 1.0 | ||
*/ | ||
public class GeoServerCloudHomePageContentProvider implements GeoServerHomePageContentProvider { | ||
|
||
private @Autowired GeoServerSecurityManager secManager; | ||
|
||
private @Autowired BuildProperties buildProperties; | ||
|
||
@Override | ||
public Component getPageBodyComponent(String id) { | ||
if (secManager.checkAuthenticationForAdminRole()) { | ||
return new GeoServerCloudStatusPanel(id, buildProperties); | ||
} | ||
return new WebMarkupContainer(id); // Placeholder | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...s/geoserver/webui/src/main/java/org/geoserver/cloud/web/ui/GeoServerCloudStatusPanel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* (c) 2022 Open Source Geospatial Foundation - all rights reserved This code is licensed under the | ||
* GPL 2.0 license, available at the root application directory. | ||
*/ | ||
package org.geoserver.cloud.web.ui; | ||
|
||
import org.apache.wicket.markup.html.basic.Label; | ||
import org.apache.wicket.markup.html.panel.Panel; | ||
import org.springframework.boot.info.BuildProperties; | ||
|
||
/** | ||
* @since 1.0 | ||
*/ | ||
public class GeoServerCloudStatusPanel extends Panel { | ||
private static final long serialVersionUID = 1L; | ||
|
||
public GeoServerCloudStatusPanel(String id, BuildProperties buildInfo) { | ||
super(id); | ||
this.add(new Label("gsCloudVersion", buildInfo.getVersion())); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...server/webui/src/main/resources/org/geoserver/cloud/web/ui/GeoServerCloudStatusPanel.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<html xmlns:wicket="http://wicket.apache.org/"> | ||
<body> | ||
<wicket:panel> | ||
<p class="info-link"> | ||
<span>GeoServer-Cloud version</span> <span wicket:id="gsCloudVersion">N/A</span> | ||
</p> | ||
</wicket:panel> | ||
</body> | ||
</html> |