Skip to content

Commit

Permalink
[fixed JENKINS-61519] Odd rendering of Monitoring of Jenkins master p…
Browse files Browse the repository at this point in the history
…lugin in Manage Jenkins screen
  • Loading branch information
evernat committed Jul 12, 2020
1 parent 2ceba97 commit 58180cd
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
* Copyright 2008-2019 by Emeric Vernat
*
* This file is part of the Monitoring plugin.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jvnet.hudson.plugins.monitoring;

import org.kohsuke.stapler.Stapler;
import org.kohsuke.stapler.StaplerRequest;

import hudson.Extension;
import hudson.model.ManagementLink;

/**
* {@link ManagementLink} of the plugin to add a link in the "/manage" page, for the agents next to the one for the master.
* @author Emeric Vernat
*/
@Extension(ordinal = Integer.MAX_VALUE - 491)
public class NodesManagementLink extends ManagementLink {
/**
* Mostly works like {@link hudson.model.Action#getIconFileName()}, except
* that the expected icon size is 48x48, not 24x24. So if you give just a
* file name, "/images/48x48" will be assumed.
* @return As a special case, return null to exclude this object from the
* management link. This is useful for defining
* {@link ManagementLink} that only shows up under certain
* circumstances.
*/
@Override
public String getIconFileName() {
return "monitor.gif";
}

/**
* Returns a short description of what this link does. This text is the one
* that's displayed in grey. This can include HTML, although the use of
* block tags is highly discouraged.
* Optional.
*/
@Override
public String getDescription() {
return "Monitoring of builds, build queue and Jenkins agents.";
}

/**
* Gets the string to be displayed.
* The convention is to capitalize the first letter of each word, such as
* "Test Result".
*/
@Override
public String getDisplayName() {
return "Monitoring of Jenkins agents";
}

/** {@inheritDoc} */
@Override
public String getUrlName() {
final StaplerRequest req = Stapler.getCurrentRequest();
if (req != null) {
return req.getContextPath() + "/monitoring/nodes";
}
return "/monitoring/nodes";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* {@link ManagementLink} of the plugin to add a link in the "/manage" page.
* @author Emeric Vernat
*/
@Extension
@Extension(ordinal = Integer.MAX_VALUE - 490)
public class PluginManagementLink extends ManagementLink {
/**
* Mostly works like {@link hudson.model.Action#getIconFileName()}, except
Expand All @@ -51,8 +51,7 @@ public String getIconFileName() {
*/
@Override
public String getDescription() {
return "Monitoring of memory, cpu, http requests and more in Jenkins master."
+ "<a href='./monitoring/nodes'>You can also view the monitoring of builds, build queue and Jenkins nodes.</a>";
return "Monitoring of memory, cpu, http requests and more in Jenkins master.";
}

/**
Expand Down

0 comments on commit 58180cd

Please sign in to comment.