summaryrefslogtreecommitdiffstats
path: root/src/com/gitblit/wicket
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/gitblit/wicket')
-rw-r--r--src/com/gitblit/wicket/GitBlitWebApp.properties3
-rw-r--r--src/com/gitblit/wicket/models/Metric.java2
-rw-r--r--src/com/gitblit/wicket/pages/SummaryPage.html13
-rw-r--r--src/com/gitblit/wicket/pages/SummaryPage.java46
4 files changed, 42 insertions, 22 deletions
diff --git a/src/com/gitblit/wicket/GitBlitWebApp.properties b/src/com/gitblit/wicket/GitBlitWebApp.properties
index b8d31ae5..f0638586 100644
--- a/src/com/gitblit/wicket/GitBlitWebApp.properties
+++ b/src/com/gitblit/wicket/GitBlitWebApp.properties
@@ -54,4 +54,5 @@ gb.searchForCommitter = Search for commits committed by
gb.addition = addition
gb.modification = modification
gb.deletion = deletion
-gb.rename = rename \ No newline at end of file
+gb.rename = rename
+gb.stats = stats \ No newline at end of file
diff --git a/src/com/gitblit/wicket/models/Metric.java b/src/com/gitblit/wicket/models/Metric.java
index a5efb139..194e2659 100644
--- a/src/com/gitblit/wicket/models/Metric.java
+++ b/src/com/gitblit/wicket/models/Metric.java
@@ -8,6 +8,8 @@ public class Metric implements Serializable {
public String name;
public double count;
+ public double tag;
+ public int duration;
public Metric(String name) {
this.name = name;
diff --git a/src/com/gitblit/wicket/pages/SummaryPage.html b/src/com/gitblit/wicket/pages/SummaryPage.html
index 47c10b31..6abef548 100644
--- a/src/com/gitblit/wicket/pages/SummaryPage.html
+++ b/src/com/gitblit/wicket/pages/SummaryPage.html
@@ -12,17 +12,18 @@
<div style="clear:both;">
<!-- Repository Activity Chart -->
- <div style="width:400px;float:right;">
+ <div style="float:right;">
<img class="activityGraph" wicket:id="commitsChart" />
</div>
<!-- Repository info -->
- <div style="margin-right:410px;">
+ <div>
<table class="plain">
- <tr><th><wicket:message key="gb.description">description</wicket:message></th><td><span wicket:id="repositoryDescription">[repository description]</span></td></tr>
- <tr><th><wicket:message key="gb.owner">owner</wicket:message></th><td><span wicket:id="repositoryOwner">[repository owner]</span></td></tr>
- <tr><th><wicket:message key="gb.lastChange">last change</wicket:message></th><td><span wicket:id="repositoryLastChange">[repository last change]</span></td></tr>
- <tr><th><wicket:message key="gb.url">URL</wicket:message></th><td><span wicket:id="repositoryCloneUrl">[repository clone url]</span></td></tr>
+ <tr><th><wicket:message key="gb.description">[description]</wicket:message></th><td><span wicket:id="repositoryDescription">[repository description]</span></td></tr>
+ <tr><th><wicket:message key="gb.owner">[owner]</wicket:message></th><td><span wicket:id="repositoryOwner">[repository owner]</span></td></tr>
+ <tr><th><wicket:message key="gb.lastChange">[last change]</wicket:message></th><td><span wicket:id="repositoryLastChange">[repository last change]</span></td></tr>
+ <tr><th><wicket:message key="gb.stats">[stats]</wicket:message></th><td><span wicket:id="repositoryStats">[repository stats]</span></td></tr>
+ <tr><th><wicket:message key="gb.url">[URL]</wicket:message></th><td><span wicket:id="repositoryCloneUrl">[repository clone url]</span></td></tr>
</table>
</div>
</div>
diff --git a/src/com/gitblit/wicket/pages/SummaryPage.java b/src/com/gitblit/wicket/pages/SummaryPage.java
index 6d28df6e..53a684b5 100644
--- a/src/com/gitblit/wicket/pages/SummaryPage.java
+++ b/src/com/gitblit/wicket/pages/SummaryPage.java
@@ -1,6 +1,8 @@
package com.gitblit.wicket.pages;
+import java.awt.Color;
import java.awt.Dimension;
+import java.text.MessageFormat;
import java.util.List;
import org.apache.wicket.PageParameters;
@@ -15,9 +17,13 @@ import com.codecommit.wicket.ChartAxisType;
import com.codecommit.wicket.ChartProvider;
import com.codecommit.wicket.ChartType;
import com.codecommit.wicket.IChartData;
+import com.codecommit.wicket.LineStyle;
+import com.codecommit.wicket.MarkerType;
+import com.codecommit.wicket.ShapeMarker;
import com.gitblit.GitBlit;
import com.gitblit.Keys;
import com.gitblit.utils.JGitUtils;
+import com.gitblit.utils.TimeUtils;
import com.gitblit.wicket.RepositoryPage;
import com.gitblit.wicket.WicketUtils;
import com.gitblit.wicket.models.Metric;
@@ -44,11 +50,11 @@ public class SummaryPage extends RepositoryPage {
}
Repository r = getRepository();
- List<Metric> metrics = JGitUtils.getDateMetrics(r);
-
- long numberOfCommits = 0;
- for (Metric m : metrics) {
- numberOfCommits += m.count;
+ List<Metric> metrics = null;
+ Metric metricsTotal = null;
+ if (GitBlit.self().settings().getBoolean(Keys.web.generateActivityGraph, true)) {
+ metrics = JGitUtils.getDateMetrics(r);
+ metricsTotal = metrics.remove(0);
}
// repository description
@@ -56,6 +62,11 @@ public class SummaryPage extends RepositoryPage {
add(new Label("repositoryOwner", JGitUtils.getRepositoryOwner(r)));
add(WicketUtils.createTimestampLabel("repositoryLastChange", JGitUtils.getLastChange(r), getTimeZone()));
+ if (metricsTotal == null) {
+ add(new Label("repositoryStats", ""));
+ } else {
+ add(new Label("repositoryStats", MessageFormat.format("{0} commits and {1} tags in {2}", metricsTotal.count, metricsTotal.tag, TimeUtils.duration(metricsTotal.duration))));
+ }
add(new Label("repositoryCloneUrl", GitBlit.self().getCloneUrl(repositoryName)));
add(new LogPanel("commitsPanel", repositoryName, null, r, numberCommits, 0));
@@ -75,7 +86,7 @@ public class SummaryPage extends RepositoryPage {
if (GitBlit.self().settings().getBoolean(Keys.web.generateActivityGraph, true)) {
IChartData data = getChartData(metrics);
- ChartProvider provider = new ChartProvider(new Dimension(400, 80), ChartType.LINE, data);
+ ChartProvider provider = new ChartProvider(new Dimension(400, 100), ChartType.LINE, data);
ChartAxis dateAxis = new ChartAxis(ChartAxisType.BOTTOM);
dateAxis.setLabels(new String[] { metrics.get(0).name, metrics.get(metrics.size() / 2).name, metrics.get(metrics.size() - 1).name });
provider.addAxis(dateAxis);
@@ -84,6 +95,9 @@ public class SummaryPage extends RepositoryPage {
commitAxis.setLabels(new String[] { "", String.valueOf((int) maxValue(metrics)) });
provider.addAxis(commitAxis);
+ provider.setLineStyles(new LineStyle[] {new LineStyle(2, 4, 0), new LineStyle(0, 4, 1)});
+ provider.addShapeMarker(new ShapeMarker(MarkerType.DIAMOND, Color.BLUE, 1, -1, 5));
+
add(new Chart("commitsChart", provider));
} else {
add(new ContextImage("commitsChart", "blank.png"));
@@ -91,23 +105,25 @@ public class SummaryPage extends RepositoryPage {
}
protected IChartData getChartData(List<Metric> metrics) {
- final double[] counts = new double[metrics.size()];
+ final double[] commits = new double[metrics.size()];
+ final double[] tags = new double[metrics.size()];
int i = 0;
double max = 0;
for (Metric m : metrics) {
- counts[i++] = m.count;
+ commits[i] = m.count;
+ if (m.tag > 0) {
+ tags[i] = m.count;
+ } else {
+ tags[i] = -1d;
+ }
max = Math.max(max, m.count);
+ i++;
}
- final double dmax = max;
- IChartData data = new AbstractChartData() {
+ IChartData data = new AbstractChartData(max) {
private static final long serialVersionUID = 1L;
public double[][] getData() {
- return new double[][] { counts };
- }
-
- public double getMax() {
- return dmax;
+ return new double[][] { commits, tags };
}
};
return data;