Commit 11242cd0 authored by Matija Obreza's avatar Matija Obreza
Browse files

Admin decorator

parent f185f5a6
......@@ -57,10 +57,22 @@ public class CacheController {
@Autowired
private CacheManager cacheManager;
@RequestMapping(method = RequestMethod.POST, value = "/clearCache", params = { "clearTiles" })
public String clearCacheTiles() {
return clearTilesCache();
}
@RequestMapping(method = RequestMethod.POST, value = "/clearCache", params = { "clearAll" })
public String clearCacheAll() {
return clearCaches();
}
@RequestMapping(method = RequestMethod.POST, value = "/clearTilesCache")
public String clearTilesCache() {
final Cache tileServerCache = cacheManager.getCache("tileserver");
System.err.println("tileServerCache=" + tileServerCache.getNativeCache());
if (LOG.isDebugEnabled()) {
LOG.debug("tileServerCache=" + tileServerCache.getNativeCache());
}
@SuppressWarnings("rawtypes")
final IMap hazelCache = (IMap) tileServerCache.getNativeCache();
......@@ -108,30 +120,25 @@ public class CacheController {
for (HazelcastInstance hz : instances) {
if (LOG.isDebugEnabled())
LOG.debug("\n\nCache stats Instance: " + hz.getName());
for (DistributedObject o : hz.getDistributedObjects()) {
if (o instanceof IMap) {
IMap imap = (IMap) o;
IMap<?, ?> imap = (IMap<?, ?>) o;
cacheMaps.add(new CacheStats(imap));
// System.out.println(imap.getServiceName() + ": " +
// imap.getName() + " " + imap.getPartitionKey());
// LocalMapStats localMapStats = imap.getLocalMapStats();
// System.out.println("created: " +
// localMapStats.getCreationTime());
// System.out.println("owned entries: " +
// localMapStats.getOwnedEntryCount());
// System.out.println("backup entries: " +
// localMapStats.getBackupEntryCount());
// System.out.println("locked entries: " +
// localMapStats.getLockedEntryCount());
// System.out.println("dirty entries: " +
// localMapStats.getDirtyEntryCount());
// System.out.println("hits: " + localMapStats.getHits());
// System.out.println("puts: " +
// localMapStats.getPutOperationCount());
// System.out.println("last update: " +
// localMapStats.getLastUpdateTime());
// System.out.println("last access:" +
// localMapStats.getLastAccessTime());
if (LOG.isDebugEnabled()) {
LOG.debug(imap.getServiceName() + ": " + imap.getName() + " " + imap.getPartitionKey());
LocalMapStats localMapStats = imap.getLocalMapStats();
LOG.debug("created: " + localMapStats.getCreationTime());
LOG.debug("owned entries: " + localMapStats.getOwnedEntryCount());
LOG.debug("backup entries: " + localMapStats.getBackupEntryCount());
LOG.debug("locked entries: " + localMapStats.getLockedEntryCount());
LOG.debug("dirty entries: " + localMapStats.getDirtyEntryCount());
LOG.debug("hits: " + localMapStats.getHits());
LOG.debug("puts: " + localMapStats.getPutOperationCount());
LOG.debug("last update: " + localMapStats.getLastUpdateTime());
LOG.debug("last access:" + localMapStats.getLastAccessTime());
}
} else {
if (LOG.isDebugEnabled())
LOG.debug(o.getClass() + " " + o);
......
......@@ -681,6 +681,7 @@ menu.admin.index=Admin
menu.admin.loggers=Loggers
menu.admin.caches=Caches
menu.admin.ds2=DS2 Datasets
menu.admin.usermanagement=User management
news.content.page.all.title=News list
news.archive.title=News Archive
......
......@@ -13,7 +13,7 @@ $body-bg: #fff !default;
// Global text color on `<body>`.
$text-color: #000 !default;
$font-family-sans-serif: "Noto Sans",Helvetica,Arial,Freesans,Clean,sans-serif !default;
$font-family-sans-serif: arial,sans-serif;
$font-size-base: 16px !default;
/* Unit-less `line-height` for use in components like buttons. */
/* $line-height-base: 1.428571429 !default; // 20/14 */
......
$brand-primary: #88ba42 !default; // darken(#428bca, 6.5%) !default; // #337ab7
$break-small: 320px;
$break-normal: 1024px;
$break-xlarge: 1200px;
$footer-height: 60px;
@font-face {
font-family: 'FontAwesome';
......@@ -18,16 +17,6 @@ $break-xlarge: 1200px;
font-style: normal;
}
@font-face {
font-family: 'Noto Sans';
src: url('fonts/NotoSans-Regular-webfont.eot');
src: url('fonts/NotoSans-Regular-webfont.eot?#iefix') format('embedded-opentype'),
url('fonts/NotoSans-Regular-webfont.woff') format('woff'),
url('fonts/NotoSans-Regular-webfont.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
/* Sticky Footer */
html {
position: relative;
......@@ -35,7 +24,9 @@ html {
}
body {
font-family: 'Noto Sans';
font-family: arial,sans-serif;
padding-top: 51px;
margin-bottom: $footer-height;
}
.fa {
......@@ -60,7 +51,7 @@ footer {
position: absolute;
bottom: 0px;
width: 100%;
height: 60px;
height: $footer-height;
background-color: #F5F5F5;
}
......@@ -69,3 +60,21 @@ footer {
margin: 20px 0px;
}
}
.rows-striped {
> .row:nth-of-type(odd) {
background-color: #f0f0f0;
}
}
.row-header {
font-weight: bold;
}
.top-image {
img {
width: 100%;
}
}
<%@include file="/WEB-INF/jsp/init.jsp"%>
<!DOCTYPE html>
<html lang="${pageContext.response.locale.language}" dir="${pageContext.response.locale.language=='fa' || pageContext.response.locale.language=='ar' ? 'rtl' : 'ltr'}"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:schema="http://schema.org/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dwc="http://rs.tdwg.org/dwc/terms/"
xmlns:germplasm="http://purl.org/germplasm/germplasmTerm#" xmlns:germplasmType="http://purl.org/germplasm/germplasmType#"
>
<head>
<title><sitemesh:write property="title" /></title>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="language" content="${pageContext.response.locale.language}" />
<!-- CSRF protection-->
<meta name="_csrf" content="${_csrf.token}" />
<!-- default header name is X-CSRF-TOKEN -->
<meta name="_csrf_header" content="${_csrf.headerName}" />
<!-- Links -->
<link rel="shortcut icon" href="<c:url value="/html/0/images/genesys.png" />" />
<!-- opensearch.org -->
<link rel="search" hreflang="${pageContext.response.locale.language}" type="application/opensearchdescription+xml" href="<c:url value="/acn/opensearch/desc" />"
title="<spring:message code="search.input.placeholder" />"
/>
<!-- l10n -->
<link rel="alternate" hreflang="en" href="<c:url value="/en${pageContext.request.getAttribute('org.genesys2.server.servlet.filter.LocaleURLFilter.INTERNALURL')}" />" />
<link rel="alternate" hreflang="ar" href="<c:url value="/ar${pageContext.request.getAttribute('org.genesys2.server.servlet.filter.LocaleURLFilter.INTERNALURL')}" />" />
<link rel="alternate" hreflang="de" href="<c:url value="/de${pageContext.request.getAttribute('org.genesys2.server.servlet.filter.LocaleURLFilter.INTERNALURL')}" />" />
<link rel="alternate" hreflang="es" href="<c:url value="/es${pageContext.request.getAttribute('org.genesys2.server.servlet.filter.LocaleURLFilter.INTERNALURL')}" />" />
<link rel="alternate" hreflang="fa" href="<c:url value="/fa${pageContext.request.getAttribute('org.genesys2.server.servlet.filter.LocaleURLFilter.INTERNALURL')}" />" />
<link rel="alternate" hreflang="fr" href="<c:url value="/fr${pageContext.request.getAttribute('org.genesys2.server.servlet.filter.LocaleURLFilter.INTERNALURL')}" />" />
<link rel="alternate" hreflang="pt" href="<c:url value="/pt${pageContext.request.getAttribute('org.genesys2.server.servlet.filter.LocaleURLFilter.INTERNALURL')}" />" />
<link rel="alternate" hreflang="ru" href="<c:url value="/ru${pageContext.request.getAttribute('org.genesys2.server.servlet.filter.LocaleURLFilter.INTERNALURL')}" />" />
<link rel="alternate" hreflang="zh" href="<c:url value="/zh${pageContext.request.getAttribute('org.genesys2.server.servlet.filter.LocaleURLFilter.INTERNALURL')}" />" />
<!-- Custom styles for this template -->
<%@include file="css.jsp"%>
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
<sitemesh:write property="head" />
<meta name="author" content="Global Crop Diversity Trust" />
</head>
<security:authentication var="user" property="principal" />
<body>
<%@include file="header.jsp"%>
<nav class="navbar navbar-default navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-admin" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="<c:url value="/1/admin/" />">
<spring:message code="page.home.title" />
</a>
</div>
<div id="navbar-admin" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="hidden-sm">
<a href="<c:url value="/1/welcome" />" title="<spring:message code="menu.home" />">
<spring:message code="menu.home" />
</a>
</li>
<li>
<a class="" href="<c:url value="/1/admin/cache/" />">
<spring:message code="menu.admin.caches" />
</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
<spring:message code="menu.admin.usermanagement" />
<span class="caret"></span>
</a>
<ul class="dropdown-menu pull-left">
<li>
<a href="<c:url value="/1/profile/list" />">
<spring:message code="user.pulldown.users" />
</a>
</li>
<li>
<a href="<c:url value="/1/team" />">
<spring:message code="user.pulldown.teams" />
</a>
</li>
</ul>
</li>
<li>
<a class="" href="<c:url value="/1/admin/logger/" />">
<spring:message code="menu.admin.loggers" />
</a>
</li>
<li>
<a class="" href="<c:url value="/1/admin/ds2/" />">
<spring:message code="menu.admin.ds2" />
</a>
</li>
<li>
<a class="" href="<c:url value="/1/admin/kpi/" />">
<spring:message code="menu.admin.kpi" />
</a>
</li>
</ul>
</div>
</div>
</nav>
<!-- Begin page content -->
<div id="content" class="<sitemesh:write property="body.class" />">
<div class="container-fluid">
<div id="content-header" class="row">
<sitemesh:write property="page.header" />
</div>
<div id="content-body" class="">
<%-- <h1>
<sitemesh:write property="title" />
</h1>--%>
<div id="dialog" class="row"></div>
<div id="content-body-content" class="" typeof="<sitemesh:write property="body.typeof" />">
<sitemesh:write property="body" />
</div>
</div>
</div>
</div>
<%@include file="footer.jsp"%>
<sitemesh:write property="page.javascript" />
<%@include file="ga.jsp"%>
</body>
</html>
......@@ -10,11 +10,11 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="<c:url value="/1/welcome" />">Genesys 2</a>
<a class="navbar-brand" href="<c:url value="/1/welcome" />"><spring:message code="page.home.title" /></a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active">
<li class="hidden-sm">
<a href="<c:url value="/1/welcome" />" title="<spring:message code="menu.home" />">
<spring:message code="menu.home" />
</a>
......
......@@ -62,10 +62,10 @@
<div id="content-header" class="row">
<sitemesh:write property="page.header" />
</div>
<div id="content-body" class="row">
<h1>
<div id="content-body" class="">
<%-- <h1>
<sitemesh:write property="title" />
</h1>
</h1>--%>
<div id="dialog" class="row"></div>
<div id="content-body-content" class="" typeof="<sitemesh:write property="body.typeof" />">
<sitemesh:write property="body" />
......
......@@ -5,83 +5,92 @@
<html>
<head>
<title><spring:message code="admin.cache.page.title" />1</title>
<title><spring:message code="admin.cache.page.title" />1
</title>
</head>
<body>
<h1>
<spring:message code="admin.cache.page.title" />
</h1>
<div class="row">
<div class="col-xs-12">
<form class="form-inline" method="post" action="<c:url value="/admin/cache/clearCache" />">
<button type="submit" name="clearTiles" class="btn btn-warning">Clear tiles cache</button>
<button type="submit" name="clearAll" class="btn btn-warning">Clear all caches</button>
<!-- CSRF protection -->
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />
</form>
</div>
</div>
<%@ include file="/WEB-INF/jsp/admin/menu.jsp"%>
<div class="row row-header">
<div class="col-sm-7 col-xs-12"></div>
<div class="col-sm-1 col-sm-offset-0 col-xs-offset-2 col-xs-2">
<spring:message code="cache.stat.map.ownedEntryCount" />
</div>
<div class="col-sm-1 col-xs-2">
<spring:message code="cache.stat.map.lockedEntryCount" />
</div>
<div class="col-sm-1 col-xs-2">
<spring:message code="cache.stat.map.puts" />
</div>
<div class="col-sm-1 col-xs-2">
<spring:message code="cache.stat.map.hits" />
</div>
<div class="col-sm-1 col-xs-2"></div>
</div>
<div class="rows-striped">
<c:forEach items="${cacheMaps}" var="cacheMap">
<div class="row">
<div class="col-sm-7 col-xs-12">
<div class="form-control-static">
<b>
<c:out value="${cacheMap.name}" />
</b>
<small>
<c:out value="${cacheMap.serviceName}" />
</small>
</div>
</div>
<form method="post" action="<c:url value="/admin/cache/clearTilesCache" />">
<input type="submit" class="btn btn-default" value="Clear Tiles cache" />
<!-- CSRF protection -->
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />
</form>
<div class="col-sm-1 col-sm-offset-0 col-xs-offset-2 col-xs-2">
<p class="form-control-static">
<c:out value="${cacheMap.mapStats.ownedEntryCount}" />
</p>
</div>
<div class="col-sm-1 col-xs-2">
<p class="form-control-static">
<c:out value="${cacheMap.mapStats.lockedEntryCount}" />
</p>
</div>
<div class="col-sm-1 col-xs-2">
<p class="form-control-static">
<c:out value="${cacheMap.mapStats.putOperationCount}" />
</p>
</div>
<div class="col-sm-1 col-xs-2">
<p class="form-control-static">
<c:out value="${cacheMap.mapStats.hits}" />
</p>
</div>
<form method="post" action="<c:url value="/admin/cache/clearCaches" />">
<input type="submit" class="btn btn-default" value="Clear all caches" />
<!-- CSRF protection -->
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />
</form>
<div class="col-sm-1 col-xs-2">
<form method="post" action="<c:url value="/admin/cache/clearCache" />">
<input type="hidden" name="name" value="${cacheMap.name}" />
<button type="submit" class="btn btn-default btn-sm">Clear</button>
<!-- CSRF protection -->
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />
</form>
</div>
<c:forEach items="${cacheMaps}" var="cacheMap">
<h3>
<c:out value="${cacheMap.serviceName}" />
<c:out value="${cacheMap.name}" />
</h3>
<form method="post" action="<c:url value="/admin/cache/clearCache" />">
<input type="hidden" name="name" value="${cacheMap.name}" />
<input type="submit" class="btn btn-default" value="Clear" />
<!-- CSRF protection -->
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />
</form>
<c:set value="${cacheMap.mapStats}" var="mapStat" />
<div class="row">
<div class="col-xs-6 col-sm-4">
<spring:message code="cache.stat.map.ownedEntryCount" />
</div>
<div class="col-xs-6 col-sm-8">
<c:out value="${mapStat.ownedEntryCount}" />
</div>
</div>
</div>
</c:forEach>
</div>
<div class="row">
<div class="col-xs-6 col-sm-4">
<spring:message code="cache.stat.map.lockedEntryCount" />
</div>
<div class="col-xs-6 col-sm-8">
<c:out value="${mapStat.lockedEntryCount}" />
</div>
</div>
<div class="row">
<div class="col-xs-6 col-sm-4">
<spring:message code="cache.stat.map.puts" />
</div>
<div class="col-xs-6 col-sm-8">
<c:out value="${mapStat.putOperationCount}" />
</div>
</div>
<div class="row">
<div class="col-xs-6 col-sm-4">
<spring:message code="cache.stat.map.hits" />
</div>
<div class="col-xs-6 col-sm-8">
<c:out value="${mapStat.hits}" />
</div>
</div>
</c:forEach>
<c:forEach items="${cacheOthers}" var="cacheOther">
<h3>
<c:out value="${cacheOther}" />
<c:out value="${cacheOther}" />
</h3>
</c:forEach>
<c:forEach items="${cacheOthers}" var="cacheOther">
<h3>
<c:out value="${cacheOther}" />
<c:out value="${cacheOther}" />
</h3>
</c:forEach>
</body>
</html>
\ No newline at end of file
......@@ -27,6 +27,7 @@
<mapping path="*/ajax/*" exclude="true" />
<!-- UI v1 -->
<mapping path="/1/admin/*" decorator="/WEB-INF/decorator/1/admin.jsp" />
<mapping path="/1/*" decorator="/WEB-INF/decorator/1/wide.jsp" />
<!-- Original UI -->
......
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