Back to blog

Overhaul of Manage Jenkins page

Manuel Recena
January 21, 2018

Overview

Recently some UI improvements around the Manage Jenkins page have been introduced. The visual changes are very subtle but behind them, there are interesting benefits.

Some of the goals that we have tried to achieve:

  • Applying a semantic HTML

  • Removing the <table> tag usage for implementing layouts and content structures. Read this article if you want to know reasons and/or arguments.

  • Small re-styling focused on spacing, margins, composition, etc..

  • Accessibility

In order to provide a quick overview of the visual changes, let’s take a look at these screenshots.

System tray with administrative messages (before)

JENKINS 43786 3 before

System tray with administrative messages (after)

JENKINS 43786 2

Manage Jenkins page (before)

JENKINS 43786 4 before

Manage Jenkins page (after)

JENKINS 43786 1

Information about how this change can affect the current implementations of Administrative Monitors can be found in the following section

For core developers

Let’s use a real example for showing how this proposal works.

This is the original UI implementation of HudsonHomeDiskUsageMonitor.java:

<?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="warning">
    <form method="post" action="${rootURL}/${it.url}/act" name="${it.id}">
      <div style="float:right">
        <f:submit name="yes" value="${%Tell me more}"/>
        <f:submit name="no" value="${%Dismiss}"/>
      </div>
      ${%blurb(app.rootDir)}
    </form>
  </div>
</j:jelly>

And this is the proposed change:

<?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">
  <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}"/>
  </form>
  ${%blurb(app.rootDir)}
</div>
</j:jelly>

Some highlights:

  • No more ad hoc UI compositions

  • No more custom CSS classes when Jenkins project is already using Bootstrap for many different things

  • Based on Bootstrap Alert

All administrative monitors defined in Jenkins core have been adapted as part of this proposal.

For plugin developers

No changes are really needed, but we do recommend you to adapt your plugins to this proposal so Jenkins users have a better user experience.

Taking into account that you want to keep backward compatibility, you will need some changes.

In your implementation of Administrative Monitor, add this helper method:

/**
 * This method can be removed when the baseline is updated to 2.103
 *
 * @return If this version of the plugin is running on a Jenkins version where JENKINS-43786 is included.
 */
 @Restricted(DoNotUse.class)
 public boolean isTheNewDesignAvailable() {
    if (Jenkins.getVersion().isNewerThan(new VersionNumber("2.103"))) {
        return true;
    }
    return false;
}

In your view (a.k.a. Jelly file or Groovy file):

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core">

<j:if test="${!it.isTheNewDesignAvailable}">
<div class="warning">
  <p>SSH Host Key Verifiers are not configured for all SSH agents on this Jenkins instance. This could leave these agents open to man-in-the-middle attacks. <a href="${rootURL}/computer/">Update your agent configuration</a> to resolve this.</p>
</div>
</j:if>

<j:if test="${it.isTheNewDesignAvailable}">
<div class="alert alert-warning">
    SSH Host Key Verifiers are not configured for all SSH agents on this Jenkins instance. This could leave these agents open to man-in-the-middle attacks. <a href="${rootURL}/computer/">Update your agent configuration</a> to resolve this.
</div>
</j:if>

</j:jelly>

If you don’t want to keep a strict backward compatibility, the impact is minimal. In fact, you can see an example on GitHub Plugin.

Some helpful references:

Do not hesitate to ping me if you decide to adapt your Administrative Monitors.

About the author

Manuel Recena

This author has no biography defined. See social media links referenced below.