From 707cdb193ac7423404bf18b8bd86b814a1129724 Mon Sep 17 00:00:00 2001
From: Olivier Lamy
Date: Thu, 5 Jul 2012 20:43:37 +0000
Subject: [PATCH] [MRM-1583] ui rewrite: rewrite reports page Submitted by
Adrien Lecharpentier.
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1357889 13f79535-47bb-0310-9956-ffa450edef68
---
.../archiva-rest/archiva-rest-api/pom.xml | 5 +
.../resources/META-INF/spring-context.xml | 1 +
.../apache/archiva/i18n/default.properties | 31 ++-
.../main/webapp/js/archiva/general-admin.js | 243 +++++++++++++++++-
.../js/templates/archiva/general-admin.html | 174 ++++++++++++-
.../webapp/js/templates/archiva/menu.html | 4 +
.../DefaultRepositoryStatisticsManager.java | 1 +
.../stats/RepositoryStatistics.java | 24 +-
8 files changed, 478 insertions(+), 5 deletions(-)
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/pom.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/pom.xml
index 0277de251..1dcae612c 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/pom.xml
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/pom.xml
@@ -55,6 +55,11 @@
archiva-repository-scanner
+
+ org.apache.archiva
+ repository-statistics
+
+
org.apache.archiva.redback
redback-authorization-api
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/resources/META-INF/spring-context.xml
index a497537a1..b99001048 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/resources/META-INF/spring-context.xml
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/resources/META-INF/spring-context.xml
@@ -69,6 +69,7 @@
+
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties
index 9e4417445..7ba34a498 100644
--- a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties
+++ b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties
@@ -141,6 +141,7 @@ menu.repository-scanning=Repository Scanning
menu.system-status=System Status
menu.appearance-configuration=Appearance
menu.ui-configuration=UI Configuration
+menu.reports=Reports
#user
user.change.password.required=Change password required
@@ -416,4 +417,32 @@ fileupload.save=Save Files
fileupload.upload.required=You must upload your files first.
fileupload.artifacts.saved=Artifacts uploaded and saved on Server side.
-
+#reports
+report.title = Reports
+report.statistics.title = Repository statistics
+report.statistics.selected-repositories.label = Selected repositories
+repository.groups.available-repositories.label = Available repositories
+report.statistics.row-count.label = Row count
+report.statistics.start-date.label = Start date
+report.statistics.end-date.label = End date
+report.statistics.btn-view = View Statistics
+report.statistics.endDate.explanations-title=Info
+report.statistics.rowCount.explanations-title=Info
+report.statistics.rowCount.explanations=set the number of report you want to read. If you have selected two or more \
+ repositories, only the latest report of those repositories will be displayed.
+report.statistics.repositories.required=You must select at least one repository
+report.health.title = Repository Health
+report.select.all-repositories = All repositories
+report.health.groupId.label = GroupId
+report.health.repositoryId.label = RepositoryId
+report.health.btn-view = Show Report
+report.repository.illegal-access = You have no access to the repository {0}
+report.message.no-report=There is no report available.
+report.health.result.id=ID
+report.health.result.namespace=Namespace
+report.health.result.project=Project
+report.health.result.version=Version
+report.health.result.name=Name
+report.health.result.problem=Problem
+report.health.result.message=Message
+report.result.title=Result
diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js
index 055f7195b..40b2fe63e 100644
--- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js
+++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js
@@ -17,7 +17,7 @@
* under the License.
*/
define("archiva.general-admin",["jquery","i18n","order!utils","order!jquery.tmpl","order!knockout","order!knockout.simpleGrid",
- "jquery.validate","bootstrap"]
+ "knockout.sortable","jquery.validate","bootstrap"]
, function() {
//-------------------------
@@ -875,4 +875,245 @@ define("archiva.general-admin",["jquery","i18n","order!utils","order!jquery.tmpl
});
}
+ //---------------------------
+ // report configuration page
+ //---------------------------
+ StatisticsReportRequest=function() {
+ this.repositories = ko.observableArray( [] );
+ this.rowCount = ko.observable(100);
+ this.startDate = ko.observable();
+ this.endDate = ko.observable();
+ }
+
+ reportStatisticsFormValidator=function(){
+ var validate = $("#report-statistics-form-id").validate({
+ rules: {
+ rowCountStatistics: {
+ required:true,
+ number: true,
+ min: 10
+ },
+ startDate: {
+ date: true
+ },
+ endDate: {
+ date: true
+ }
+ },
+ showErrors: function(validator, errorMap, errorList) {
+ customShowError("#report-statistics-form-id", validator, errorMap, errorMap);
+ }
+ })
+ }
+ ReportStatisticsViewModel=function(repositoriesAvailable){
+ reportStatisticsFormValidator();
+
+ var self=this;
+ this.availableRepositories = ko.observableArray( repositoriesAvailable );
+ this.statisticsReport = ko.observable( new StatisticsReportRequest() );
+
+ $("#startDate" ).datepicker();
+ $("#endDate" ).datepicker();
+ $("#rowCount-info-button" ).popover();
+
+ this.showStatistics=function() {
+ if (!$("#report-statistics-form-id").valid()) {
+ return;
+ }
+ if(this.statisticsReport().repositories().length==0){
+ displayErrorMessage( $.i18n.prop('report.statistics.repositories.required'), "repositoriesErrorMessage" );
+ return;
+ }
+ clearUserMessages( "repositoriesErrorMessage" );
+ var resultTabContent = $("#report-result");
+
+ url = "restServices/archivaServices/reportServices/getStatisticsReport/?rowCount="
+ + this.statisticsReport().rowCount();
+
+ for(var i=0;i
${$.i18n.prop('apperance-configuration.details-description')}
-
+