Skip to content

Commit

Permalink
Add last build status to job page (#8129)
Browse files Browse the repository at this point in the history
  • Loading branch information
janfaracik authored Jul 17, 2023
1 parent 1800077 commit 357fde9
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ THE SOFTWARE.
</div>
</div>

<t:buildCaption>${%Build} ${it.displayName} (<i:formatDate value="${it.timestamp.time}" type="both" dateStyle="medium" timeStyle="medium"/>)</t:buildCaption>
<t:buildCaption>${it.displayName} (<i:formatDate value="${it.timestamp.time}" type="both" dateStyle="medium" timeStyle="medium"/>)</t:buildCaption>

<div>
<t:editableDescription permission="${it.UPDATE}" />
Expand Down
15 changes: 14 additions & 1 deletion core/src/main/resources/hudson/model/Job/index.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,20 @@ THE SOFTWARE.
<st:include page="sidepanel.jelly" />
<!-- no need for additional breadcrumb here as we're on an index page already including breadcrumb -->
<l:main-panel>
<h1 class="job-index-headline page-headline">${it.pronoun} <l:breakable value="${it.displayName}"/></h1>
<div class="jenkins-app-bar">
<div class="jenkins-app-bar__content jenkins-build-caption">
<j:set var="lastBuild" value="${it.lastBuild}" />
<j:if test="${lastBuild != null}">
<a href="${rootURL + '/' + lastBuild.url}" class="jenkins-!-display-contents" tabindex="-1">
<l:icon class="${lastBuild.buildStatusIconClassName}" tooltip="${lastBuild.iconColor.description}"/>
</a>
</j:if>
<h1 class="job-index-headline page-headline">
<l:breakable value="${it.displayName}"/>
</h1>
</div>
</div>

<j:if test="${(it.fullName!=it.fullDisplayName) and (it.class.name!='hudson.matrix.MatrixConfiguration')}"> <!-- TODO rather check for TopLevelItem (how to do this from Jelly?) -->
<j:choose>
<j:when test="${it.parent!=app}">
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/lib/hudson/build-caption.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
}
}
rsp.text().then((responseText) => {
document.querySelector(".build-caption .icon-xlg").outerHTML =
document.querySelector(".jenkins-build-caption .icon-xlg").outerHTML =
responseText;
});
});
Expand Down
54 changes: 32 additions & 22 deletions core/src/main/resources/lib/hudson/buildCaption.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,36 @@ THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<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">
<h1 class="build-caption page-headline">
<l:icon alt="${it.iconColor.description}" class="${it.buildStatusIconClassName} icon-xlg" tooltip="${it.iconColor.description}"/>
<span class="jenkins-icon-adjacent">
<d:invokeBody trim="true"/>
</span>
<j:if test="${it.building}">
<div class="build-caption-progress-container">
<table class="middle-align"><tr>
<td>
${%Progress}:
</td><td class="build-caption-progress-bar">
<t:buildProgressBar build="${it}"/>
</td><td>
<j:if test="${it.parent.hasAbortPermission()}">
<l:stopButton href="stop" confirm="${%confirm(it.fullDisplayName)}" alt="[${%cancel}]"/>
</j:if>
</td>
</tr></table>
</div>
</j:if>
<st:adjunct includes="lib.hudson.build-caption"/>
</h1>
<div class="jenkins-app-bar">
<div class="jenkins-app-bar__content jenkins-build-caption">
<l:icon alt="${it.iconColor.description}" class="${it.buildStatusIconClassName} icon-xlg"
tooltip="${it.iconColor.description}"/>
<h1>
<d:invokeBody trim="true"/>
</h1>
</div>
<div class="jenkins-app-bar__controls">
<j:if test="${it.building}">
<div class="build-caption-progress-container">
<table class="middle-align">
<tr>
<td>
${%Progress}:
</td>
<td class="build-caption-progress-bar">
<t:buildProgressBar build="${it}"/>
</td>
<td>
<j:if test="${it.parent.hasAbortPermission()}">
<l:stopButton href="stop" confirm="${%confirm(it.fullDisplayName)}"
alt="[${%cancel}]"/>
</j:if>
</td>
</tr>
</table>
</div>
</j:if>
<st:adjunct includes="lib.hudson.build-caption"/>
</div>
</div>
</j:jelly>
2 changes: 1 addition & 1 deletion test/src/test/java/jenkins/bugs/Jenkins64991Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public void testRedirectToProject() throws Exception {
assertNotNull(freeStyleProject);
final JenkinsRule.WebClient webClient = j.createWebClient();
final HtmlPage projectPage = webClient.getPage(freeStyleProject);
assertThat(projectPage.getWebResponse().getContentAsString(), containsStringIgnoringCase("Project " + freeStyleProject.getDisplayName()));
assertThat(projectPage.getWebResponse().getContentAsString(), containsStringIgnoringCase(freeStyleProject.getDisplayName()));

final Page loginPage = projectPage.getElementsByTagName("a").stream().filter(
e -> e.hasAttribute("href") && e.getAttribute("href").contains(j.jenkins.getSecurityRealm().getLoginUrl())
Expand Down
14 changes: 0 additions & 14 deletions war/src/main/scss/base/layout-commons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -122,20 +122,6 @@ body.full-screen #main-panel {
}
}

/* -------------------------------------- */

h1.build-caption.page-headline {
display: flex;
align-items: center;
}

h1.build-caption.page-headline > span {
max-width: 1200px;
overflow: hidden;
line-height: 2.4rem;
text-overflow: ellipsis;
}

// Clearfixes extracted from responsive-grid.css as they essential
.clearfix::before,
.clearfix::after,
Expand Down
6 changes: 3 additions & 3 deletions war/src/main/scss/base/typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,20 @@ h5,
h6,
.h6 {
line-height: var(--line-height-heading);
font-weight: bold;
font-weight: 650;
display: block;
margin-top: 0;
margin-bottom: var(--section-padding);
}

h1,
.h1 {
font-size: 1.6rem;
font-size: 1.5rem;
}

h2,
.h2 {
font-size: 1.4rem;
font-size: 1.35rem;
}

h3,
Expand Down
19 changes: 18 additions & 1 deletion war/src/main/scss/modules/app-bar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,23 @@
h1,
h2 {
margin: 0;
font-size: 1.6rem;
font-size: 1.5rem;
}
}

.jenkins-build-caption {
display: flex;
flex-direction: row !important;
align-items: center;
justify-content: start !important;
gap: 1rem;
max-width: 1200px;
overflow: hidden;
text-overflow: ellipsis;

.build-status-icon__wrapper,
.build-status-icon__wrapper svg {
width: 2rem !important;
height: 2rem !important;
}
}

0 comments on commit 357fde9

Please sign in to comment.