Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
[FIXED JENKINS-29900] Use prefix "../../" for URLs in detail trend gr…
…aph view.
  • Loading branch information
uhafner committed Sep 4, 2015
1 parent bfcc332 commit 77df032dc5870e09a75768d77ae0f552e6d5aef4
@@ -15,7 +15,6 @@

import com.google.common.collect.Lists;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import jenkins.model.Jenkins;

import hudson.model.AbstractBuild;
@@ -182,7 +181,7 @@ public Object getTrendDetails() {
* @return the details
*/
public Object getTrendDetails(final StaplerRequest request, final StaplerResponse response) {
return new TrendDetails(getProject(), getTrendGraph(request, response));
return new TrendDetails(getProject(), getTrendGraph(request, response, "../../"));
}

/**
@@ -204,8 +203,13 @@ public Object getTrendGraph() {
* @return the trend graph
*/
public Graph getTrendGraph(final StaplerRequest request, final StaplerResponse response) {
return getTrendGraph(request, response, "");
}

private Graph getTrendGraph(final StaplerRequest request, final StaplerResponse response, final String urlPrefix) {
GraphConfigurationView configuration = createUserConfiguration(request);
if (configuration.hasMeaningfulGraph()) {
configuration.setUrlPrefix(urlPrefix);
return configuration.getGraphRenderer(getUrlName());
}
else {
@@ -85,9 +85,7 @@ public boolean isVisible() {
* Sets the root URL to the specified value.
*
* @param rootUrl the value to set
* @deprecated as of 1.69 relative links are created
*/
@Deprecated
public void setRootUrl(final String rootUrl) {
this.rootUrl = rootUrl;
}
@@ -8,7 +8,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;

@@ -35,6 +35,7 @@ public abstract class GraphConfigurationView implements ModelObject {
private final BuildHistory buildHistory;
private final AbstractHealthDescriptor healthDescriptor; // NOPMD
private final GraphConfiguration configuration;
private String urlPrefix;

/**
* Creates a new instance of {@link GraphConfigurationView}.
@@ -349,7 +350,9 @@ public String getParameterValue() {
* @return the type
*/
public BuildResultGraph getGraphType() {
return configuration.getGraphType();
BuildResultGraph graphType = configuration.getGraphType();
graphType.setRootUrl(StringUtils.defaultString(urlPrefix));
return graphType;
}

/**
@@ -383,4 +386,15 @@ public String toString() {
public AbstractHealthDescriptor getHealthDescriptor() {
return healthDescriptor;
}

/**
* Sets the prefix of the URLs in the trend graph. Depending on the sub page this trend is shown a different
* prefix can be set for the relative URL.
*
* @param urlPrefix prefix, might be empty
* @since 1.73
*/
public void setUrlPrefix(final String urlPrefix) {
this.urlPrefix = urlPrefix;
}
}

0 comments on commit 77df032

Please sign in to comment.