Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ 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">
<l:layout permissions="${app.MANAGE_AND_SYSTEM_READ}" title="${%System}" type="one-column">
<st:include page="sidepanel.jelly" />
<l:breadcrumb title="${%System}" />
<f:breadcrumb-config-outline title="${%System}" />

<l:main-panel>
<j:set var="readOnlyMode" value="${!h.hasPermission(app.MANAGE)}"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ THE SOFTWARE.
</st:attribute>
</st:documentation>

<l:breadcrumb title="${attrs.title?:'%configuration'}" id="inpage-nav" />
<l:breadcrumb title="${attrs.title?:'%configuration'}" id="inpage-nav" hasMenu="true" />
</j:jelly>
4 changes: 2 additions & 2 deletions core/src/main/resources/lib/layout/breadcrumb.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ THE SOFTWARE.

<j:if test="${mode=='breadcrumbs'}">
<j:set var="hasLink" value="${attrs.href != null}" />
<li id="${attrs.id}" class="jenkins-breadcrumbs__list-item" data-type="breadcrumb-item" aria-current="${hasLink ? null : 'page'}">
<li id="${attrs.id}" class="jenkins-breadcrumbs__list-item" data-type="breadcrumb-item" aria-current="${hasLink ? null : 'page'}" data-has-menu="${attrs.hasMenu}">
<j:choose>
<j:when test="${!hasLink}">
<span>${attrs.title}</span>
<span class="${attrs.hasMenu ? 'hoverable-model-link' : ''}">${attrs.title}</span>
</j:when>
<j:otherwise>
<a href="${attrs.href}" class="${attrs.hasMenu ? 'hoverable-model-link' : ''} ${attrs.hasChildrenMenu ? 'hoverable-children-model-link' : ''}">
Expand Down
1 change: 0 additions & 1 deletion src/main/js/components/dropdowns/autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ function init() {
0,
function (e) {
e.setAttribute("autocomplete", "off");
e.dataset["hideOnClick"] = "false";
// form field with auto-completion support
e.style.position = "relative";
// otherwise menu won't hide on tab with nothing selected
Expand Down
8 changes: 2 additions & 6 deletions src/main/js/components/dropdowns/inpage-jumplist.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,17 @@ import { toId } from "@/util/dom";
* sections on the page (if using <f:breadcrumb-config-outline />)
*/
function init() {
const inpageNavigationBreadcrumb = document.querySelector("#inpage-nav");
const inpageNavigationBreadcrumb = document.querySelector("#inpage-nav span");

if (inpageNavigationBreadcrumb) {
const chevron = document.createElement("li");
chevron.classList.add("children");
chevron.items = Array.from(
inpageNavigationBreadcrumb.items = Array.from(
document.querySelectorAll(
"form > div > .jenkins-section > .jenkins-section__title",
),
).map((section) => {
section.id = toId(section.textContent);
return { label: section.textContent, url: "#" + section.id };
});

inpageNavigationBreadcrumb.after(chevron);
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/js/components/dropdowns/jumplists.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ function generateDropdowns() {
Utils.generateDropdown(
element,
(instance) => {
const href = element.href;

if (element.items) {
instance.setContent(Utils.generateDropdownItems(element.items));
return;
}

const href = element.href;

const hasModelLink = element.classList.contains(
"hoverable-model-link",
);
Expand Down Expand Up @@ -105,7 +105,7 @@ function generateDropdowns() {
instance.loaded = true;
});
},
false,
element.items != null,
{
trigger: "mouseenter",
offset: [-16, 10],
Expand Down
46 changes: 18 additions & 28 deletions src/main/js/components/dropdowns/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,43 +22,25 @@ function generateDropdown(element, callback, immediate, options = {}) {
{},
Templates.dropdown(),
{
hideOnClick:
element.dataset["hideOnClick"] !== "false" ? "toggle" : false,
onCreate(instance) {
const onload = () => {
if (instance.loaded) {
return;
}

document.addEventListener("click", (event) => {
const isClickInAnyDropdown =
!!event.target.closest("[data-tippy-root]");
const isClickOnReference = instance.reference.contains(
event.target,
);
// Don't close the dropdown if the user is interacting with a SELECT menu inside of it
const isSelect = event.target.tagName === "SELECT";

if (!isClickInAnyDropdown && !isClickOnReference) {
if (!isClickOnReference && !isSelect) {
instance.clickToHide = true;
instance.hide();
}
});

instance.popper.addEventListener("mouseenter", () => {
const handleMouseMove = () => {
const dropdowns =
document.querySelectorAll("[data-tippy-root]");
const isMouseOverAnyDropdown = Array.from(dropdowns).some(
(dropdown) => dropdown.matches(":hover"),
);

if (!isMouseOverAnyDropdown) {
instance.hide();
document.removeEventListener("mousemove", handleMouseMove);
}
};

document.addEventListener("mousemove", handleMouseMove);
});

callback(instance);
};
if (immediate) {
Expand All @@ -69,13 +51,21 @@ function generateDropdown(element, callback, immediate, options = {}) {
});
}
},
onHide() {
const dropdowns = document.querySelectorAll("[data-tippy-root]");
const isMouseOverAnyDropdown = Array.from(dropdowns).some(
(dropdown) => dropdown.matches(":hover"),
);
onHide(instance) {
if (
instance.props.trigger === "mouseenter" &&
!instance.clickToHide
) {
const dropdowns = document.querySelectorAll("[data-tippy-root]");
const isMouseOverAnyDropdown = Array.from(dropdowns).some(
(dropdown) => dropdown.matches(":hover"),
);

return !isMouseOverAnyDropdown;
}

return !isMouseOverAnyDropdown;
instance.clickToHide = false;
return true;
},
},
options,
Expand Down
1 change: 1 addition & 0 deletions src/main/scss/base/_core.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ html {
box-sizing: border-box;
-webkit-tap-highlight-color: transparent;
color: var(--text-color);
scroll-padding-top: calc(var(--header-height) + var(--section-padding));
}

body {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assume.assumeFalse;

import hudson.Functions;
import hudson.model.Computer;
import hudson.model.ComputerSet;
import hudson.model.Slave;
Expand Down Expand Up @@ -37,6 +39,7 @@ public class ResponseTimeMonitorTest {
@Test
@Issue("JENKINS-20272")
public void skipOfflineAgent() throws Exception {
assumeFalse("TODO: Test is flaky on ci.jenkins.io Windows agents", Functions.isWindows() && System.getenv("CI") != null);
DumbSlave s = j.createSlave();
SlaveComputer c = s.getComputer();
c.connect(false).get(); // wait until it's connected
Expand Down
Loading