]> source.dussan.org Git - gitblit.git/commitdiff
Add stats header to the dashboard activity feed
authorJames Moger <james.moger@gitblit.com>
Wed, 12 Jun 2013 21:23:41 +0000 (17:23 -0400)
committerJames Moger <james.moger@gitblit.com>
Wed, 12 Jun 2013 21:23:41 +0000 (17:23 -0400)
src/main/java/com/gitblit/wicket/pages/DashboardPage.html
src/main/java/com/gitblit/wicket/pages/DashboardPage.java

index 544f79cfc5e77f4bcec5b909276a83422655a11c..1da7ef418c0af212d5a85f0fcb1a926f2873c345 100644 (file)
@@ -11,6 +11,7 @@
        \r
        <div class="row">\r
                <div class="span7">\r
+                       <div style="color:#888;font-size:1.75em;padding-bottom:5px;" wicket:id="feedheader"></div>\r
                        <div class="hidden-phone hidden-tablet"  style="text-align:center;">\r
                                <table>\r
                                        <tr>\r
index 5d838391b11e68d582187d403fb9253e0c68f6b7..284c9a51e65768eb1d3b266b1f27313ee42d2872 100644 (file)
@@ -201,8 +201,9 @@ public class DashboardPage extends RootPage {
                                }\r
                        }\r
 \r
-                       GoogleCharts charts = createCharts(pushes, authorExclusions);\r
-                       add(new HeaderContributor(charts));\r
+                       addCharts(pushes, authorExclusions, daysBack);\r
+               } else {\r
+                       add(new Label("feedheader").setVisible(false));\r
                }\r
                \r
                // active repository list\r
@@ -371,14 +372,16 @@ public class DashboardPage extends RootPage {
         * and the active authors pie chart\r
         * \r
         * @param recentPushes\r
-        * @return\r
+        * @param authorExclusions\r
+        * @param daysBack\r
         */\r
-       private GoogleCharts createCharts(List<PushLogEntry> recentPushes, Set<String> authorExclusions) {\r
+       private void addCharts(List<PushLogEntry> recentPushes, Set<String> authorExclusions, int daysBack) {\r
                // activity metrics\r
                Map<String, Metric> repositoryMetrics = new HashMap<String, Metric>();\r
                Map<String, Metric> authorMetrics = new HashMap<String, Metric>();\r
 \r
                // aggregate repository and author metrics\r
+               int totalCommits = 0;\r
                for (PushLogEntry push : recentPushes) {\r
 \r
                        // aggregate repository metrics\r
@@ -389,6 +392,7 @@ public class DashboardPage extends RootPage {
                        repositoryMetrics.get(repository).count += 1;\r
                        \r
                        for (RepositoryCommit commit : push.getCommits()) {\r
+                               totalCommits++;\r
                                String author = StringUtils.removeNewlines(commit.getAuthorIdent().getName());\r
                                String authorName = author.toLowerCase();\r
                                String authorEmail = StringUtils.removeNewlines(commit.getAuthorIdent().getEmailAddress()).toLowerCase();\r
@@ -400,6 +404,9 @@ public class DashboardPage extends RootPage {
                                }\r
                        }\r
                }\r
+               \r
+               add(new Label("feedheader", MessageFormat.format(getString("gb.recentActivityStats"),\r
+                               daysBack, totalCommits, authorMetrics.size())));\r
 \r
                // build google charts\r
                GoogleCharts charts = new GoogleCharts();\r
@@ -422,7 +429,7 @@ public class DashboardPage extends RootPage {
                chart.setShowLegend(false);\r
                charts.addChart(chart);\r
 \r
-               return charts;\r
+               add(new HeaderContributor(charts));\r
        }\r
        \r
        class RepoListItem implements Serializable {\r