Skip to content
Permalink
Browse files
[JENKINS-24021] Show statistics from last build on main job page
  • Loading branch information
mixalturek committed Jul 29, 2014
1 parent a8b8e25 commit f73ff44d85c2c2ee3aab0baffe8ebde9a9d4b33b
Showing 9 changed files with 83 additions and 50 deletions.
@@ -3,3 +3,6 @@
.settings/
target/
work/
.idea
*.iml
Makefile
@@ -31,7 +31,7 @@ public String getIconFileName() {
}

public String getDisplayName() {
return "SLOCCount";
return Messages.Sloccount_SloccountResults();
}

public String getUrlName() {
@@ -101,7 +101,7 @@ SloccountBuildAction getPreviousAction(){
return null;
}

AbstractBuild<?,?> getBuild(){
public AbstractBuild<?,?> getBuild(){
return this.build;
}

@@ -41,7 +41,7 @@ public String getIconFileName() {
}

public String getDisplayName() {
return Messages.Sloccount_ProjectAction_Name();
return Messages.Sloccount_SloccountResults();
}

public String getUrlName() {
@@ -83,6 +83,16 @@ public void doIndex(final StaplerRequest request, final StaplerResponse response
return lastBuild;
}

/**
* Get build action of the last finished build.
*
* @return the build action or null
*/
public SloccountBuildAction getLastFinishedBuildAction() {
AbstractBuild<?, ?> lastBuild = getLastFinishedBuild();
return (lastBuild != null) ? lastBuild.getAction(SloccountBuildAction.class) : null;
}

public final boolean hasValidResults() {
AbstractBuild<?, ?> build = getLastFinishedBuild();

@@ -1,6 +1,6 @@
Sloccount.Publisher.Name=Publish SLOCCount analysis results

Sloccount.ProjectAction.Name=SLOCCount
Sloccount.SloccountResults=SLOCCount Results

Sloccount.Trend.Name=SLOCCount Trend
Sloccount.Trend.Lines=lines
@@ -1,5 +1,5 @@
Sloccount.Publisher.Name=Anzeige der SLOCCount Analyseergebnisse

Sloccount.ProjectAction.Name=SLOCCount
Sloccount.SloccountResults=SLOCCount

Sloccount.Trend.Name=SLOCCount Trend
@@ -1,5 +1,5 @@
Sloccount.Publisher.Name=SLOCCount\u306e\u5206\u6790\u7d50\u679c\u306e\u516c\u958b

Sloccount.ProjectAction.Name=SLOCCount
Sloccount.SloccountResults=SLOCCount

Sloccount.Trend.Name=SLOCCount\u306e\u63a8\u79fb
@@ -0,0 +1,45 @@
<j:jelly xmlns:j="jelly:core">

<style type="text/css">
#sloccountSummary { width: auto; }
#sloccountSummary .number { text-align: right; }
</style>

<table class="pane sortable" id="sloccountSummary">
<thead>
<tr>
<td class="pane-header">${%Language}</td>
<td class="pane-header">${%Lines}</td>
<td class="pane-header">${%Lines} ${%Delta}</td>
<td class="pane-header">${%Files}</td>
<td class="pane-header">${%Files} ${%Delta}</td>
</tr>
</thead>
<tbody>
<j:forEach var="language" items="${diff.languageDiffs}">
<tr>
<j:if test="${buildNumber == -1}">
<td class="pane"><a href="sloccountResult/languageResult/${language.urlName}">${language.name}</a></td>
</j:if>
<j:if test="${buildNumber != -1}">
<td class="pane"><a href="${buildNumber}/sloccountResult/languageResult/${language.urlName}">${language.name}</a></td>
</j:if>
<td class="pane number" data="${language.lineCount}">${language.lineCountString}</td>
<td class="pane number" data="${language.lineCountDelta}">${language.lineCountDeltaString}</td>
<td class="pane number" data="${language.fileCount}">${language.fileCountString}</td>
<td class="pane number" data="${language.fileCountDelta}">${language.fileCountDeltaString}</td>
</tr>
</j:forEach>
</tbody>
<tfoot>
<tr class="sortbottom">
<td class="pane-header">${%Total}</td>
<td class="pane-header number" data="${diff.lineCount}">${diff.lineCountString}</td>
<td class="pane-header number" data="${diff.lineCountDelta}">${diff.lineCountDeltaString}</td>
<td class="pane-header number" data="${diff.fileCount}">${diff.fileCountString}</td>
<td class="pane-header number" data="${diff.fileCountDelta}">${diff.fileCountDeltaString}</td>
</tr>
</tfoot>
</table>

</j:jelly>
@@ -1,50 +1,10 @@
<j:jelly xmlns:j="jelly:core"
xmlns:d="jelly:define"
xmlns:l="/lib/layout"
xmlns:t="/lib/hudson"
xmlns:f="/lib/form"
xmlns:i="jelly:fmt">
<j:jelly xmlns:j="jelly:core" xmlns:t="/lib/hudson" xmlns:st="jelly:stapler">

<t:summary icon="/plugin/sloccount/icons/sloccount-48.png">
<div><a href="sloccountResult">${%SLOCCount}</a></div>
<div><a href="${it.urlName}">${it.displayName}</a></div>

<j:set var="diff" value="${it.diffSummary}"/>

<style type="text/css">
#sloccountSummary { width: auto; }
#sloccountSummary .number { text-align: right; }
</style>

<table class="pane sortable" id="sloccountSummary">
<thead>
<tr>
<td class="pane-header">${%Language}</td>
<td class="pane-header">${%Lines}</td>
<td class="pane-header">${%Lines} ${%Delta}</td>
<td class="pane-header">${%Files}</td>
<td class="pane-header">${%Files} ${%Delta}</td>
</tr>
</thead>
<tbody>
<j:forEach var="language" items="${diff.languageDiffs}">
<tr>
<td class="pane"><a href="sloccountResult/languageResult/${language.urlName}">${language.name}</a></td>
<td class="pane number" data="${language.lineCount}">${language.lineCountString}</td>
<td class="pane number" data="${language.lineCountDelta}">${language.lineCountDeltaString}</td>
<td class="pane number" data="${language.fileCount}">${language.fileCountString}</td>
<td class="pane number" data="${language.fileCountDelta}">${language.fileCountDeltaString}</td>
</tr>
</j:forEach>
</tbody>
<tfoot>
<tr class="sortbottom">
<td class="pane-header">${%Total}</td>
<td class="pane-header number" data="${diff.lineCount}">${diff.lineCountString}</td>
<td class="pane-header number" data="${diff.lineCountDelta}">${diff.lineCountDeltaString}</td>
<td class="pane-header number" data="${diff.fileCount}">${diff.fileCountString}</td>
<td class="pane-header number" data="${diff.fileCountDelta}">${diff.fileCountDeltaString}</td>
</tr>
</tfoot>
</table>
<j:set var="buildNumber" value="-1"/>
<st:include page="statistics.jelly" />
</t:summary>
</j:jelly>
@@ -0,0 +1,15 @@
<j:jelly xmlns:j="jelly:core" xmlns:t="/lib/hudson" xmlns:st="jelly:stapler">
<table style="margin-left:1em;">
<t:summary icon="/plugin/sloccount/icons/sloccount-48.png">
<div><a href="${it.urlName}">${it.displayName}</a></div>

<j:set var="lastBuildAction" value="${it.lastFinishedBuildAction}"/>

<j:if test="${lastBuildAction != null}">
<j:set var="diff" value="${lastBuildAction.diffSummary}"/>
<j:set var="buildNumber" value="${lastBuildAction.build.number}"/>
<st:include page="/hudson/plugins/sloccount/SloccountBuildAction/statistics.jelly"/>
</j:if>
</t:summary>
</table>
</j:jelly>

0 comments on commit f73ff44

Please sign in to comment.