Reputation: 348
I am facing the following issue: I am using the Plot Plugin for Jenkins/Hudson in order to display some chars, based on each build, and this work just fine... however I would like to show more data on point click, which should be supported in the Plot Plugin.
I am using the "Load data from xml file using xpath" option, Nodeset and as URL:
http://host:8080/abc/%name%/%index%/def
The help popup states the following:
Optional. If set, this url is used when you click on a point. This is used as the base url for every point, %name% and %index% will be replaced in the url with the column name and index.
However, when I click on the points in the generated plot, %name% and %index% are not replaced with indices, so the URL is of course not what I expect...
Any ideas how to get the indices properly placed in the placeholders?
Upvotes: 3
Views: 1725
Reputation: 10968
This is now fixed in the Plot Plugin version 1.8.
This is the corrected code:
private String getUrl(String label, int index)
{
// code below was updating this.url, which is the original url provided
// by the user
String url = this.url;
Matcher nameMatcher = PAT_NAME.matcher(url);
if (nameMatcher.find())
{
// replace with label if "%name%" pattern was found
url = nameMatcher.replaceAll(label);
}
Matcher indexMatcher = PAT_INDEX.matcher(url);
if (indexMatcher.find())
{
// replace with index if "%index%" pattern was found
url = indexMatcher.replaceAll(String.valueOf(index));
}
return url;
}
Upvotes: 2
Reputation: 23757
I don't believe that this works in the plugin as it currently exists. The code on Github for the pattern replacement is (for CSV files):
/**
* Return the url that should be used for this point.
* @param label Name of the column
* @param index Index of the column
* @return url for the label.
*/
private String getUrl(String label,int index)
{
/*
* Check the name first, and do replacement upon it.
*/
Matcher nameMatcher = PAT_NAME.matcher(label);
if (nameMatcher.find())
{
url = nameMatcher.replaceAll(label);
}
/*
* Check the index, and do replacement on it.
*/
Matcher indexMatcher = PAT_INDEX.matcher(label);
if (indexMatcher.find())
{
url = indexMatcher.replaceAll(label);
}
return url;
}
label
is the CSV column header, so this code is trying to replace %name%
and %index%
in the column header... with the column header itself.
I've created a pull request to get this fixed.
Upvotes: 1