Skip to content

Commit

Permalink
Remove hierarchy-related sidebar links (#6907)
Browse files Browse the repository at this point in the history
Co-authored-by: Jesse Glick <[email protected]>
Co-authored-by: Tim Jacomb <[email protected]>
Co-authored-by: Tim Jacomb <[email protected]>
Co-authored-by: Tim Jacomb <[email protected]>
  • Loading branch information
5 people authored Aug 15, 2022
1 parent cb232e8 commit 26c924b
Show file tree
Hide file tree
Showing 25 changed files with 46 additions and 73 deletions.
2 changes: 2 additions & 0 deletions core/src/main/java/hudson/model/AbstractBuild.java
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,9 @@ public Queue.Executable getParentExecutable() {
* <p>
* If you override this method, you'll most likely also want to override
* {@link #getDisplayName()}.
* @deprecated navigation through a hierarchy should be done through breadcrumbs, do not add a link using this method
*/
@Deprecated(since = "TODO")
public String getUpUrl() {
return Functions.getNearestAncestorUrl(Stapler.getCurrentRequest(), getParent()) + '/';
}
Expand Down
4 changes: 4 additions & 0 deletions core/src/main/java/hudson/model/Computer.java
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,10 @@ public String getCaption() {
}

public String getUrl() {
if (Jenkins.get().hasAnyPermission(Jenkins.MANAGE, Jenkins.SYSTEM_READ)) {
return "manage/computer/" + Util.fullEncode(getName()) + "/";
}

return "computer/" + Util.fullEncode(getName()) + "/";
}

Expand Down
4 changes: 4 additions & 0 deletions core/src/main/java/jenkins/model/Jenkins.java
Original file line number Diff line number Diff line change
Expand Up @@ -5230,6 +5230,10 @@ public String getCaption() {

@Override
public String getUrl() {
if (Jenkins.get().hasAnyPermission(Jenkins.MANAGE, Jenkins.SYSTEM_READ)) {
return "manage/computer/(built-in)/";
}

return "computer/(built-in)/";
}

Expand Down
5 changes: 2 additions & 3 deletions core/src/main/resources/hudson/PluginManager/sidepanel.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ l=namespace(lib.LayoutTagLib)
l.header()
l.side_panel {
l.tasks {
l.task(icon:"icon-up icon-md", href:rootURL+'/', title:_("Back to Dashboard"))
l.task(icon:"symbol-settings", href:"${rootURL}/manage", title:_("Manage Jenkins"))
if (!app.updateCenter.jobs.isEmpty()) {
l.task(icon: "symbol-download", href:"../updateCenter/", title:_("Update Center"))
l.task(icon: "symbol-plugins", href: "${rootURL}/manage/pluginManager/", title:_("Plugin Manager"))
l.task(icon: "symbol-download", href: "${rootURL}/manage/updateCenter/", title:_("Update Center"))
}
}
}
6 changes: 0 additions & 6 deletions core/src/main/resources/hudson/PluginWrapper/uninstall.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ def l = namespace(lib.LayoutTagLib)
def f = namespace(lib.FormTagLib)

l.layout(permission: Jenkins.ADMINISTER) {
l.side_panel {
l.tasks {
l.task(icon: "icon-up icon-md", href: rootURL + '/', title: _("Back to Dashboard"))
l.task(icon: "icon-gear icon-md", href: "${rootURL}/manage", title: _("Manage Jenkins"))
}
}
def title = _("title", my.displayName)
l.header(title:title)
l.main_panel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ THE SOFTWARE.
<l:header />
<l:side-panel>
<l:tasks>
<l:task href=".." icon="icon-up icon-md" title="${%Back to Loggers}"/>
<l:task href="." icon="symbol-file-tray" title="${%Log records}"/>
<l:isAdmin>
<l:task href="configure" icon="symbol-settings" title="${%Configure}"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:l="/lib/layout" xmlns:t="/lib/hudson">
<l:layout title="Log">
<st:include page="sidepanel.jelly" />
<l:layout title="${%All Jenkins Logs}">
<l:breadcrumb title="${%All Jenkins Logs}" />
<l:main-panel>
<h1>${%Jenkins Log}</h1>
<h1>${%All Jenkins Logs}</h1>
<div class="alert alert-info">
Log messages at a level lower than INFO are never recorded in the Jenkins log. Use <a href=".">log recorders</a> to record these log messages.
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ THE SOFTWARE.
<l:header />
<l:side-panel>
<l:tasks>
<l:task href="${rootURL}/" icon="icon-up icon-md" title="${%Back to Dashboard}"/>
<l:task href="${rootURL}/manage" icon="symbol-settings" title="${%Manage Jenkins}"/>
<l:task href="." icon="icon-clipboard icon-md" title="${%Log Recorders}"/>
<l:task href="all" icon="symbol-file-tray" title="${%All Log Messages}"/>
<l:task href="levels" icon="symbol-settings" title="${%Log Levels}"/>
</l:tasks>
</l:side-panel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout" xmlns:p="/lib/hudson/project">
<l:task contextMenu="false" href="${it.upUrl}" icon="icon-up icon-md" title="${%Back to Project}"/>
<l:task contextMenu="false" href="${buildUrl.baseUrl}/" icon="symbol-details" title="${%Status}"/>
<l:task href="${buildUrl.baseUrl}/changes" icon="symbol-changes" title="${%Changes}"/>
<p:console-link/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@ THE SOFTWARE.
<l:side-panel>
<l:tasks>
<j:set var="url" value="${h.getNearestAncestorUrl(request,it)}"/>
<j:choose>
<j:when test="${it.parent==app}">
<l:task contextMenu="false" href="${rootURL}/" icon="icon-up icon-md" title="${%Back to Dashboard}"/>
</j:when>
<j:otherwise>
<l:task contextMenu="false" href="${rootURL}/${it.parent.url}" icon="icon-up icon-md" title="${%Up}"/>
</j:otherwise>
</j:choose>
<l:task contextMenu="false" href="${url}/" icon="symbol-details" title="${%Status}"/>
<l:task href="${url}/changes" icon="symbol-changes" title="${%Changes}"/>
<l:task icon="symbol-folder" href="${url}/ws/" title="${%Workspace}" permission="${it.WORKSPACE}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ THE SOFTWARE.
<l:header />
<l:side-panel>
<l:tasks>
<l:task contextMenu="false" href="${rootURL}/computer" icon="icon-up icon-md" title="${%Back to List}"/>
<l:task contextMenu="false" href="${rootURL}/${it.url}" icon="symbol-computer" title="${%Status}"/>
<l:task href="${rootURL}/${it.url}delete" icon="icon-edit-delete icon-md" permission="${it.DELETE}" title="${%Delete Agent}"/>
<l:task href="${rootURL}/${it.url}configure" icon="symbol-settings" permission="${it.EXTENDED_READ}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ THE SOFTWARE.
<l:side-panel>
<j:getStatic var="createPermission" className="hudson.model.Computer" field="CREATE"/>
<l:tasks>
<l:task href="${rootURL}/" icon="icon-up icon-md" title="${%Back to Dashboard}"/>
<l:task href="${rootURL}/manage" icon="symbol-settings" permissions="${app.MANAGE_AND_SYSTEM_READ}" title="${%Manage Jenkins}"/>
<l:task href="new" icon="symbol-add" permission="${createPermission}" title="${%New Node}"/>
<l:task href="../configureClouds" icon="symbol-cloud" permission="${app.SYSTEM_READ}"
title="${app.hasPermission(app.ADMINISTER) ? '%Configure Clouds' : '%View Clouds'}"/>
Expand Down
10 changes: 2 additions & 8 deletions core/src/main/resources/hudson/model/Fingerprint/index.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ THE SOFTWARE.
<l:header>
<!-- RSS? -->
</l:header>
<l:side-panel>
<l:tasks>
<l:task href="${rootURL}/" icon="icon-up icon-md" title="${%Back to Dashboard}"/>
<t:actions/>
</l:tasks>
</l:side-panel>
<l:main-panel>
<h1>
<l:icon class="icon-fingerprint icon-xlg"/>
Expand Down Expand Up @@ -77,9 +71,9 @@ THE SOFTWARE.
<td>
<t:buildRangeLink job="${job}" range="${range}" />
</td>
</td>
</td>
</tr>
</j:if>
</j:if>
</j:forEach>
</table>
</j:otherwise>
Expand Down
1 change: 0 additions & 1 deletion core/src/main/resources/hudson/model/Label/sidepanel.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ THE SOFTWARE.
<l:side-panel>
<l:tasks>
<j:set var="url" value="${h.getNearestAncestorUrl(request,it)}"/>
<l:task contextMenu="false" href="${rootURL}/" icon="icon-up icon-md" title="${%Back to Dashboard}"/>
<l:task contextMenu="false" href="${url}" icon="symbol-tag" title="${%Overview}"/>
<j:if test="${it.atom}">
<l:task href="${url}/configure" icon="symbol-settings" title="${%Configure}" permission="${app.ADMINISTER}" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ 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">
<l:layout title="${%No matching record found}">
<l:side-panel>
<l:tasks>
<l:task href="${rootURL}/" icon="icon-up icon-md" title="${%Back to Dashboard}"/>
</l:tasks>
</l:side-panel>
<l:main-panel>
<h1>
${title}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ THE SOFTWARE.
<l:header />
<l:side-panel>
<l:tasks>
<l:task href="${rootURL}/" icon="icon-up icon-md" title="${%Back to Dashboard}"/>
<l:task href="${rootURL}/manage" icon="symbol-settings" title="${%Manage Jenkins}"/>
<l:task href="../pluginManager/" icon="icon-plugin icon-lg" title="${%Manage Plugins}"/>
<l:task href="${rootURL}/manage/pluginManager/" icon="symbol-plugins" title="${%Plugin Manager}"/>
<l:task href="${rootURL}/manage/updateCenter/" icon="symbol-download" title="${%Update Center}"/>
</l:tasks>
</l:side-panel>
</j:jelly>
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@ def f=namespace(lib.FormTagLib)
def l=namespace(lib.LayoutTagLib)
def st=namespace("jelly:stapler")

l.layout(permission:app.SYSTEM_READ, title:my.displayName, cssclass:request.getParameter('decorate')) {
l.side_panel {
l.tasks {
l.task(icon: "icon-up icon-md", href: rootURL + '/', title: _("Back to Dashboard"))
l.task(icon: "icon-gear icon-md", href: "${rootURL}/manage", title: _("Manage Jenkins"))
}
}
l.layout(permission:app.SYSTEM_READ, title:my.displayName, cssclass:request.getParameter('decorate'), type:"one-column") {
l.app_bar(title: my.displayName)

l.main_panel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ THE SOFTWARE.
<l:header />
<l:side-panel>
<l:tasks>
<l:task href="${rootURL}/" icon="icon-up icon-md" title="${%Back to Dashboard}" />
<l:task href="${rootURL}/manage" icon="symbol-settings" permission="${app.MANAGE}" title="${%Manage Jenkins}" />
<l:task href="." icon="symbol-people" permission="${app.ADMINISTER}" title="${%Users}" />
<l:task href="addUser" icon="symbol-add" permission="${app.ADMINISTER}" title="${%Create User}" />
</l:tasks>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ def l = namespace(lib.LayoutTagLib)
def st = namespace("jelly:stapler")

l.layout(norefresh: true, permission: app.MANAGE, title: my.displayName) {
l.side_panel {
l.tasks {
l.task(icon: "icon-up icon-md", href: rootURL + '/', title: _("Back to Dashboard"))
l.task(icon: "symbol-settings", href: "${rootURL}/manage", title: _("Manage Jenkins"))
}
}
l.main_panel {
h1 {
text(Messages.ShutdownLink_DisplayName_prepare())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ l.layout(norefresh:true, permission:app.SYSTEM_READ, title:my.displayName) {
set("readOnlyMode", !app.hasPermission(app.ADMINISTER))
l.side_panel {
l.tasks {
l.task(icon:"icon-up icon-md", href:rootURL+'/', title:_("Back to Dashboard"))
l.task(icon:"symbol-settings", href: "../computer/", title:_("Manage Nodes"))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ 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">
<l:layout permissions="${app.MANAGE_AND_SYSTEM_READ}" title="${%Configure System}">
<l:layout permissions="${app.MANAGE_AND_SYSTEM_READ}" title="${%Configure System}" type="one-column">
<st:include page="sidepanel.jelly" />
<f:breadcrumb-config-outline title="${%Configure System}" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,7 @@ def f=namespace(lib.FormTagLib)
def l=namespace(lib.LayoutTagLib)
def st=namespace("jelly:stapler")

l.layout(permission:app.SYSTEM_READ, title:my.displayName) {
l.side_panel {
l.tasks {
l.task(icon:"icon-up icon-md", href:rootURL+'/', title:_("Back to Dashboard"))
l.task(icon:"symbol-settings", href:"${rootURL}/manage", title:_("Manage Jenkins"))
}
}
l.layout(permission:app.SYSTEM_READ, title:my.displayName, type:"one-column") {
l.app_bar(title: my.displayName)
set("readOnlyMode", !app.hasPermission(app.ADMINISTER))
l.main_panel {
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/lib/layout/layout.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ THE SOFTWARE.
</div>
</j:if>

<div id="page-body" class="clear">
<div id="page-body" class="app-page-body app-page-body--${layoutType} clear">
<j:if test="${layoutType=='two-column'}">
<div id="side-panel">
<j:set var="mode" value="side-panel" />
Expand Down
6 changes: 3 additions & 3 deletions test/src/test/java/hudson/model/RSSTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public void latestBuilds_AllView() throws Exception {
public void checkWithSingleBuild_Rss_All_Computer() throws Exception {
runSuccessfulBuild();

String pathPrefix = "computer/(built-in)/";
String pathPrefix = "manage/computer/(built-in)/";
String displayName = Messages.Hudson_Computer_DisplayName();
String buildType = ALL_BUILD_TYPE;
String buildTitle = STABLE_BUILD_TITLE;
Expand All @@ -195,7 +195,7 @@ public void checkWithSingleBuild_Rss_All_Computer() throws Exception {
public void checkWithSingleBuild_Rss_Failed_Computer() throws Exception {
runFailingBuild();

String pathPrefix = "computer/(built-in)/";
String pathPrefix = "manage/computer/(built-in)/";
String displayName = Messages.Hudson_Computer_DisplayName();
String buildType = FAILED_BUILD_TYPE;
String buildTitle = FAILED_BUILD_TITLE;
Expand All @@ -205,7 +205,7 @@ public void checkWithSingleBuild_Rss_Failed_Computer() throws Exception {

@Test
public void latestBuilds_Computer() throws Exception {
String pathPrefix = "computer/(built-in)/";
String pathPrefix = "manage/computer/(built-in)/";
String displayName = Messages.Hudson_Computer_DisplayName();
String buildType = LATEST_BUILD_TYPE;
int expectedLinks = 3;
Expand Down
20 changes: 20 additions & 0 deletions war/src/main/less/base/layout-commons.less
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,26 @@ body {
width: 100%;
}

.app-page-body--one-column {
--form-item-max-width: calc(85vw - 4rem);

max-width: 85vw;

#main-panel {
width: 100vw;
}

.jenkins-section {
max-width: unset;
}

@media (max-width: 1200px) {
max-width: unset;
}

margin: auto;
}

body.two-column #main-panel {
width: calc(100% - 320px);
flex: 1;
Expand Down

0 comments on commit 26c924b

Please sign in to comment.