Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
janfaracik committed Nov 20, 2023
1 parent d9cbaa0 commit fb67e52
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 23 deletions.
24 changes: 13 additions & 11 deletions core/src/main/resources/hudson/widgets/HistoryWidget/index.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,20 @@ THE SOFTWARE.

<j:set var="page" value="${it.historyPageFilter}" />
<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 id="buildHistoryPageNav">
<div class="buildHistoryPageNav__item buildHistoryPageNav__item--page-one pageOne" title="Page 1 (Newest/Latest Builds)">
<div class="buildHistoryPageNav__item-page-one-top"></div>
<l:svgIcon href="${resURL}/images/svgs/go-up.svg#arrow" viewBox="0 0 16 16" />
<j:if test="${page.hasUpPage or page.hasDownPage}">
<div id="buildHistoryPageNav">
<div class="buildHistoryPageNav__item buildHistoryPageNav__item--page-one pageOne" title="Page 1 (Newest/Latest Builds)">
<div class="buildHistoryPageNav__item-page-one-top"></div>
<l:svgIcon href="${resURL}/images/svgs/go-up.svg#arrow" viewBox="0 0 16 16" />
</div>
<div class="buildHistoryPageNav__item pageUp" title="Newer Builds">
<l:svgIcon href="${resURL}/images/svgs/go-up.svg#arrow" viewBox="0 0 16 16" />
</div>
<div class="buildHistoryPageNav__item pageDown" title="Older Builds">
<l:svgIcon href="${resURL}/images/svgs/go-down.svg#arrow" viewBox="0 0 16 16" />
</div>
</div>
<div class="buildHistoryPageNav__item pageUp" title="Newer Builds">
<l:svgIcon href="${resURL}/images/svgs/go-up.svg#arrow" viewBox="0 0 16 16" />
</div>
<div class="buildHistoryPageNav__item pageDown" title="Older Builds">
<l:svgIcon href="${resURL}/images/svgs/go-down.svg#arrow" viewBox="0 0 16 16" />
</div>
</div>
</j:if>

<l:pane width="3" title="${h.runScript(paneTitle)}" footer="${h.runScript(paneFooter)}" id="buildHistory" class="jenkins-pane stripped">
<tr class="build-search-row">
Expand Down
24 changes: 12 additions & 12 deletions war/src/main/js/filter-build-history.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ const noBuildsBanner = document.getElementById("no-builds");
const sidePanel = document.getElementById("side-panel");
const buildHistoryPageNav = document.getElementById("buildHistoryPageNav");

const pageOne = buildHistoryPageNav.querySelector(".pageOne");
const pageUp = buildHistoryPageNav.querySelector(".pageUp");
const pageDown = buildHistoryPageNav.querySelector(".pageDown");
const pageOne = buildHistoryPageNav?.querySelector(".pageOne");
const pageUp = buildHistoryPageNav?.querySelector(".pageUp");
const pageDown = buildHistoryPageNav?.querySelector(".pageDown");

const leftRightPadding = 4;
const updateBuildsRefreshInterval = 5000;
Expand Down Expand Up @@ -159,8 +159,8 @@ function updatePageParams(dataTable) {
);
}
function togglePageUpDown() {
buildHistoryPageNav.classList.remove("hasUpPage");
buildHistoryPageNav.classList.remove("hasDownPage");
buildHistoryPageNav?.classList.remove("hasUpPage");
buildHistoryPageNav?.classList.remove("hasDownPage");
if (hasPageUp()) {
buildHistoryPageNav.classList.add("hasUpPage");
}
Expand Down Expand Up @@ -559,25 +559,25 @@ document.addEventListener("DOMContentLoaded", function () {

// Show/hide the nav as the mouse moves into the sidepanel and build history.
sidePanel.addEventListener("mouseover", function () {
buildHistoryPageNav.classList.add("mouseOverSidePanel");
buildHistoryPageNav?.classList.add("mouseOverSidePanel");
});
sidePanel.addEventListener("mouseout", function () {
buildHistoryPageNav.classList.remove("mouseOverSidePanel");
buildHistoryPageNav?.classList.remove("mouseOverSidePanel");
});
buildHistoryContainer.addEventListener("mouseover", function () {
buildHistoryPageNav.classList.add("mouseOverSidePanelBuildHistory");
buildHistoryPageNav?.classList.add("mouseOverSidePanelBuildHistory");
});
buildHistoryContainer.addEventListener("mouseout", function () {
buildHistoryPageNav.classList.remove("mouseOverSidePanelBuildHistory");
buildHistoryPageNav?.classList.remove("mouseOverSidePanelBuildHistory");
});

pageOne.addEventListener("click", function () {
pageOne?.addEventListener("click", function () {
loadPage();
});
pageUp.addEventListener("click", function () {
pageUp?.addEventListener("click", function () {
loadPage({ "newer-than": getNewestEntryId() });
});
pageDown.addEventListener("click", function () {
pageDown?.addEventListener("click", function () {
if (hasPageDown()) {
cancelRefreshTimeout();
loadPage({ "older-than": getOldestEntryId() });
Expand Down

0 comments on commit fb67e52

Please sign in to comment.