Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-67396] Update link and breadcrumb dropdowns #6084

Merged
merged 51 commits into from
Mar 16, 2022
Merged
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
e75d08c
WIP replacement of link dropdowns
janfaracik Nov 25, 2021
f35f074
Working build - chevron menus now dead, shiny new ones working <3
janfaracik Nov 25, 2021
fecfc70
Final cleanup hopefully :sparkles:
janfaracik Nov 25, 2021
384d3e8
Update tabs.less
janfaracik Nov 25, 2021
deac385
Fix missing chevron on user name in header
janfaracik Nov 27, 2021
184dbc6
Merge branch 'master' into new-breadcrumbs
janfaracik Nov 28, 2021
3470703
Update headerContent.jelly
janfaracik Nov 28, 2021
a5a24a9
Cleanup header container, use native sticky when possible
janfaracik Nov 28, 2021
efb243a
Merge branch 'master' into new-breadcrumbs
janfaracik Dec 19, 2021
37f2707
Reset stylings
janfaracik Dec 19, 2021
6e5c40d
Fix breadcrumbs not stickying (position: sticky is a pain), fix heade…
janfaracik Dec 22, 2021
f1d9818
Fixed the footer being misplaced (footers are a pain)
janfaracik Dec 22, 2021
b278d33
Increase hit target size of chevrons
janfaracik Dec 23, 2021
ad347d6
Fix missing tooltip for build column
janfaracik Dec 23, 2021
c126f7a
Merge branch 'master' into new-breadcrumbs
timja Dec 23, 2021
34a86c5
Update breadcrumbs.less
janfaracik Dec 24, 2021
29c7114
Working build - first attempt at combining breadcrumb dropdowns
janfaracik Dec 31, 2021
9476243
Minor styling changes to breadcrumb bar
janfaracik Jan 1, 2022
5c4c478
Merge branch 'master' into new-breadcrumbs
janfaracik Jan 1, 2022
d18bbc6
Javarey menus beat loading them twice
janfaracik Jan 1, 2022
8abb6c3
Fix config page breadcrumb dropdown, adjust js doc
janfaracik Jan 2, 2022
9adbd5d
Update Javadoc
janfaracik Jan 2, 2022
9aff120
Merge branch 'master' into new-breadcrumbs
janfaracik Jan 2, 2022
d4eafef
Fix breadcrumb link
janfaracik Jan 3, 2022
279911c
Update core/src/main/resources/lib/form/breadcrumb-config-outline.jelly
janfaracik Jan 3, 2022
c6bb759
Merge branch 'master' into new-breadcrumbs
janfaracik Jan 11, 2022
ef27fb3
Update separator design
janfaracik Jan 11, 2022
745f517
Make menu headers/separators non-clickable
janfaracik Jan 11, 2022
7bcf1f0
Fix build breadcrumb menu not appearing
janfaracik Jan 11, 2022
c4be993
Update styling slightly
janfaracik Jan 11, 2022
401abf6
Merge branch 'master' into new-breadcrumbs
janfaracik Jan 12, 2022
ee6c5fd
Improve model links for console/text no longer moves + text now copie…
janfaracik Jan 12, 2022
989a0bc
Breadcrumb chevrons without menus no longer have hover/active states,…
janfaracik Jan 12, 2022
7ef9976
Merge branch 'master' into new-breadcrumbs
janfaracik Jan 24, 2022
5271949
Merge branch 'master' into new-breadcrumbs
timja Jan 27, 2022
6ac682f
Merge branch 'master' into new-breadcrumbs
janfaracik Feb 7, 2022
94876d2
Merge branch 'master' into new-breadcrumbs
janfaracik Feb 12, 2022
1e3f68d
Restore separate breadcrumb dropdowns
janfaracik Feb 13, 2022
ea6fc46
Remove IE compat
janfaracik Feb 13, 2022
f9aa5ba
Remove log
janfaracik Feb 13, 2022
f0726b9
Update core/src/main/java/jenkins/model/ModelObjectWithContextMenu.java
janfaracik Feb 13, 2022
c49c9e8
Update so chevrons appear for touch screen users, increase background…
janfaracik Feb 28, 2022
526035c
Merge branch 'master' into new-breadcrumbs
janfaracik Feb 28, 2022
35c2fc5
Increase hitbox
janfaracik Feb 28, 2022
806563d
Update node status to align to the right
janfaracik Mar 2, 2022
14273f3
Remove HREF from breadcrumb
janfaracik Mar 14, 2022
d735301
Fix scroll spy header
janfaracik Mar 14, 2022
9de15cf
Fix dropdown in console/started by
janfaracik Mar 15, 2022
3e2324f
Merge branch 'new-breadcrumbs' of github.com:janfaracik/jenkins into …
timja Mar 15, 2022
6231a50
Merge branch 'master' into new-breadcrumbs
timja Mar 15, 2022
16c0585
Fix build icon not being clickable
janfaracik Mar 15, 2022
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
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/console/ModelHyperlinkNote.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public ModelHyperlinkNote(String url, int length) {

@Override
protected String extraAttributes() {
return " class='model-link'";
return " class='model-link model-link--float'";
}

public static String encodeTo(@NonNull User u) {
Expand Down
25 changes: 21 additions & 4 deletions core/src/main/java/jenkins/model/ModelObjectWithContextMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,18 @@ public ContextMenu add(String url, String icon, String iconXml, String text, boo
@Restricted(DoNotUse.class) // manage.jelly only
public ContextMenu addHeader(String title) {
final MenuItem item = new MenuItem().withDisplayName(title);
item.header = true;
item.type = MenuItemType.HEADER;
return add(item);
}

/**
* Add a separator row (no icon, no URL, no text).
*
* @since TODO - Provide version
*/
public ContextMenu addSeparator() {
final MenuItem item = new MenuItem();
item.type = MenuItemType.SEPARATOR;
return add(item);
}

Expand Down Expand Up @@ -303,12 +314,12 @@ class MenuItem {


/**
* True to display this item as a section header.
* @since 2.231
* The type of menu item
* @since TODO
*/
@Exported
@SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD", justification = "read by Stapler")
public boolean header;
public MenuItemType type = MenuItemType.ITEM;

/**
* If this is a submenu, definition of subitems.
Expand Down Expand Up @@ -388,6 +399,12 @@ private String getResourceUrl() {

}

enum MenuItemType {
ITEM,
HEADER,
SEPARATOR
}

/**
* Allows an action to decide whether it will be visible in a context menu.
* @since 1.538
Expand Down
24 changes: 12 additions & 12 deletions core/src/main/resources/hudson/views/BuildButtonColumn/column.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ THE SOFTWARE.
<j:set var="id" value="${h.generateId()}"/>
<j:set var="href" value="${jobBaseUrl}${job.shortUrl}build?delay=0sec"/>
<div class="jenkins-table__cell__button-wrapper">
<a id="${id}" class="jenkins-table__button jenkins-table__button--green" href="${href}">
<j:choose>
<j:when test="${job.parameterized}">
<j:set var="title" value="${%Schedule_a_task_with_parameters(h.getRelativeDisplayNameFrom(job, itemGroup),it.taskNoun(job))}"/>
</j:when>
<j:otherwise>
<span class="build-button-column-icon-reference-holder" data-id="${id}" data-url="${href}" data-notification="${%Task_scheduled(it.taskNoun(job))}"/>
<j:set var="title" value="${%Schedule_a_task(h.getRelativeDisplayNameFrom(job, itemGroup),it.taskNoun(job))}"/>
</j:otherwise>
</j:choose>
<l:icon src="symbol-play" alt="${title}" />
<st:adjunct includes="hudson.views.BuildButtonColumn.icon"/>
<j:choose>
<j:when test="${job.parameterized}">
<j:set var="title" value="${%Schedule_a_task_with_parameters(h.getRelativeDisplayNameFrom(job, itemGroup),it.taskNoun(job))}"/>
</j:when>
<j:otherwise>
<span class="build-button-column-icon-reference-holder" data-id="${id}" data-url="${href}" data-notification="${%Task_scheduled(it.taskNoun(job))}"/>
<j:set var="title" value="${%Schedule_a_task(h.getRelativeDisplayNameFrom(job, itemGroup),it.taskNoun(job))}"/>
</j:otherwise>
</j:choose>
<a id="${id}" tooltip="${title}" class="jenkins-table__button jenkins-table__button--green" href="${href}">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caused SECURITY-2780

<l:icon src="symbol-play" />
<st:adjunct includes="hudson.views.BuildButtonColumn.icon"/>
</a>
</div>
</j:if>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ THE SOFTWARE.
<j:choose>
<j:when test="${lfBuild!=null}">
${lfBuild.timestampString}
<a href="${jobBaseUrl}${job.shortUrl}lastFailedBuild/" class="jenkins-table__link jenkins-table__badge">${lfBuild.displayName}</a>
<a href="${jobBaseUrl}${job.shortUrl}lastFailedBuild/" class="jenkins-table__link jenkins-table__badge model-link inside">${lfBuild.displayName}</a>
</j:when>
<j:otherwise>
${%N/A}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ THE SOFTWARE.
<j:choose>
<j:when test="${lsBuild!=null}">
${lsBuild.timestampString}
<a href="${jobBaseUrl}${job.shortUrl}lastSuccessfulBuild/" class="jenkins-table__link jenkins-table__badge">${lsBuild.displayName}</a>
<a href="${jobBaseUrl}${job.shortUrl}lastSuccessfulBuild/" class="jenkins-table__link jenkins-table__badge model-link inside">${lsBuild.displayName}</a>
</j:when>
<j:otherwise>
${%N/A}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:i="jelly:fmt" xmlns:x="jelly:xml">
<header id="header" class="page-header">
<header id="page-header" class="page-header">
Copy link
Member

@daniel-beck daniel-beck Mar 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it could easily break some stuff inadvertently. Is there a good reason for this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I had to remove the div that wraps the header and breadcrumb bar as it was breaking how position: sticky works for the new breadcrumb bar, so I renamed this element to be consistent with the other page elements.

<div class="page-header__brand">
<div class="logo">
<a id="jenkins-home-link" href="${rootURL}/">
Expand Down Expand Up @@ -56,7 +56,7 @@
<j:set var="userName" value="${user.fullName}"/>
</j:otherwise>
</j:choose>
<a href="${rootURL}/${user.url}" class="model-link inside inverse">
<a href="${rootURL}/${user.url}" class="model-link">
<l:svgIcon
class="am-monitor-icon" >
<use href="${resURL}/images/material-icons/svg-sprite-social-symbol.svg#ic_person_24px"></use>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ THE SOFTWARE.
</st:documentation>

<st:adjunct includes="lib.form.breadcrumb-config-outline.init"/>
<l:breadcrumb title="${attrs.title?:'%configuration'}" id="inpage-nav" />
<l:breadcrumb title="${attrs.title?:'%configuration'}" href="${rootURL}/configure" id="inpage-nav" />
timja marked this conversation as resolved.
Show resolved Hide resolved
</j:jelly>
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,9 @@ Event.observe(window, "load", function () {
$(e.section).insert({top:"<a id=" + id + " class='section-anchor'>#</a>"});
menu.add('#' + id, null, caption);
});
breadcrumbs.attachMenu('inpage-nav', menu);
var inpageNav = document.getElementById("inpage-nav")
var chevron = document.createElement("li")
chevron.classList.add("children")
inpageNav.parentNode.insertBefore(chevron, inpageNav.nextSibling);
breadcrumbs.attachMenu(chevron, menu);
});
2 changes: 1 addition & 1 deletion core/src/main/resources/lib/hudson/buildListTable.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ THE SOFTWARE.
insert(new Element('div', {class: 'jenkins-table__cell__button-wrapper'}).
insert(generateSVGIcon(e.iconName, "${iconSizeClass}"))));
tr.insert(new Element('td').
insert(new Element('a', {class: 'jenkins-table__link model-link inside', href: '${rootURL}/' + e.parentUrl}).
insert(new Element('a', {class: 'jenkins-table__link model-link', href: '${rootURL}/' + e.parentUrl}).
update(e.parentFullDisplayName)).
insert(new Element('a', {class: 'jenkins-table__link jenkins-table__badge model-link inside', href: '${rootURL}/' + e.url}).
update(e.displayName.escapeHTML())));
Expand Down
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 @@ -40,9 +40,9 @@ THE SOFTWARE.

<j:if test="${mode=='breadcrumbs'}">
<li id="${attrs.id}" class="item">
<a href="${attrs.href}" class="model-link inside">
<a href="${attrs.href}">
${attrs.title}
</a>
</li>
</j:if>
</j:jelly>
</j:jelly>
75 changes: 36 additions & 39 deletions core/src/main/resources/lib/layout/breadcrumbBar.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -34,50 +34,47 @@ THE SOFTWARE.
use the &lt;l:breadcrumb> tag.
</st:documentation>

<tr id="top-nav">
<td id="left-top-nav" colspan="2">
<st:adjunct includes="lib.layout.breadcrumbs" />
<div class="top-sticker noedge">
<div class="top-sticker-inner">
<div class="breadcrumbs__wrapper">
<ul id="breadcrumbs">
<j:forEach var="anc" items="${request.ancestors}">
<j:if test="${h.isModel(anc.object) and anc.prev.url!=anc.url}">
<li class="item">
<a href="${anc.url}/" class="${h.isModelWithContextMenu(anc.object)?'model-link':null} inside">
<!-- Workaround to set desired name to first breadcrumb (instead of Jenkins) -->
<j:choose>
<j:when test="${anc.object == app}">
${%Dashboard}
</j:when>
<j:otherwise>
${anc.object.displayName}
</j:otherwise>
</j:choose>
</a>
</li>
<st:adjunct includes="lib.layout.breadcrumbs" />

<div class="top-sticker noedge">
<div class="top-sticker-inner">
<div class="jenkins-breadcrumbs">
<ul id="breadcrumbs">
<j:forEach var="anc" items="${request.ancestors}">
<j:if test="${h.isModel(anc.object) and anc.prev.url!=anc.url}">
<li class="item">
<a href="${anc.url}/" class="${h.isModelWithContextMenu(anc.object)?'model-link':null}">
<!-- Workaround to set desired name to first breadcrumb (instead of Jenkins) -->
<j:choose>
<j:when test="${h.isModelWithChildren(anc.object)}">
<li class="children" href="${anc.url}/">
<!-- shows '>' for rendering children -->
</li>
<j:when test="${anc.object == app}">
${%Dashboard}
</j:when>
<j:otherwise>
<li class="separator">
</li>
${anc.object.displayName}
</j:otherwise>
</j:choose>
</j:if>
</j:forEach>
</a>
</li>
<j:choose>
<j:when test="${h.isModelWithChildren(anc.object)}">
<li class="children" href="${anc.url}/">
<!-- shows '>' for rendering children -->
</li>
</j:when>
<j:otherwise>
<li class="separator">
</li>
</j:otherwise>
</j:choose>
</j:if>
</j:forEach>

<!-- render additional breadcrumb items -->
<d:invokeBody />
</ul>
<!-- render additional breadcrumb items -->
<d:invokeBody />
</ul>

<div id="breadcrumb-menu-target"/><!-- this is where the menu gets rendered -->
</div>
</div>
<div id="breadcrumb-menu-target"/><!-- this is where the menu gets rendered -->
</div>
</td>
</tr>
</j:jelly>
</div>
</div>
</j:jelly>
Loading