Skip to content

Commit

Permalink
More
Browse files Browse the repository at this point in the history
  • Loading branch information
janfaracik committed Nov 25, 2023
1 parent 2f946d3 commit 29fcb64
Show file tree
Hide file tree
Showing 11 changed files with 243 additions and 59 deletions.
Expand Up @@ -23,4 +23,4 @@ THE SOFTWARE.
-->

<?jelly escape-by-default='true'?>
<l:icon class="icon-lock icon-sm" tooltip="${%Keep this build forever}:\n${build.whyKeepLog}" xmlns:l="/lib/layout"/>
<l:icon src="symbol-keep" class="icon-sm" tooltip="${build.whyKeepLog}" xmlns:l="/lib/layout"/>
Expand Up @@ -28,12 +28,13 @@ 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" xmlns:i="jelly:fmt">
<j:set target="${it}" property="nextBuildNumberToFetch" value="${it.nextBuildNumber}"/>
<!-- build history -->
<j:invokeStatic className="java.time.LocalDate" method="now" var="now"/>

<j:forEach var="pageEntry" items="${it.runs}">
<i:formatDate value="${pageEntry.entry.timestamp.time}" var="date" type="date" dateStyle="long" />
<i:formatDate value="${pageEntry.entry.timestamp.time}" var="date" type="date" dateStyle="long" />
<i:formatDate value="${pageEntry.entry.timestamp.time}" var="simpleDate" type="date" pattern="YYYY-MM-dd" />
<j:if test="${pastDate != date}">
<span class="willow">${date}</span>
<span class="willow">${simpleDate == now ? "%Today" : date}</span>
<j:set var="pastDate" value="${date}" />
</j:if>
<st:include page="/hudson/widgets/HistoryWidget/entry.jelly" />
Expand Down
56 changes: 29 additions & 27 deletions core/src/main/resources/hudson/widgets/HistoryWidget/entry.jelly
Expand Up @@ -37,43 +37,45 @@ THE SOFTWARE.

<div class="ethan" page-entry-id="${pageEntry.entryId}">
<div class="toprow">
<a class="build-status-link" href="${h.getConsoleUrl(build)}" tooltip="${build.iconColor.description} > ${%Console Output}">
<a class="toprow__icon"
href="${h.getConsoleUrl(build)}"
tooltip="${build.iconColor.description} > ${%Console Output}">
<l:icon src="symbol-status-${build.iconColor.iconName}" />
</a>
<a href="${link}">${build.displayName}</a>
<div class="timeman" time="${build.timestamp.time.time}">
<j:set var="linkTitleAttr" value=""/>
<j:if test="${!build.building}">
<j:set var="linkTitleAttr">${%Took} ${build.durationString}</j:set>
</j:if>
<div tooltip="${linkTitleAttr}">
<i:formatDate value="${build.timestamp.time}" type="time" timeStyle="short" />
${h.getUserTimeZonePostfix()}
<a href="${link}" class="toprow__link">
${build.displayName}
<span class="timeman" time="${build.timestamp.time.time}">
<j:set var="linkTitleAttr" value="${null}" />
<j:if test="${!build.building}">
<j:set var="linkTitleAttr">${%Took} ${build.durationString}</j:set>
</j:if>
<div tooltip="${linkTitleAttr}">
<i:formatDate value="${build.timestamp.time}" type="time" timeStyle="short" />
${h.getUserTimeZonePostfix()}
</div>
</span>
</a>
<j:if test="${build.building}">
<div class="toprow__controls">
<j:if test="${build.building}">
<j:set target="${it.widget}" property="nextBuildNumberToFetch" value="${build.number}"/>
<t:buildProgressBar build="${build}"/>
</j:if>

<!-- Check CANCEL permission for Project, Admin permission otherwise -->
<j:if test="${empty(it.widget.owner.CANCEL) ? h.hasPermission(app.ADMINISTER) : it.widget.owner.hasPermission(it.widget.owner.CANCEL)}">
<l:stopButton href="${link}stop" alt="[cancel]" confirm="${%confirm(build.fullDisplayName)}" />
</j:if>
</div>
<j:if test="${build.building}">
<j:set target="${it.widget}" property="nextBuildNumberToFetch" value="${build.number}"/>
<t:buildProgressBar build="${build}"/>
</j:if>
</div>
</div>
<div>
<div class="middle-align build-badge">
</j:if>
<div class="toprow__badges">
<j:set var="badges" value="${build.badgeActions}"/>
<j:if test="${!empty(badges)}">
<st:nbsp/>
<j:forEach var="badge" items="${badges}">
<st:include it="${badge}" page="badge.jelly" />
</j:forEach>
</j:if>
</div>
<j:if test="${build.building}">
<div class="build-stop">
<!-- Check CANCEL permission for Project, Admin permission otherwise -->
<j:if test="${empty(it.widget.owner.CANCEL) ? h.hasPermission(app.ADMINISTER) : it.widget.owner.hasPermission(it.widget.owner.CANCEL)}">
<l:stopButton href="${link}stop" alt="[cancel]" confirm="${%confirm(build.fullDisplayName)}" />
</j:if>
</div>
</j:if>
</div>
<j:if test="${!empty build.truncatedDescription}">
<div class="descriptionnn">
Expand Down
41 changes: 29 additions & 12 deletions core/src/main/resources/hudson/widgets/HistoryWidget/index.jelly
Expand Up @@ -26,26 +26,43 @@ THE SOFTWARE.
<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:set var="page" value="${it.historyPageFilter}" />

<j:set var="controls">
<l:overflowButton>
<a class="jenkins-dropdown__item" href="${it.baseUrl}/rssAll">
<div class="jenkins-dropdown__item__icon">
<l:icon src="symbol-rss" />
</div>
Atom feed ${%for all}
</a>
<a class="jenkins-dropdown__item" href="${it.baseUrl}/rssFailed">
<div class="jenkins-dropdown__item__icon">
<l:icon src="symbol-rss" />
</div>
Atom feed ${%for failures}
</a>
</l:overflowButton>
</j:set>

<div id="buildHistoryPage" page-ajax="${it.baseUrl}/buildHistory/ajax"
page-entry-newest="${page.newestOnPage}"
page-entry-oldest="${page.oldestOnPage}"
page-has-up="${page.hasUpPage}"
page-has-down="${page.hasDownPage}">
<div class="buildtitle">Builds</div>

<l:search-bar placeholder="${%find}"
clazz="${page.runs.isEmpty() and page.queueItems.isEmpty() ? 'jenkins-hidden' : ''}"/>
<l:card title="Builds" controls="${controls}" expandable="buildTimeTrend">
<l:search-bar placeholder="${%find}"
clazz="${page.runs.isEmpty() and page.queueItems.isEmpty() ? 'jenkins-hidden' : ''}"/>

<div id="no-builds" class="jenkins-pane__information">
${%No builds}
</div>
<div id="no-builds" class="jenkins-pane__information">
${%No builds}
</div>

<div id="xander">
</div>
<div id="xander">
</div>

<!--The value for `page-next-build` is modified inside of `entries.jelly` on render, so set the attribute-->
<!--after that component has been rendered to get the correct value to use in `filter-build-history.js`-->
<div id="properties" page-next-build="${it.nextBuildNumberToFetch ?: it.owner.nextBuildNumber}"/>
<!--The value for `page-next-build` is modified inside of `entries.jelly` on render, so set the attribute-->
<!--after that component has been rendered to get the correct value to use in `filter-build-history.js`-->
<div id="properties" page-next-build="${it.nextBuildNumberToFetch ?: it.owner.nextBuildNumber}"/>
</l:card>
</div>

<script src="${resURL}/jsbundles/filter-build-history.js" type="text/javascript"/>
Expand Down
54 changes: 54 additions & 0 deletions core/src/main/resources/lib/layout/card.jelly
@@ -0,0 +1,54 @@
<!--
The MIT License
Copyright (c) 2023 Jan Faracik
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
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">
<st:documentation>
<st:attribute name="title" />
<st:attribute name="id" />
<st:attribute name="controls">
Todo
</st:attribute>
<st:attribute name="expandable">
Shows the expand icon if expandable
</st:attribute>
</st:documentation>

<div class="jenkins-card" id="${attrs.id}">
<div class="jenkins-card__title">
${attrs.title}
<div class="jenkins-card__controls">
<j:out value="${controls}"/>
<j:if test="${attrs.expandable != null}">
<a href="${attrs.expandable}" class="jenkins-button" tooltip="Expand">
<l:icon src="symbol-expand" />
</a>
</j:if>
</div>
</div>
<div class="jenkins-card__content">
<d:invokeBody />
</div>
</div>
</j:jelly>
1 change: 1 addition & 0 deletions war/src/main/js/filter-build-history.js
Expand Up @@ -26,6 +26,7 @@ function loadPage() {

xander.innerHTML = responseText;
noBuilds.style.display = "none";
Behaviour.applySubtree(xander);
});
}
});
Expand Down
1 change: 1 addition & 0 deletions war/src/main/resources/images/symbols/expand.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions war/src/main/resources/images/symbols/keep.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 43 additions & 15 deletions war/src/main/scss/components/_buttons.scss
Expand Up @@ -307,15 +307,13 @@ $jenkins-split-button-border-radius: 0.2rem;
}

#buildHistoryPage {
border: 2px solid color-mix(in srgb, var(--text-color-secondary) 15%, transparent);
padding: 1rem;
margin: 10px 0 10px 10px;
border-radius: 1rem;
margin: 10px;
margin-right: 0;
-webkit-font-smoothing: subpixel-antialiased;

.jenkins-search {
margin-inline: -0.5rem;
margin-top: -0.2rem;
margin-inline: -0.25rem;
//margin-top: -0.2rem;
margin-bottom: 5px;
}
}
Expand All @@ -325,26 +323,56 @@ $jenkins-split-button-border-radius: 0.2rem;

display: flex;
flex-direction: column;
padding: 0.35rem 0.55rem;
padding: 0;
margin: 0 -0.5rem;
font-size: 0.8rem !important;
font-size: 0.8125rem !important;

.toprow {
//display: grid;
//grid-template-columns: auto auto auto;
//align-items: center;
display: flex;
align-items: center;
gap: 0.5rem;
//gap: 0.5rem;
padding-right: 0.5rem;

a {
&__icon {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0 0.25rem 0 0.5rem;

svg {
width: 1.25rem;
height: 1.25rem;
}
}

&__link {
display: flex;
align-items: center;
color: var(--text-color);
gap: 0.5rem;
text-decoration: none;
font-weight: 450;
flex-grow: 1;
padding: 0.4rem 0;
padding-left: 0.25rem;

.timeman {
color: var(--text-color-secondary);
}
}

&__controls {
display: flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
}

.timeman {
color: var(--text-color-secondary);
&__badges {
display: flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
}
}
}
Expand Down
78 changes: 78 additions & 0 deletions war/src/main/scss/components/_cards.scss
@@ -0,0 +1,78 @@
$card-padding: 1rem;

.jenkins-card {
position: relative;
border-radius: 1rem;
margin-bottom: calc(var(--section-padding) / 2);
background: var(--card-background);

&__title {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 $card-padding;
height: 50px;
font-size: var(--font-size-sm) !important;
font-weight: 500;
width: 100%;
z-index: 1;
}

&__controls {
display: flex;
align-items: center;
justify-content: center;
gap: 0.4rem;
margin-right: -0.2rem;

.jenkins-button {
margin-block: -0.5rem;
min-height: 0;
padding: 0;
width: 26px;
height: 26px;
border-radius: 0.33rem;
color: var(--text-color-secondary) !important;

svg {
width: 1rem;
height: 1rem;
}

&::before, &::after {
opacity: 0;
}

&:active {
scale: 95%;
}
}
}

&:hover {
.jenkins-button {
color: var(--text-color) !important;
}
}

&__content {
display: flex;
flex-direction: column;
padding: 0 $card-padding $card-padding $card-padding;
color: var(--text-color-secondary);

&:empty {
display: none;
}
}

&::after {
content: "";
position: absolute;
inset: 0;
border-radius: inherit;
border: var(--card-border-width) solid var(--card-border-color);
z-index: 1;
pointer-events: none;
}
}
3 changes: 2 additions & 1 deletion war/src/main/scss/components/_index.scss
@@ -1,8 +1,9 @@
@use "app-bar";
@use "badges";
@use "breadcrumbs";
@use "buttons-deprecated";
@use "buttons";
@use "buttons-deprecated";
@use "cards";
@use "content-blocks";
@use "dialogs";
@use "dropdowns";
Expand Down

0 comments on commit 29fcb64

Please sign in to comment.