Skip to content

Loading…

Don't show broken image when no test results are available #7

Merged
merged 1 commit into from

2 participants

@cpfeiffer

When a new Jenkins job is set up (or when otherwise no test results are available), the project page will show a broken image coming from the trend report.

@swestcott swestcott merged commit 70e9bb1 into swestcott:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
View
10 src/main/java/hudson/plugins/fitnesse/FitnesseProjectAction.java
@@ -36,8 +36,18 @@ public String getUrlName() {
/**
* Used in floatingBox.jelly
*/
+ public boolean hasTrend() {
+ return getLatestResults() != null;
+ }
+
+ /**
+ * Used in floatingBox.jelly
+ */
public History getTrend() {
FitnesseResultsAction latestResults = getLatestResults();
+ if (latestResults == null) {
+ return null;
+ }
FitnesseResults result = latestResults.getResult();
return new History(result,500,200);
}
View
3 src/main/resources/hudson/plugins/fitnesse/FitnesseProjectAction/floatingBox.jelly
@@ -1,10 +1,13 @@
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler"
xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson"
xmlns:f="/lib/form" xmlns:i="jelly:fmt">
+
+ <j:if test="${action.hasTrend()}">
<div class="test-trend-caption">
${%FitNesse Results Trend}
</div>
<div>
<img src="fitnesse/trend/countGraph/png" lazymap="fitnesse/trend/countGraph/map" alt="[FitNesse results trend chart]"/>
</div>
+ </j:if>
</j:jelly>
Something went wrong with that request. Please try again.