From: James Moger Date: Wed, 12 Jun 2013 21:23:41 +0000 (-0400) Subject: Add stats header to the dashboard activity feed X-Git-Tag: v1.3.0~81 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=255d3a3cf953736f172c25e9898f3518294aa05c;p=gitblit.git Add stats header to the dashboard activity feed --- diff --git a/src/main/java/com/gitblit/wicket/pages/DashboardPage.html b/src/main/java/com/gitblit/wicket/pages/DashboardPage.html index 544f79cf..1da7ef41 100644 --- a/src/main/java/com/gitblit/wicket/pages/DashboardPage.html +++ b/src/main/java/com/gitblit/wicket/pages/DashboardPage.html @@ -11,6 +11,7 @@
+
diff --git a/src/main/java/com/gitblit/wicket/pages/DashboardPage.java b/src/main/java/com/gitblit/wicket/pages/DashboardPage.java index 5d838391..284c9a51 100644 --- a/src/main/java/com/gitblit/wicket/pages/DashboardPage.java +++ b/src/main/java/com/gitblit/wicket/pages/DashboardPage.java @@ -201,8 +201,9 @@ public class DashboardPage extends RootPage { } } - GoogleCharts charts = createCharts(pushes, authorExclusions); - add(new HeaderContributor(charts)); + addCharts(pushes, authorExclusions, daysBack); + } else { + add(new Label("feedheader").setVisible(false)); } // active repository list @@ -371,14 +372,16 @@ public class DashboardPage extends RootPage { * and the active authors pie chart * * @param recentPushes - * @return + * @param authorExclusions + * @param daysBack */ - private GoogleCharts createCharts(List recentPushes, Set authorExclusions) { + private void addCharts(List recentPushes, Set authorExclusions, int daysBack) { // activity metrics Map repositoryMetrics = new HashMap(); Map authorMetrics = new HashMap(); // aggregate repository and author metrics + int totalCommits = 0; for (PushLogEntry push : recentPushes) { // aggregate repository metrics @@ -389,6 +392,7 @@ public class DashboardPage extends RootPage { repositoryMetrics.get(repository).count += 1; for (RepositoryCommit commit : push.getCommits()) { + totalCommits++; String author = StringUtils.removeNewlines(commit.getAuthorIdent().getName()); String authorName = author.toLowerCase(); String authorEmail = StringUtils.removeNewlines(commit.getAuthorIdent().getEmailAddress()).toLowerCase(); @@ -400,6 +404,9 @@ public class DashboardPage extends RootPage { } } } + + add(new Label("feedheader", MessageFormat.format(getString("gb.recentActivityStats"), + daysBack, totalCommits, authorMetrics.size()))); // build google charts GoogleCharts charts = new GoogleCharts(); @@ -422,7 +429,7 @@ public class DashboardPage extends RootPage { chart.setShowLegend(false); charts.addChart(chart); - return charts; + add(new HeaderContributor(charts)); } class RepoListItem implements Serializable {