Skip to content

Commit

Permalink
experimental flag to run Jenkins without YUI
Browse files Browse the repository at this point in the history
The YUI library is old and no longer maintained.

Add a user experimental flag to disable YUI. It's disabled by default.
When enabling all the YUI related js libraries and css classes are not
loaded.

Following PR are required to get Jenkins to not show any errors

eventually jenkinsci#7569

Some plugins that use YUI (not complete):
credentials
ldap
global-build-stats
build-monitor
categorized-view

Plugins that make use of makeButton (not complete)
credentials (fixed with jenkinsci/credentials-plugin#533)
openid

acceptance-test-harness
  • Loading branch information
mawinter69 committed Jul 20, 2024
1 parent 9e629f6 commit e1a55b2
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package jenkins.model.experimentalflags;

import edu.umd.cs.findbugs.annotations.Nullable;
import hudson.Extension;

@Extension
public class RemoveYuiUserExperimentalFlag extends BooleanUserExperimentalFlag {
public RemoveYuiUserExperimentalFlag() {
super("remove-vui.flag");
}

@Override
public String getDisplayName() {
return "Remove YUI";
}

@Nullable
@Override
public String getShortDescription() {
return "Remove YUI from all Jenkins UI pages. This will break anything that depends on YUI";
}
}
47 changes: 26 additions & 21 deletions core/src/main/resources/lib/layout/layout.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -128,31 +128,36 @@ THE SOFTWARE.

<st:adjunct includes="org.kohsuke.stapler.bind"/>

<!-- To use the debug version of YUI, set the system property 'debug.YUI' to true -->
<j:set var="yuiSuffix" value="${h.yuiSuffix}" />
<l:yui module="yahoo" />
<l:yui module="dom" />
<l:yui module="event" />
<j:if test="${h.yuiSuffix=='debug'}">
<l:yui module="logger" />
<l:userExperimentalFlag var="removeYUI" flagClassName="jenkins.model.experimentalflags.RemoveYuiUserExperimentalFlag" />
<j:if test="${!removeYUI}">
<!-- To use the debug version of YUI, set the system property 'debug.YUI' to true -->
<j:set var="yuiSuffix" value="${h.yuiSuffix}" />
<l:yui module="yahoo" />
<l:yui module="dom" />
<l:yui module="event" />
<j:if test="${h.yuiSuffix=='debug'}">
<l:yui module="logger" />
</j:if>
<l:yui module="animation" />
<l:yui module="dragdrop" />
<l:yui module="container" />
<l:yui module="connection" />
<l:yui module="datasource" />
<l:yui module="autocomplete" />
<l:yui module="menu" />
<l:yui module="element" />
<l:yui module="button" />
<l:yui module="storage" />
</j:if>
<l:yui module="animation" />
<l:yui module="dragdrop" />
<l:yui module="container" />
<l:yui module="connection" />
<l:yui module="datasource" />
<l:yui module="autocomplete" />
<l:yui module="menu" />
<l:yui module="element" />
<l:yui module="button" />
<l:yui module="storage" />

<script src="${resURL}/scripts/hudson-behavior.js" type="text/javascript"></script>
<script src="${resURL}/scripts/sortable.js" type="text/javascript"/>

<link rel="stylesheet" href="${resURL}/scripts/yui/container/assets/container.css" type="text/css"/>
<link rel="stylesheet" href="${resURL}/scripts/yui/container/assets/skins/sam/container.css" type="text/css"/>
<link rel="stylesheet" href="${resURL}/scripts/yui/menu/assets/skins/sam/menu.css" type="text/css" />
<j:if test="${!removeYUI}">
<link rel="stylesheet" href="${resURL}/scripts/yui/container/assets/container.css" type="text/css"/>
<link rel="stylesheet" href="${resURL}/scripts/yui/container/assets/skins/sam/container.css" type="text/css"/>
<link rel="stylesheet" href="${resURL}/scripts/yui/menu/assets/skins/sam/menu.css" type="text/css" />
</j:if>

<l:hasPermission permission="${app.READ}">
<link rel="search" type="application/opensearchdescription+xml" href="${rootURL}/opensearch.xml" title="Jenkins" />
Expand All @@ -173,7 +178,7 @@ THE SOFTWARE.
<script src="${resURL}/jsbundles/sortable-drag-drop.js" type="text/javascript"/>
<script src="${resURL}/jsbundles/app.js" type="text/javascript" defer="true" />
</head>
<body id="jenkins" class="yui-skin-sam ${layoutType} jenkins-${h.version}" data-version="${h.version}" data-model-type="${it.class.name}">
<body id="jenkins" class="${removeYUI ? '' : 'yui-skin-sam'} ${layoutType} jenkins-${h.version}" data-version="${h.version}" data-model-type="${it.class.name}">

<j:if test="${layoutType!='full-screen'}">
<!-- for accessibility, skip the entire navigation bar and etc and go straight to the head of the content -->
Expand Down

0 comments on commit e1a55b2

Please sign in to comment.