From bd7db1070e07cf1777a0c0ee6e770625f8734fb6 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Tue, 15 Apr 2014 09:53:10 -0400
Subject: [PATCH] Merge pr-170 'ticket-fix' from https://github.com/lucidd/gitblit
---
src/main/java/com/gitblit/wicket/WicketUtils.java | 67 +++++----------------------------
1 files changed, 11 insertions(+), 56 deletions(-)
diff --git a/src/main/java/com/gitblit/wicket/WicketUtils.java b/src/main/java/com/gitblit/wicket/WicketUtils.java
index 8e119da..8598447 100644
--- a/src/main/java/com/gitblit/wicket/WicketUtils.java
+++ b/src/main/java/com/gitblit/wicket/WicketUtils.java
@@ -38,8 +38,6 @@
import org.apache.wicket.protocol.http.WebRequest;
import org.apache.wicket.resource.ContextRelativeResource;
import org.eclipse.jgit.diff.DiffEntry.ChangeType;
-import org.wicketstuff.googlecharts.AbstractChartData;
-import org.wicketstuff.googlecharts.IChartData;
import com.gitblit.Constants;
import com.gitblit.Constants.AccessPermission;
@@ -435,6 +433,16 @@
return new PageParameters(parameterMap);
}
+ public static PageParameters newBlameTypeParameter(String repositoryName,
+ String commitId, String path, String blameType) {
+ Map<String, String> parameterMap = new HashMap<String, String>();
+ parameterMap.put("r", repositoryName);
+ parameterMap.put("h", commitId);
+ parameterMap.put("f", path);
+ parameterMap.put("blametype", blameType);
+ return new PageParameters(parameterMap);
+ }
+
public static String getProjectName(PageParameters params) {
return params.getString("p", "");
}
@@ -526,7 +534,7 @@
// past
title = timeUtils.timeAgo(date);
}
- if ((System.currentTimeMillis() - date.getTime()) < 10 * 24 * 60 * 60 * 1000L) {
+ if (title != null && (System.currentTimeMillis() - date.getTime()) < 10 * 24 * 60 * 60 * 1000L) {
String tmp = dateString;
dateString = title;
title = tmp;
@@ -622,32 +630,6 @@
return label;
}
- public static IChartData getChartData(Collection<Metric> metrics) {
- final double[] commits = new double[metrics.size()];
- final double[] tags = new double[metrics.size()];
- int i = 0;
- double max = 0;
- for (Metric m : metrics) {
- commits[i] = m.count;
- if (m.tag > 0) {
- tags[i] = m.count;
- } else {
- tags[i] = -1d;
- }
- max = Math.max(max, m.count);
- i++;
- }
- IChartData data = new AbstractChartData(max) {
- private static final long serialVersionUID = 1L;
-
- @Override
- public double[][] getData() {
- return new double[][] { commits, tags };
- }
- };
- return data;
- }
-
public static double maxValue(Collection<Metric> metrics) {
double max = Double.MIN_VALUE;
for (Metric m : metrics) {
@@ -657,31 +639,4 @@
}
return max;
}
-
- public static IChartData getScatterData(Collection<Metric> metrics) {
- final double[] y = new double[metrics.size()];
- final double[] x = new double[metrics.size()];
- int i = 0;
- double max = 0;
- for (Metric m : metrics) {
- y[i] = m.count;
- if (m.duration > 0) {
- x[i] = m.duration;
- } else {
- x[i] = -1d;
- }
- max = Math.max(max, m.count);
- i++;
- }
- IChartData data = new AbstractChartData(max) {
- private static final long serialVersionUID = 1L;
-
- @Override
- public double[][] getData() {
- return new double[][] { x, y };
- }
- };
- return data;
- }
-
}
--
Gitblit v1.9.1