Skip to content
This repository has been archived by the owner on Apr 6, 2022. It is now read-only.

Commit

Permalink
[JENKINS-22295] Added fake URL so that graph detail view uses selecte…
Browse files Browse the repository at this point in the history
…d graph type.
  • Loading branch information
uhafner committed May 9, 2016
1 parent ed66289 commit ea79d2b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
Expand Up @@ -181,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, "../../"), getTrendGraphId());
}

/**
Expand Down
17 changes: 15 additions & 2 deletions src/main/java/hudson/plugins/analysis/graph/TrendDetails.java
Expand Up @@ -3,7 +3,6 @@
import org.kohsuke.stapler.StaplerRequest;

import hudson.model.AbstractProject;

import hudson.util.Graph;

/**
Expand All @@ -14,6 +13,7 @@
public class TrendDetails {
/** The graph to display. */
private final Graph trendGraph;
private final String id;
/** The project of the graph. */
private final AbstractProject<?, ?> project;

Expand All @@ -24,10 +24,14 @@ public class TrendDetails {
* the project of the graph
* @param trendGraph
* the graph
* @param id
* the ID of the trend graph
*/
public TrendDetails(final AbstractProject<?, ?> project, final Graph trendGraph) {
public TrendDetails(final AbstractProject<?, ?> project, final Graph trendGraph,
final String id) {
this.project = project;
this.trendGraph = trendGraph;
this.id = id;
}

/**
Expand All @@ -41,6 +45,15 @@ public Graph getTrendGraph(final StaplerRequest request) {
return trendGraph;
}

/**
* Returns the ID of the selected trend graph.
*
* @return ID of the selected trend graph
*/
public String getTrendGraphId() {
return id;
}

/**
* Returns the abstractProject.
*
Expand Down
Expand Up @@ -5,7 +5,9 @@
<l:layout norefresh="true">
<st:include it="${it.project}" page="sidepanel.jelly" />
<l:main-panel>
<img src="trendGraph/png?width=800&amp;height=600" lazymap="trendGraph/map?width=800&amp;height=600"/>
<!-- Note that the parameter url=${trendGraphId} is not used by the graph: it
has been added to provide different URLs so that the images are not cached by the browser. -->
<img src="trendGraph/png?width=800&amp;height=600&amp;url=${it.trendGraphId}" lazymap="trendGraph/map?width=800&amp;height=600&amp;url=${it.trendGraphId}"/>
</l:main-panel>
</l:layout>
</j:jelly>

0 comments on commit ea79d2b

Please sign in to comment.