aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-webapp
diff options
context:
space:
mode:
authorBrett Porter <brett@apache.org>2006-09-08 14:33:45 +0000
committerBrett Porter <brett@apache.org>2006-09-08 14:33:45 +0000
commit44dce100876f756c26945ce0e5295af448785bd8 (patch)
tree54ed503c35907d39bcee4ced627eb68ccf67e1b5 /archiva-webapp
parent3e5e310c64046ee7ae3e02d392663a6ad2e2ca40 (diff)
downloadarchiva-44dce100876f756c26945ce0e5295af448785bd8.tar.gz
archiva-44dce100876f756c26945ce0e5295af448785bd8.zip
[MRM-77] preliminary reporting web interface
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@441516 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-webapp')
-rw-r--r--archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ReportsAction.java81
-rw-r--r--archiva-webapp/src/main/resources/xwork.xml4
-rw-r--r--archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp22
-rw-r--r--archiva-webapp/src/main/webapp/WEB-INF/jsp/include/artifactDependencies.jspf2
-rw-r--r--archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/reports.jsp181
-rw-r--r--archiva-webapp/src/main/webapp/css/maven-theme.css1
-rw-r--r--archiva-webapp/src/main/webapp/css/site.css8
7 files changed, 288 insertions, 11 deletions
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ReportsAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ReportsAction.java
new file mode 100644
index 000000000..0e5efac7f
--- /dev/null
+++ b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ReportsAction.java
@@ -0,0 +1,81 @@
+package org.apache.maven.archiva.web.action;
+
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
+ */
+
+import com.opensymphony.xwork.ActionSupport;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.ConfigurationStore;
+import org.apache.maven.archiva.configuration.ConfiguredRepositoryFactory;
+import org.apache.maven.archiva.configuration.RepositoryConfiguration;
+import org.apache.maven.archiva.reporting.ReportingDatabase;
+import org.apache.maven.archiva.reporting.ReportingStore;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Repository reporting.
+ *
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="reportsAction"
+ */
+public class ReportsAction
+ extends ActionSupport
+{
+ /**
+ * @plexus.requirement
+ */
+ private ReportingStore reportingStore;
+
+ /**
+ * @plexus.requirement
+ */
+ private ConfigurationStore configurationStore;
+
+ /**
+ * @plexus.requirement
+ */
+ private ConfiguredRepositoryFactory factory;
+
+ private List databases;
+
+ public String execute()
+ throws Exception
+ {
+ databases = new ArrayList();
+
+ Configuration configuration = configurationStore.getConfigurationFromStore();
+
+ for ( Iterator i = configuration.getRepositories().iterator(); i.hasNext(); )
+ {
+ RepositoryConfiguration repositoryConfiguration = (RepositoryConfiguration) i.next();
+
+ ArtifactRepository repository = factory.createRepository( repositoryConfiguration );
+
+ ReportingDatabase database = reportingStore.getReportsFromStore( repository );
+
+ databases.add( database );
+ }
+ return SUCCESS;
+ }
+
+ public List getDatabases()
+ {
+ return databases;
+ }
+}
diff --git a/archiva-webapp/src/main/resources/xwork.xml b/archiva-webapp/src/main/resources/xwork.xml
index 382b15631..61def7a32 100644
--- a/archiva-webapp/src/main/resources/xwork.xml
+++ b/archiva-webapp/src/main/resources/xwork.xml
@@ -107,6 +107,10 @@
<result>/WEB-INF/jsp/showArtifact.jsp</result>
</action>
+ <action name="reports" class="reportsAction">
+ <result>/WEB-INF/jsp/reports/reports.jsp</result>
+ </action>
+
<action name="showArtifactDependencies" class="showArtifactAction" method="dependencies">
<result>/WEB-INF/jsp/showArtifact.jsp</result>
</action>
diff --git a/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp b/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp
index 20476d744..4ee4b35f8 100644
--- a/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp
+++ b/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp
@@ -25,11 +25,11 @@
</title>
<style type="text/css" media="all">
- @import url( "<%= request.getContextPath() %>/css/maven-base.css" );
- @import url( "<%= request.getContextPath() %>/css/maven-theme.css" );
- @import url( "<%= request.getContextPath() %>/css/site.css" );
+ @import url( "<c:url value="/css/maven-base.css" />" );
+ @import url( "<c:url value="/css/maven-theme.css" />" );
+ @import url( "<c:url value="/css/site.css" />" );
</style>
- <link rel="stylesheet" href="<%= request.getContextPath() %>/css/print.css" type="text/css" media="print"/>
+ <link rel="stylesheet" href="<c:url value="/css/print.css"/>" type="text/css" media="print"/>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
</head>
@@ -62,10 +62,13 @@
<ww:url id="logoutUrl" action="logout" namespace="/"/>
<ww:url id="registerUrl" action="register" namespace="/"/>
<ww:if test="${sessionScope.authStatus != true}">
- <ww:a href="%{loginUrl}">Login</ww:a> or <ww:a href="%{registerUrl}">Register</ww:a>
+ <ww:a href="%{loginUrl}">Login</ww:a>
+ or
+ <ww:a href="%{registerUrl}">Register</ww:a>
</ww:if>
<ww:else>
- Welcome, <b>${sessionScope.user.username}</b> - <ww:a href="%{logoutUrl}">Logout</ww:a>
+ Welcome, <b>${sessionScope.user.username}</b> -
+ <ww:a href="%{logoutUrl}">Logout</ww:a>
</ww:else>
</div>
@@ -101,13 +104,12 @@
</ul>
<h5>Manage</h5>
<ul>
+ <li class="none">
+ <my:currentWWUrl action="reports" namespace="/">Reports</my:currentWWUrl>
+ </li>
<%-- TODO
<li class="none">
- <a href="#">Reports</a>
- </li>
-
- <li class="none">
<a href="#">Synchronisation</a>
</li>
--%>
diff --git a/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/artifactDependencies.jspf b/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/artifactDependencies.jspf
index c9501cca5..32477f58a 100644
--- a/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/artifactDependencies.jspf
+++ b/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/artifactDependencies.jspf
@@ -1,7 +1,7 @@
<%@ taglib prefix="ww" uri="/webwork" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-<%-- TODO: paginate --%>
+<%-- TODO: paginate! --%>
<c:forEach items="${dependencies}" var="dependency">
<h3>
<c:set var="url">
diff --git a/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/reports.jsp b/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/reports.jsp
new file mode 100644
index 000000000..2905bea74
--- /dev/null
+++ b/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/reports.jsp
@@ -0,0 +1,181 @@
+<%--
+ ~ Copyright 2005-2006 The Apache Software Foundation.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ 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.
+ --%>
+
+<%@ taglib prefix="ww" uri="/webwork" %>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
+
+<html>
+<head>
+ <title>Repository Health</title>
+ <ww:head/>
+</head>
+
+<body>
+
+<h1>Reports</h1>
+
+<div id="contentArea">
+
+<ww:set name="databases" value="databases"/>
+<c:forEach items="${databases}" var="database">
+<h2>Repository: ${database.repository.name}</h2>
+
+<p>
+ Status:
+ <img src="<c:url value="/images/icon_error_sml.gif"/>" width="15" height="15" alt=""/>
+ ${database.numFailures}
+ <img src="<c:url value="/images/icon_warning_sml.gif"/>" width="15" height="15" alt=""/>
+ ${database.numWarnings}
+ <%-- TODO!
+ (<a href="#">Repair all</a>)
+ --%>
+</p>
+
+<%-- TODO! factor out common parts, especially artifact rendering tag --%>
+<%-- TODO! paginate --%>
+<c:if test="${!empty(database.reporting.artifacts)}">
+ <h3>Artifacts</h3>
+ <c:forEach items="${database.reporting.artifacts}" var="artifact" begin="0" end="2">
+ <ul>
+ <c:forEach items="${artifact.failures}" var="result">
+ <li class="errorBullet">${result.reason}</li>
+ </c:forEach>
+ <c:forEach items="${artifact.warnings}" var="result">
+ <li class="warningBullet">${result.reason}</li>
+ </c:forEach>
+ </ul>
+ <p style="text-indent: 3em;">
+ <span style="font-size: x-small">
+ <%-- TODO! share with browse as a tag --%>
+ <c:set var="cumulativeGroup" value=""/>
+ <c:forTokens items="${artifact.groupId}" delims="." var="part">
+ <c:choose>
+ <c:when test="${empty(cumulativeGroup)}">
+ <c:set var="cumulativeGroup" value="${part}"/>
+ </c:when>
+ <c:otherwise>
+ <c:set var="cumulativeGroup" value="${cumulativeGroup}.${part}"/>
+ </c:otherwise>
+ </c:choose>
+ <c:set var="url">
+ <ww:url action="browseGroup" namespace="/">
+ <ww:param name="groupId" value="%{'${cumulativeGroup}'}"/>
+ </ww:url>
+ </c:set>
+ <a href="${url}">${part}</a> /
+ </c:forTokens>
+ <strong>${artifact.artifactId}</strong>
+ | <strong>Version:</strong>
+ <c:set var="url">
+ <ww:url action="showArtifact" namespace="/">
+ <ww:param name="groupId" value="%{'${artifact.groupId}'}"/>
+ <ww:param name="artifactId" value="%{'${artifact.artifactId}'}"/>
+ <c:if test="${!empty(artifact.version)}">
+ <ww:param name="version" value="%{'${artifact.version}'}"/>
+ </c:if>
+ </ww:url>
+ </c:set>
+ <a href="${url}">${artifact.version}</a>
+ <c:if test="${!empty(artifact.classifier)}">
+ | <strong>Classifier:</strong> ${artifact.classifier}
+ </c:if>
+ </span>
+ </p>
+ <%-- TODO!
+ <td>
+ <a href="#">Repair</a>
+ </td>
+ --%>
+ </c:forEach>
+ <c:if test="${fn:length(database.reporting.artifacts) gt 3}">
+ <p>
+ <b>... more ...</b>
+ </p>
+ </c:if>
+</c:if>
+<c:if test="${!empty(database.reporting.metadata)}">
+ <h3>Metadata</h3>
+ <c:forEach items="${database.reporting.metadata}" var="metadata" begin="0" end="2">
+ <ul>
+ <c:forEach items="${metadata.failures}" var="result">
+ <li class="errorBullet">${result.reason}</li>
+ </c:forEach>
+ <c:forEach items="${metadata.warnings}" var="result">
+ <li class="warningBullet">${result.reason}</li>
+ </c:forEach>
+ </ul>
+ <p style="text-indent: 3em;">
+ <span style="font-size: x-small">
+ <%-- TODO! share with browse as a tag --%>
+ <c:set var="cumulativeGroup" value=""/>
+ <c:forTokens items="${metadata.groupId}" delims="." var="part" varStatus="i">
+ <c:choose>
+ <c:when test="${empty(cumulativeGroup)}">
+ <c:set var="cumulativeGroup" value="${part}"/>
+ </c:when>
+ <c:otherwise>
+ <c:set var="cumulativeGroup" value="${cumulativeGroup}.${part}"/>
+ </c:otherwise>
+ </c:choose>
+ <c:set var="url">
+ <ww:url action="browseGroup" namespace="/">
+ <ww:param name="groupId" value="%{'${cumulativeGroup}'}"/>
+ </ww:url>
+ </c:set>
+ <a href="${url}">${part}</a>
+ <c:if test="${!i.last}">
+ /
+ </c:if>
+ </c:forTokens>
+ <c:if test="${!empty(metadata.artifactId)}">
+ <c:set var="url">
+ <ww:url action="browseArtifact" namespace="/">
+ <ww:param name="groupId" value="%{'${metadata.groupId}'}"/>
+ <ww:param name="artifactId" value="%{'${metadata.artifactId}'}"/>
+ </ww:url>
+ </c:set>
+ / <a href="${url}">${metadata.artifactId}</a>
+ </c:if>
+<c:if test="${!empty(metadata.version)}"> | <strong>Version:</strong>
+ <c:set var="url">
+ <ww:url action="showArtifact" namespace="/">
+ <ww:param name="groupId" value="%{'${metadata.groupId}'}"/>
+ <ww:param name="artifactId" value="%{'${metadata.artifactId}'}"/>
+ <ww:param name="version" value="%{'${metadata.version}'}"/>
+ </ww:url>
+ </c:set>
+ <a href="${url}">${metadata.version}</a>
+</c:if>
+ </span>
+ </p>
+ <%-- TODO!
+ <td>
+ <a href="#">Repair</a>
+ </td>
+ --%>
+ </c:forEach>
+ <c:if test="${fn:length(database.reporting.metadata) gt 3}">
+ <p>
+ <b>... more ...</b>
+ </p>
+ </c:if>
+</c:if>
+</c:forEach>
+</div>
+
+</body>
+</html>
diff --git a/archiva-webapp/src/main/webapp/css/maven-theme.css b/archiva-webapp/src/main/webapp/css/maven-theme.css
index b52a561b0..8f1d8fc4b 100644
--- a/archiva-webapp/src/main/webapp/css/maven-theme.css
+++ b/archiva-webapp/src/main/webapp/css/maven-theme.css
@@ -31,6 +31,7 @@ th {
text-align: right;
padding-right: 1em;
font-size: x-small;
+ vertical-align: top;
}
.infoTable th {
diff --git a/archiva-webapp/src/main/webapp/css/site.css b/archiva-webapp/src/main/webapp/css/site.css
index dff21cc7b..bb03df783 100644
--- a/archiva-webapp/src/main/webapp/css/site.css
+++ b/archiva-webapp/src/main/webapp/css/site.css
@@ -96,3 +96,11 @@
.actionMessage {
font-weight: bold;
}
+
+.errorBullet {
+ list-style-image: url( "../images/icon_error_sml.gif" );
+}
+
+.warningBullet {
+ list-style-image: url( "../images/icon_warning_sml.gif" );
+}