From 9c7bb3d377a0637ff034be407cb9c03c606647a9 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Sun, 27 Oct 2013 11:05:11 -0400
Subject: [PATCH] Add setting to automatically redirect http requests to the https port
---
src/main/java/com/gitblit/wicket/pages/DashboardPage.java | 60 ++++++++++++++++++++++++++++++++----------------------------
1 files changed, 32 insertions(+), 28 deletions(-)
diff --git a/src/main/java/com/gitblit/wicket/pages/DashboardPage.java b/src/main/java/com/gitblit/wicket/pages/DashboardPage.java
index 0af46c7..5c72b8b 100644
--- a/src/main/java/com/gitblit/wicket/pages/DashboardPage.java
+++ b/src/main/java/com/gitblit/wicket/pages/DashboardPage.java
@@ -75,7 +75,7 @@
c.add(Calendar.DATE, -1*daysBack);
Date minimumDate = c.getTime();
TimeZone timezone = getTimeZone();
-
+
// create daily commit digest feed
List<DailyLogEntry> digests = new ArrayList<DailyLogEntry>();
for (RepositoryModel model : repositories) {
@@ -89,7 +89,7 @@
repository.close();
}
}
-
+
Fragment activityFragment = new Fragment("activity", "activityFragment", this);
add(activityFragment);
activityFragment.add(new Label("feedTitle", feedTitle));
@@ -118,7 +118,7 @@
DigestsPanel digestsPanel = new DigestsPanel("digests", digests);
activityFragment.add(digestsPanel);
}
-
+
// add the nifty charts
if (!ArrayUtils.isEmpty(digests)) {
// aggregate author exclusions
@@ -140,7 +140,7 @@
activityFragment.add(new Label("feedheader").setVisible(false));
}
}
-
+
@Override
protected void addDropDownMenus(List<PageRegistration> pages) {
PageParameters params = getPageParameters();
@@ -163,7 +163,7 @@
/**
* Creates the daily activity line chart, the active repositories pie chart,
* and the active authors pie chart
- *
+ *
* @param recentChanges
* @param authorExclusions
* @param daysBack
@@ -183,7 +183,7 @@
repositoryMetrics.put(repository, new Metric(repository));
}
repositoryMetrics.get(repository).count += 1;
-
+
for (RepositoryCommit commit : change.getCommits()) {
totalCommits++;
String author = StringUtils.removeNewlines(commit.getAuthorIdent().getName());
@@ -197,7 +197,7 @@
}
}
}
-
+
String headerPattern;
if (daysBack == 1) {
// today
@@ -217,28 +217,32 @@
frag.add(new Label("feedheader", MessageFormat.format(headerPattern,
daysBack, totalCommits, authorMetrics.size())));
- // build google charts
- GoogleCharts charts = new GoogleCharts();
+ if (GitBlit.getBoolean(Keys.web.generateActivityGraph, true)) {
+ // build google charts
+ GoogleCharts charts = new GoogleCharts();
- // active repositories pie chart
- GoogleChart chart = new GooglePieChart("chartRepositories", getString("gb.activeRepositories"),
- getString("gb.repository"), getString("gb.commits"));
- for (Metric metric : repositoryMetrics.values()) {
- chart.addValue(metric.name, metric.count);
+ // active repositories pie chart
+ GoogleChart chart = new GooglePieChart("chartRepositories", getString("gb.activeRepositories"),
+ getString("gb.repository"), getString("gb.commits"));
+ for (Metric metric : repositoryMetrics.values()) {
+ chart.addValue(metric.name, metric.count);
+ }
+ chart.setShowLegend(false);
+ charts.addChart(chart);
+
+ // active authors pie chart
+ chart = new GooglePieChart("chartAuthors", getString("gb.activeAuthors"),
+ getString("gb.author"), getString("gb.commits"));
+ for (Metric metric : authorMetrics.values()) {
+ chart.addValue(metric.name, metric.count);
+ }
+ chart.setShowLegend(false);
+ charts.addChart(chart);
+
+ add(new HeaderContributor(charts));
+ frag.add(new Fragment("charts", "chartsFragment", this));
+ } else {
+ frag.add(new Label("charts").setVisible(false));
}
- chart.setShowLegend(false);
- charts.addChart(chart);
-
- // active authors pie chart
- chart = new GooglePieChart("chartAuthors", getString("gb.activeAuthors"),
- getString("gb.author"), getString("gb.commits"));
- for (Metric metric : authorMetrics.values()) {
- chart.addValue(metric.name, metric.count);
- }
- chart.setShowLegend(false);
- charts.addChart(chart);
-
- add(new HeaderContributor(charts));
- frag.add(new Fragment("charts", "chartsFragment", this));
}
}
--
Gitblit v1.9.1