Skip to content

Commit

Permalink
[JENKINS-73114] avoid conflicts with css classes from bootstrap (jenk…
Browse files Browse the repository at this point in the history
…insci#9254)

* [JENKINS-73114] avoid conflict of css classes with bootstrap

jenkins and bootstrap both have definitions for alert and alert-warning,
alert-info, alert-danger. Bootstrap css definitions are included when
e.g. the warning-ng plugin is installed and a job is configured to scan
for warnings. The css classes from bootstrap are then chosen instead of
the ones for Jenkins for things like the admin monitors.
To make things umambiguous, add additional classes prefixed with
`jenkins-` and make use of them in code. Keep the old definitions for
backward compatibility with plugins.
Followup changes are needed in plugins (Mostly those that define admin
monitors) and the design-library

* fix test

(cherry picked from commit 90a6ac5)
  • Loading branch information
mawinter69 authored and krisstern committed May 24, 2024
1 parent c0f2012 commit b87adb7
Show file tree
Hide file tree
Showing 55 changed files with 276 additions and 109 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,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">
<div class="alert alert-danger">
<div class="jenkins-alert jenkins-alert-danger">
<dl>
<dt>${%PluginCycles}</dt>
<j:forEach var="p" items="${it.pluginsWithCycle}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,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">
<div class="alert alert-warning">
<div class="jenkins-alert jenkins-alert-warning">
<dl>
<dt>${%DeprecatedPlugins}</dt>
<j:forEach var="e" items="${it.getDeprecatedPlugins()}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,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">
<div class="alert alert-danger">
<div class="jenkins-alert jenkins-alert-danger">
<dl>
<dt>${%RequiredPluginUpdates}</dt>
<j:forEach var="p" items="${it.pluginsToBeUpdated}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ THE SOFTWARE.
<l:main-panel>
<l:app-bar title="${%Advanced settings}"/>

<div class="alert alert-info">
<div class="jenkins-alert jenkins-alert-info">
<strong>${%proxyMovedBlurb(rootURL+"/manage/configure")}</strong>
</div>

Expand Down
10 changes: 5 additions & 5 deletions core/src/main/resources/hudson/PluginManager/installed.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ THE SOFTWARE.
data-is-restart-required="${app.updateCenter.isRestartRequiredForCompletion()}" />

<j:if test="${app.updateCenter.isRestartRequiredForCompletion()}">
<div class="alert alert-warning"><strong>${%Warning}</strong>: ${%requires.restart}</div>
<div class="jenkins-alert jenkins-alert-warning"><strong>${%Warning}</strong>: ${%requires.restart}</div>
</j:if>

<template id="i18n"
Expand Down Expand Up @@ -130,7 +130,7 @@ THE SOFTWARE.
</div>
</j:if>
<j:if test="${!p.getActiveWarnings().isEmpty()}">
<div class="alert alert-danger">${%securityWarning}
<div class="jenkins-alert jenkins-alert-danger">${%securityWarning}
<ul>
<j:forEach var="warning" items="${p.getActiveWarnings()}">
<li>
Expand All @@ -143,13 +143,13 @@ THE SOFTWARE.
</div>
</j:if>
<j:if test="${p.isDeprecated()}">
<div class="alert alert-warning">
<div class="jenkins-alert jenkins-alert-warning">
<!-- figure out a way how to present deprecations by multiple update sites instead of just the first one -->
${%deprecationWarning(p.getDeprecations().get(0).url)}
</div>
</j:if>
<j:if test="${it.hasAdoptThisPluginLabel(p)}">
<div class="alert alert-warning jenkins-!-margin-top-1 jenkins-!-margin-bottom-0">
<div class="jenkins-alert jenkins-alert-warning jenkins-!-margin-top-1 jenkins-!-margin-bottom-0">
${%adoptThisPlugin}
</div>
</j:if>
Expand Down Expand Up @@ -250,7 +250,7 @@ THE SOFTWARE.
${p.name}
</div>
</j:if>
<div class="alert alert-danger jenkins-!-margin-top-1 jenkins-!-margin-bottom-0">
<div class="jenkins-alert jenkins-alert-danger jenkins-!-margin-top-1 jenkins-!-margin-bottom-0">
<pre>${p.cause.message}</pre>
</div>
</td>
Expand Down
16 changes: 8 additions & 8 deletions core/src/main/resources/hudson/PluginManager/updates.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ THE SOFTWARE.
</div>
</j:if>
<j:if test="${!p.isCompatibleWithInstalledVersion()}">
<div class="alert alert-danger">${%compatWarning}
<div class="jenkins-alert jenkins-alert-danger">${%compatWarning}
<j:if test="${p.hasIncompatibleParentPlugins()}">
<br/>${%parentCompatWarning}
<ul>
Expand All @@ -153,15 +153,15 @@ THE SOFTWARE.
</div>
</j:if>
<j:if test="${p.isForNewerHudson()}">
<div class="alert alert-danger">${%coreWarning(p.requiredCore)}</div>
<div class="jenkins-alert jenkins-alert-danger">${%coreWarning(p.requiredCore)}</div>
</j:if>
<j:if test="${p.fixesSecurityVulnerabilities()}">
<div class="alert alert-warning">
<div class="jenkins-alert jenkins-alert-warning">
${%Applying this update will address security vulnerabilities in the currently installed version.}
</div>
</j:if>
<j:if test="${!p.isNeededDependenciesCompatibleWithInstalledVersion(cache)}">
<div class="alert alert-danger">${%depCompatWarning}
<div class="jenkins-alert jenkins-alert-danger">${%depCompatWarning}
<br/>${%parentDepCompatWarning}
<ul>
<j:forEach var="d"
Expand All @@ -177,12 +177,12 @@ THE SOFTWARE.
</div>
</j:if>
<j:if test="${p.isNeededDependenciesForNewerJenkins(cache)}">
<div class="alert alert-danger">
<div class="jenkins-alert jenkins-alert-danger">
${%depCoreWarning(p.getNeededDependenciesRequiredCore().toString())}
</div>
</j:if>
<j:if test="${p.hasWarnings()}">
<div class="alert alert-danger">${%securityWarning}
<div class="jenkins-alert jenkins-alert-danger">${%securityWarning}
<ul>
<j:forEach var="warning" items="${p.getWarnings()}">
<li>
Expand All @@ -195,12 +195,12 @@ THE SOFTWARE.
</div>
</j:if>
<j:if test="${p.isDeprecated()}">
<div class="alert alert-warning">
<div class="jenkins-alert jenkins-alert-warning">
${%deprecationWarning(p.getDeprecation().url)}
</div>
</j:if>
<j:if test="${it.hasAdoptThisPluginLabel(p)}">
<div class="alert alert-warning">
<div class="jenkins-alert jenkins-alert-warning">
${%adoptThisPlugin}
</div>
</j:if>
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:f="/lib/form">
<div class="alert alert-danger" role="alert">
<div class="jenkins-alert jenkins-alert-danger" role="alert">
<form method="post" action="${rootURL}/${it.url}/act" name="${it.id}">
<f:submit name="correct" value="${%Correct}"/>
</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,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">
<div class="alert alert-warning">
<div class="jenkins-alert jenkins-alert-warning">
<form method="post" action="${rootURL}/${it.url}/act" name="${it.id}">
<f:submit name="yes" value="${%Tell me more}"/>
<f:submit name="no" value="${%Dismiss}"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,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">
<div class="alert alert-danger">
<div class="jenkins-alert jenkins-alert-danger">
<dl>
<dt>${%blurb}</dt>
<j:forEach var="d" items="${it.problems}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,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">
<div class="alert alert-warning">
<div class="jenkins-alert jenkins-alert-warning">
<form method="post" action="${rootURL}/${it.url}/act" name="${it.id}">
<f:submit name="yes" value="${%Manage}"/>
<f:submit name="no" value="${%Dismiss}"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:f="/lib/form" xmlns:l="/lib/layout">
<div id="redirect-error" class="alert alert-danger reverse-proxy__hidden"
<div id="redirect-error" class="jenkins-alert jenkins-alert-danger reverse-proxy__hidden"
data-url="${rootURL}/${it.url}/test" data-context="${rootURL}">
<form method="post" action="${rootURL}/${it.url}/act" name="${it.id}">
<f:submit name="yes" value="${%More Info}"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,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">
<div id="tooManyJobsButNoView" class="alert alert-warning">
<div id="tooManyJobsButNoView" class="jenkins-alert jenkins-alert-warning">
<l:isAdmin>
<form method="post" action="${rootURL}/${it.url}/act" name="${it.id}">
<f:submit name="yes" value="${%Create a view now}"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ THE SOFTWARE.
</l:app-bar>

<f:form method="post" name="config" action="configSubmit">
<div class="alert alert-info jenkins-form-item">
<div class="jenkins-alert jenkins-alert-info jenkins-form-item">
${%fine_warning}
</div>
<j:set var="instance" value="${it}" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ THE SOFTWARE.
</l:overflowButton>
</l:app-bar>

<div class="alert alert-info">
<div class="jenkins-alert jenkins-alert-info">
Log messages at a level more verbose than INFO (i.e., CONFIG, FINE, FINER, FINEST) are never recorded in the Jenkins log. Use <a href=".">log recorders</a> to record these log messages.
</div>
<t:logRecords logRecords="${h.logRecords}"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,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">
<div class="alert alert-info">
<div class="jenkins-alert jenkins-alert-info">
<j:set var="ucData" value="${it.data}" />
<j:set var="upJob" value="${app.updateCenter.hudsonJob}" />
<j:choose>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,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">
<div class="alert alert-warning">
<div class="jenkins-alert jenkins-alert-warning">
<form method="post" action="${rootURL}/${it.url}/disable">
<f:submit value="${%Dismiss}"/>
</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ THE SOFTWARE.

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:t="/lib/hudson">
<div class="alert alert-warning">
<div class="jenkins-alert jenkins-alert-warning">
${%blurb(rootURL)}
</div>
</j:jelly>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import org.apache.commons.jelly.tags.fmt.FmtTagLibrary
SlowTriggerAdminMonitor tam = my

dl {
div(class: "alert alert-warning") {
div(class: "jenkins-alert jenkins-alert-warning") {
form(method: "post", name: "clear", action: rootURL + "/" + tam.url + "/clear") {
input(name: "clear", type: "submit", value: _("Dismiss"), class: "submit-button primary")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,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">
<div class="alert alert-danger">
<div class="jenkins-alert jenkins-alert-danger">
<j:out value="${it.message}"/>
<a href="${rootURL}/${it.url}/">${%See the log for more details}</a>.
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,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" xmlns:i="jelly:fmt">
<div class="alert alert-warning">
<div class="jenkins-alert jenkins-alert-warning">
<p>
${%message(it.home)}
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,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">
<div class="alert alert-danger">
<div class="jenkins-alert jenkins-alert-danger">
${%blurb(rootURL+'/'+it.url)}
</div>
</j:jelly>
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:t="/lib/hudson" xmlns:f="/lib/form">
<div class="alert alert-warning">
<div class="jenkins-alert jenkins-alert-warning">
${%blurb(app.initLevel)}
${%Example: usage of} <code>@Initializer(after = InitMilestone.COMPLETED)</code> ${%in a plugin}
(<a href="https://www.jenkins.io/redirect/troubleshooting/initialization-not-completed" rel="noopener noreferrer" target="_blank">${%See documentation}</a>).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,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">
<div class="alert alert-warning">
<div class="jenkins-alert jenkins-alert-warning">
<form method="post" action="${rootURL}/${it.url}/act" name="${it.id}">
<f:submit name="yes" value="${%Manage}"/>
<f:submit name="no" value="${%Dismiss}"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,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">
<div class="alert alert-warning">
<div class="jenkins-alert jenkins-alert-warning">
<form method="post" action="${rootURL}/${it.url}/act" name="${it.id}">
<f:submit name="agent" value="${%Set up agent}"/>
<f:submit name="cloud" value="${%Set up cloud}"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form" xmlns:l="/lib/layout">
<div class="alert alert-warning">
<div class="jenkins-alert jenkins-alert-warning">
<l:isAdmin>
<form method="post" action="${rootURL}/${it.url}/disable">
<f:submit value="${%Dismiss}"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,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">
<div class="alert alert-warning">
<div class="jenkins-alert jenkins-alert-warning">
<form method="post" action="${rootURL}/${it.url}/act" name="${it.id}">
<f:submit name="yes" value="${%Setup Security}"/>
<f:submit name="no" value="${%Dismiss}"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<p>${%jenkins.install.findSecurityTokenMessage(it.initialAdminPasswordFile)}</p>
<p>${%authenticate-security-token.copy.password}</p>
<j:if test="${error}">
<div class="alert alert-danger">
<div class="jenkins-alert jenkins-alert-danger">
<strong>${%authenticate-security-token.error}</strong> ${%authenticate-security-token.password.incorrect}
</div>
</j:if>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ installWizard_installIncomplete_message=Jenkins was restarted during installatio
installWizard_installIncomplete_resumeInstallationButtonLabel=Resume
installWizard_saveFirstUser=Save and Continue
installWizard_skipFirstUser=Skip and continue as admin
installWizard_firstUserSkippedMessage=<div class="alert alert-warning fade in">\
installWizard_firstUserSkippedMessage=<div class="jenkins-alert jenkins-alert-warning fade in">\
You have skipped the <strong>setup of an admin user</strong>. <br /><br />\
To log in, use the username: "admin" and the administrator password you used to access the setup wizard.\
</div>
Expand All @@ -76,7 +76,7 @@ installWizard_addFirstUser_title=Getting Started
installWizard_configureInstance_title=Instance Configuration
installWizard_saveConfigureInstance=Save and Finish
installWizard_skipConfigureInstance=Not now
installWizard_configureInstanceSkippedMessage=<div class="alert alert-warning fade in">\
installWizard_configureInstanceSkippedMessage=<div class="jenkins-alert jenkins-alert-warning fade in">\
You have skipped the configuration of the Jenkins URL. <br/><br/>\
To configure the Jenkins URL, go to "Manage Jenkins" page.\
</div>
Expand All @@ -103,7 +103,7 @@ installWizard_pluginsInstalled_banner=Welcome to Jenkins {0}!
installWizard_upgradeComplete_message=Congratulations! You have upgraded to Jenkins {0}.</p><p>To learn more about its great new features, visit <a rel="noopener noreferrer" target="_blank" href="https://www.jenkins.io/2.0/">the Jenkins website</a>!
installWizard_upgradeSkipped_title=Upgrade
installWizard_upgradeSkipped_banner=Features Not Installed
installWizard_upgradeSkipped_message=<div class="alert alert-warning fade in">Suggested plugins will not be installed.</div> \
installWizard_upgradeSkipped_message=<div class="jenkins-alert jenkins-alert-warning fade in">Suggested plugins will not be installed.</div> \
<p style="padding: 0 4px">You can also install new features from the Plugin Manager, if you change your mind.</p> \
<p style="padding: 0 4px">Learn how these new features can improve your Jenkins experience by \
<a rel="noopener noreferrer" target="_blank" href="https://www.jenkins.io/2.0/">visiting the homepage</a>.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ certains plugins n\'ont pas l\'air d\'avoir été installés.
installWizard_installIncomplete_resumeInstallationButtonLabel=Reprendre
installWizard_saveFirstUser=Sauver et continuer
installWizard_skipFirstUser=Continuer en tant qu\'Administrateur
installWizard_firstUserSkippedMessage=<div class="alert alert-warning fade in">\
installWizard_firstUserSkippedMessage=<div class="jenkins-alert jenkins-alert-warning fade in">\
Vous avez passé la <strong>création d\'un utilisateur administrateur</strong>. <br /><br />\
Pour vous connecter, utilisez le login : "admin" et le mot de passe administrateur que vous avez utilisé pour accéder au \
wizard d\'installation.</div>
installWizard_addFirstUser_title=Démarrage

# instance configuration page
installWizard_configureInstance_title=Démarrage
installWizard_configureInstanceSkippedMessage=<div class="alert alert-warning fade in">\
installWizard_configureInstanceSkippedMessage=<div class="jenkins-alert jenkins-alert-warning fade in">\
Vous avez passé la <strong>configuration de l\'instance</strong>. <br /><br /> \
Vous pouvez toujours vous rendre sur les pages de configuration pour remplir les informations qui pourraient manquer.\
</div>
Expand Down
Loading

0 comments on commit b87adb7

Please sign in to comment.