]> source.dussan.org Git - gitblit.git/commitdiff
Disable *most* activity graphs when web.generateActivityGraph=false
authorJames Moger <james.moger@gitblit.com>
Thu, 19 Sep 2013 12:36:25 +0000 (08:36 -0400)
committerJames Moger <james.moger@gitblit.com>
Thu, 19 Sep 2013 12:36:25 +0000 (08:36 -0400)
This setting originally only worked for the Summary page, but since that
page was written, other pages have offered graphing.  This setting will
now disable Google Chart requests on the Dashboard, Activity, and
Summary pages.

This is related to issue-310.

src/main/distrib/data/gitblit.properties
src/main/java/com/gitblit/wicket/pages/ActivityPage.html
src/main/java/com/gitblit/wicket/pages/ActivityPage.java
src/main/java/com/gitblit/wicket/pages/DashboardPage.java

index 2318447c9ce6e40ec22381a96525df7f5931ff84..ab7b99924e06bf44bda1af548432a15c72ee5e03 100644 (file)
@@ -897,8 +897,8 @@ web.showEmailAddresses = true
 # SINCE 0.5.0\r
 web.showSearchTypeSelection = false\r
 \r
-# Generates a line graph of repository activity over time on the Summary page.\r
-# This uses the Google Charts API.\r
+# Controls display of activity graphs on the dashboard, activity, and summary\r
+# pages.  Charting makes use of the external Google Charts API.\r
 #\r
 # SINCE 0.5.0 \r
 web.generateActivityGraph = true\r
index 87e599f611b4e03f3295bbdd19989683ca4146a6..4c76b396060da9c3a030e381f7bdf89352500450 100644 (file)
@@ -9,6 +9,11 @@
        <div class="dashboardTitle">\r
                <wicket:message key="gb.recentActivity"></wicket:message> <small><span class="hidden-phone"><span wicket:id="subheader">[days back]</span></span></small>\r
        </div>\r
+       <div wicket:id="chartsPanel"></div>\r
+       <div wicket:id="activityPanel" style="padding-top:5px;" >[activity panel]</div>\r
+       </div>\r
+       \r
+<wicket:fragment wicket:id="chartsFragment">\r
        <div class="hidden-phone" style="text-align: center;">\r
                <table>\r
                <tr>\r
@@ -18,8 +23,7 @@
                </tr>\r
                </table>\r
        </div>\r
-       <div wicket:id="activityPanel" style="padding-top:5px;" >[activity panel]</div>\r
-       </div>\r
+</wicket:fragment>     \r
 </wicket:extend>\r
 </body>\r
 </html>
\ No newline at end of file
index 413403b4e1a018ecb93489953907fcb49cdc9814..a436813e24f23f222712f6c7f376e08004a2129d 100644 (file)
@@ -27,6 +27,7 @@ import java.util.Set;
 import org.apache.wicket.PageParameters;\r
 import org.apache.wicket.behavior.HeaderContributor;\r
 import org.apache.wicket.markup.html.basic.Label;\r
+import org.apache.wicket.markup.html.panel.Fragment;\r
 \r
 import com.gitblit.GitBlit;\r
 import com.gitblit.Keys;\r
@@ -36,8 +37,8 @@ import com.gitblit.models.RepositoryModel;
 import com.gitblit.utils.ActivityUtils;\r
 import com.gitblit.utils.StringUtils;\r
 import com.gitblit.wicket.CacheControl;\r
-import com.gitblit.wicket.PageRegistration;\r
 import com.gitblit.wicket.CacheControl.LastModified;\r
+import com.gitblit.wicket.PageRegistration;\r
 import com.gitblit.wicket.PageRegistration.DropDownMenuItem;\r
 import com.gitblit.wicket.PageRegistration.DropDownMenuRegistration;\r
 import com.gitblit.wicket.WicketUtils;\r
@@ -111,8 +112,13 @@ public class ActivityPage extends RootPage {
                                        daysBack, totalCommits, totalAuthors)));\r
 \r
                        // create the activity charts\r
-                       GoogleCharts charts = createCharts(recentActivity);\r
-                       add(new HeaderContributor(charts));\r
+                       if (GitBlit.getBoolean(Keys.web.generateActivityGraph, true)) {\r
+                               GoogleCharts charts = createCharts(recentActivity);\r
+                               add(new HeaderContributor(charts));\r
+                               add(new Fragment("chartsPanel", "chartsFragment", this));\r
+                       } else {\r
+                               add(new Label("chartsPanel").setVisible(false));\r
+                       }\r
 \r
                        // add activity panel\r
                        add(new ActivityPanel("activityPanel", recentActivity));\r
index 0af46c711266e7eb793bf4174671bdba5ce1c704..18add502d0c80c2508b6dc3993210b28434aa091 100644 (file)
@@ -217,28 +217,32 @@ public abstract class DashboardPage extends RootPage {
                frag.add(new Label("feedheader", MessageFormat.format(headerPattern,\r
                                daysBack, totalCommits, authorMetrics.size())));\r
 \r
-               // build google charts\r
-               GoogleCharts charts = new GoogleCharts();\r
-\r
-               // active repositories pie chart\r
-               GoogleChart chart = new GooglePieChart("chartRepositories", getString("gb.activeRepositories"),\r
-                               getString("gb.repository"), getString("gb.commits"));\r
-               for (Metric metric : repositoryMetrics.values()) {\r
-                       chart.addValue(metric.name, metric.count);\r
-               }\r
-               chart.setShowLegend(false);\r
-               charts.addChart(chart);\r
-\r
-               // active authors pie chart\r
-               chart = new GooglePieChart("chartAuthors", getString("gb.activeAuthors"),\r
-                               getString("gb.author"), getString("gb.commits"));\r
-               for (Metric metric : authorMetrics.values()) {\r
-                       chart.addValue(metric.name, metric.count);\r
-               }\r
-               chart.setShowLegend(false);\r
-               charts.addChart(chart);\r
+               if (GitBlit.getBoolean(Keys.web.generateActivityGraph, true)) {\r
+                       // build google charts\r
+                       GoogleCharts charts = new GoogleCharts();\r
+\r
+                       // active repositories pie chart\r
+                       GoogleChart chart = new GooglePieChart("chartRepositories", getString("gb.activeRepositories"),\r
+                                       getString("gb.repository"), getString("gb.commits"));\r
+                       for (Metric metric : repositoryMetrics.values()) {\r
+                               chart.addValue(metric.name, metric.count);\r
+                       }\r
+                       chart.setShowLegend(false);\r
+                       charts.addChart(chart);\r
+\r
+                       // active authors pie chart\r
+                       chart = new GooglePieChart("chartAuthors", getString("gb.activeAuthors"),\r
+                                       getString("gb.author"), getString("gb.commits"));\r
+                       for (Metric metric : authorMetrics.values()) {\r
+                               chart.addValue(metric.name, metric.count);\r
+                       }\r
+                       chart.setShowLegend(false);\r
+                       charts.addChart(chart);\r
 \r
-               add(new HeaderContributor(charts));             \r
-               frag.add(new Fragment("charts", "chartsFragment", this));\r
+                       add(new HeaderContributor(charts));             \r
+                       frag.add(new Fragment("charts", "chartsFragment", this));\r
+               } else {\r
+                       frag.add(new Label("charts").setVisible(false));\r
+               }\r
        }\r
 }\r