From 26c924b39d59f986e73156ba6f2c8a01afd789af Mon Sep 17 00:00:00 2001 From: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Mon, 15 Aug 2022 22:07:34 +0100 Subject: [PATCH] Remove hierarchy-related sidebar links (#6907) Co-authored-by: Jesse Glick Co-authored-by: Tim Jacomb Co-authored-by: Tim Jacomb <21194782+timja@users.noreply.github.com> Co-authored-by: Tim Jacomb --- .../main/java/hudson/model/AbstractBuild.java | 2 ++ core/src/main/java/hudson/model/Computer.java | 4 ++++ core/src/main/java/jenkins/model/Jenkins.java | 4 ++++ .../hudson/PluginManager/sidepanel.groovy | 5 ++--- .../hudson/PluginWrapper/uninstall.groovy | 6 ------ .../logging/LogRecorder/sidepanel.jelly | 1 - .../logging/LogRecorderManager/all.jelly | 6 +++--- .../LogRecorderManager/sidepanel.jelly | 3 --- .../hudson/model/AbstractBuild/tasks.jelly | 1 - .../model/AbstractProject/sidepanel.jelly | 8 -------- .../hudson/model/Computer/sidepanel.jelly | 1 - .../hudson/model/ComputerSet/sidepanel.jelly | 2 -- .../hudson/model/Fingerprint/index.jelly | 10 ++-------- .../hudson/model/Label/sidepanel.jelly | 1 - .../model/NoFingerprintMatch/index.jelly | 5 ----- .../hudson/model/UpdateCenter/sidepanel.jelly | 5 ++--- .../GlobalSecurityConfiguration/index.groovy | 8 +------- .../sidepanel.jelly | 2 -- .../management/ShutdownLink/index.groovy | 6 ------ .../GlobalCloudConfiguration/index.groovy | 1 - .../jenkins/model/Jenkins/configure.jelly | 2 +- .../GlobalToolConfiguration/index.groovy | 8 +------- .../main/resources/lib/layout/layout.jelly | 2 +- test/src/test/java/hudson/model/RSSTest.java | 6 +++--- war/src/main/less/base/layout-commons.less | 20 +++++++++++++++++++ 25 files changed, 46 insertions(+), 73 deletions(-) diff --git a/core/src/main/java/hudson/model/AbstractBuild.java b/core/src/main/java/hudson/model/AbstractBuild.java index e19a8b17a505..795564e70c15 100644 --- a/core/src/main/java/hudson/model/AbstractBuild.java +++ b/core/src/main/java/hudson/model/AbstractBuild.java @@ -271,7 +271,9 @@ public Queue.Executable getParentExecutable() { *

* 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()) + '/'; } diff --git a/core/src/main/java/hudson/model/Computer.java b/core/src/main/java/hudson/model/Computer.java index 2f47bfb5bce7..68cfa5e27033 100644 --- a/core/src/main/java/hudson/model/Computer.java +++ b/core/src/main/java/hudson/model/Computer.java @@ -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()) + "/"; } diff --git a/core/src/main/java/jenkins/model/Jenkins.java b/core/src/main/java/jenkins/model/Jenkins.java index 56dd8789ac37..54affaef3d3c 100644 --- a/core/src/main/java/jenkins/model/Jenkins.java +++ b/core/src/main/java/jenkins/model/Jenkins.java @@ -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)/"; } diff --git a/core/src/main/resources/hudson/PluginManager/sidepanel.groovy b/core/src/main/resources/hudson/PluginManager/sidepanel.groovy index 555a7bb42623..f117a48fb1a4 100644 --- a/core/src/main/resources/hudson/PluginManager/sidepanel.groovy +++ b/core/src/main/resources/hudson/PluginManager/sidepanel.groovy @@ -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")) } } } diff --git a/core/src/main/resources/hudson/PluginWrapper/uninstall.groovy b/core/src/main/resources/hudson/PluginWrapper/uninstall.groovy index b664ca20c436..d85fcc85c2a8 100644 --- a/core/src/main/resources/hudson/PluginWrapper/uninstall.groovy +++ b/core/src/main/resources/hudson/PluginWrapper/uninstall.groovy @@ -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 { diff --git a/core/src/main/resources/hudson/logging/LogRecorder/sidepanel.jelly b/core/src/main/resources/hudson/logging/LogRecorder/sidepanel.jelly index 928bc0633f97..05d90366d0bf 100644 --- a/core/src/main/resources/hudson/logging/LogRecorder/sidepanel.jelly +++ b/core/src/main/resources/hudson/logging/LogRecorder/sidepanel.jelly @@ -30,7 +30,6 @@ THE SOFTWARE. - diff --git a/core/src/main/resources/hudson/logging/LogRecorderManager/all.jelly b/core/src/main/resources/hudson/logging/LogRecorderManager/all.jelly index c13fd7923f22..29eb0c3f1706 100644 --- a/core/src/main/resources/hudson/logging/LogRecorderManager/all.jelly +++ b/core/src/main/resources/hudson/logging/LogRecorderManager/all.jelly @@ -27,10 +27,10 @@ THE SOFTWARE. --> - - + + -

${%Jenkins Log}

+

${%All Jenkins Logs}

Log messages at a level lower than INFO are never recorded in the Jenkins log. Use log recorders to record these log messages.
diff --git a/core/src/main/resources/hudson/logging/LogRecorderManager/sidepanel.jelly b/core/src/main/resources/hudson/logging/LogRecorderManager/sidepanel.jelly index f74a2e7234af..7ad34f9aa2f3 100644 --- a/core/src/main/resources/hudson/logging/LogRecorderManager/sidepanel.jelly +++ b/core/src/main/resources/hudson/logging/LogRecorderManager/sidepanel.jelly @@ -30,10 +30,7 @@ THE SOFTWARE. - - - diff --git a/core/src/main/resources/hudson/model/AbstractBuild/tasks.jelly b/core/src/main/resources/hudson/model/AbstractBuild/tasks.jelly index 84fb2b77c2d2..7cf0f9655cda 100644 --- a/core/src/main/resources/hudson/model/AbstractBuild/tasks.jelly +++ b/core/src/main/resources/hudson/model/AbstractBuild/tasks.jelly @@ -27,7 +27,6 @@ THE SOFTWARE. --> - diff --git a/core/src/main/resources/hudson/model/AbstractProject/sidepanel.jelly b/core/src/main/resources/hudson/model/AbstractProject/sidepanel.jelly index 28132fb64541..b626119021b7 100644 --- a/core/src/main/resources/hudson/model/AbstractProject/sidepanel.jelly +++ b/core/src/main/resources/hudson/model/AbstractProject/sidepanel.jelly @@ -37,14 +37,6 @@ THE SOFTWARE. - - - - - - - - diff --git a/core/src/main/resources/hudson/model/Computer/sidepanel.jelly b/core/src/main/resources/hudson/model/Computer/sidepanel.jelly index 60d269ec3ba9..897ac0531b02 100644 --- a/core/src/main/resources/hudson/model/Computer/sidepanel.jelly +++ b/core/src/main/resources/hudson/model/Computer/sidepanel.jelly @@ -30,7 +30,6 @@ THE SOFTWARE. - - - diff --git a/core/src/main/resources/hudson/model/Fingerprint/index.jelly b/core/src/main/resources/hudson/model/Fingerprint/index.jelly index e76741d3eebf..17dbfee019f1 100644 --- a/core/src/main/resources/hudson/model/Fingerprint/index.jelly +++ b/core/src/main/resources/hudson/model/Fingerprint/index.jelly @@ -28,12 +28,6 @@ THE SOFTWARE. - - - - - -

@@ -77,9 +71,9 @@ THE SOFTWARE. - + - + diff --git a/core/src/main/resources/hudson/model/Label/sidepanel.jelly b/core/src/main/resources/hudson/model/Label/sidepanel.jelly index 1f5dcc9af35c..aa0d462aad5e 100644 --- a/core/src/main/resources/hudson/model/Label/sidepanel.jelly +++ b/core/src/main/resources/hudson/model/Label/sidepanel.jelly @@ -31,7 +31,6 @@ THE SOFTWARE. - diff --git a/core/src/main/resources/hudson/model/NoFingerprintMatch/index.jelly b/core/src/main/resources/hudson/model/NoFingerprintMatch/index.jelly index 109a94a8113c..6dff2b8ce106 100644 --- a/core/src/main/resources/hudson/model/NoFingerprintMatch/index.jelly +++ b/core/src/main/resources/hudson/model/NoFingerprintMatch/index.jelly @@ -26,11 +26,6 @@ THE SOFTWARE. - - - - -

${title} diff --git a/core/src/main/resources/hudson/model/UpdateCenter/sidepanel.jelly b/core/src/main/resources/hudson/model/UpdateCenter/sidepanel.jelly index ec0931b33e3f..7254e2214b91 100644 --- a/core/src/main/resources/hudson/model/UpdateCenter/sidepanel.jelly +++ b/core/src/main/resources/hudson/model/UpdateCenter/sidepanel.jelly @@ -30,9 +30,8 @@ THE SOFTWARE. - - - + + diff --git a/core/src/main/resources/hudson/security/GlobalSecurityConfiguration/index.groovy b/core/src/main/resources/hudson/security/GlobalSecurityConfiguration/index.groovy index d44328b31d79..f02d423a9401 100644 --- a/core/src/main/resources/hudson/security/GlobalSecurityConfiguration/index.groovy +++ b/core/src/main/resources/hudson/security/GlobalSecurityConfiguration/index.groovy @@ -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 { diff --git a/core/src/main/resources/hudson/security/HudsonPrivateSecurityRealm/sidepanel.jelly b/core/src/main/resources/hudson/security/HudsonPrivateSecurityRealm/sidepanel.jelly index a48380643e7d..d2eb00241851 100644 --- a/core/src/main/resources/hudson/security/HudsonPrivateSecurityRealm/sidepanel.jelly +++ b/core/src/main/resources/hudson/security/HudsonPrivateSecurityRealm/sidepanel.jelly @@ -27,8 +27,6 @@ THE SOFTWARE. - - diff --git a/core/src/main/resources/jenkins/management/ShutdownLink/index.groovy b/core/src/main/resources/jenkins/management/ShutdownLink/index.groovy index a7816646f2a2..30c625ac19bd 100644 --- a/core/src/main/resources/jenkins/management/ShutdownLink/index.groovy +++ b/core/src/main/resources/jenkins/management/ShutdownLink/index.groovy @@ -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()) diff --git a/core/src/main/resources/jenkins/model/GlobalCloudConfiguration/index.groovy b/core/src/main/resources/jenkins/model/GlobalCloudConfiguration/index.groovy index 341138d2462b..5f941c2eea3b 100644 --- a/core/src/main/resources/jenkins/model/GlobalCloudConfiguration/index.groovy +++ b/core/src/main/resources/jenkins/model/GlobalCloudConfiguration/index.groovy @@ -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")) } } diff --git a/core/src/main/resources/jenkins/model/Jenkins/configure.jelly b/core/src/main/resources/jenkins/model/Jenkins/configure.jelly index 10e15136cda4..fdbb484c0dfb 100644 --- a/core/src/main/resources/jenkins/model/Jenkins/configure.jelly +++ b/core/src/main/resources/jenkins/model/Jenkins/configure.jelly @@ -27,7 +27,7 @@ THE SOFTWARE. --> - + diff --git a/core/src/main/resources/jenkins/tools/GlobalToolConfiguration/index.groovy b/core/src/main/resources/jenkins/tools/GlobalToolConfiguration/index.groovy index 5caf8fc8080d..a1f25af03a9b 100644 --- a/core/src/main/resources/jenkins/tools/GlobalToolConfiguration/index.groovy +++ b/core/src/main/resources/jenkins/tools/GlobalToolConfiguration/index.groovy @@ -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 { diff --git a/core/src/main/resources/lib/layout/layout.jelly b/core/src/main/resources/lib/layout/layout.jelly index b39f3ed3f863..ce0ec530e545 100644 --- a/core/src/main/resources/lib/layout/layout.jelly +++ b/core/src/main/resources/lib/layout/layout.jelly @@ -188,7 +188,7 @@ THE SOFTWARE. -
+
diff --git a/test/src/test/java/hudson/model/RSSTest.java b/test/src/test/java/hudson/model/RSSTest.java index 7868722235d8..31951fc98ffd 100644 --- a/test/src/test/java/hudson/model/RSSTest.java +++ b/test/src/test/java/hudson/model/RSSTest.java @@ -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; @@ -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; @@ -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; diff --git a/war/src/main/less/base/layout-commons.less b/war/src/main/less/base/layout-commons.less index 2efbaead66ad..6dc72bd04553 100644 --- a/war/src/main/less/base/layout-commons.less +++ b/war/src/main/less/base/layout-commons.less @@ -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;