Skip to content
Permalink
Browse files

[JENKINS-44608] Don't check for monitor activation if it is disabled

  • Loading branch information...
andresrc committed Jun 1, 2017
1 parent fb5c899 commit ce07ccbcd74cb9954c54137af8268e00629f7363
@@ -78,8 +78,7 @@ public int getActiveAdministrativeMonitorsCount() {

public Collection<AdministrativeMonitor> getActiveAdministrativeMonitors() {
Collection<AdministrativeMonitor> active = new ArrayList<>();
Collection<AdministrativeMonitor> ams = new ArrayList<>(Jenkins.getInstance().administrativeMonitors);
for (AdministrativeMonitor am : ams) {
for (AdministrativeMonitor am : Jenkins.getInstance().getActiveAdministrativeMonitors()) {
if (am instanceof ReverseProxySetupMonitor) {
// TODO make reverse proxy monitor work when shown on any URL
continue;
@@ -88,9 +87,7 @@ public int getActiveAdministrativeMonitorsCount() {
// TODO make URI encoding monitor work when shown on any URL
continue;
}
if (am.isEnabled() && am.isActivated()) {
active.add(am);
}
active.add(am);
}
return active;
}
@@ -288,6 +288,7 @@
import java.util.logging.LogRecord;
import java.util.logging.Logger;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

import static hudson.Util.*;
import static hudson.init.InitMilestone.*;
@@ -2172,6 +2173,13 @@ public AdministrativeMonitor getAdministrativeMonitor(String id) {
return null;
}

/**
* Returns the enabled and activated administrative monitors.
*/
public List<AdministrativeMonitor> getActiveAdministrativeMonitors() {
return administrativeMonitors.stream().filter(m -> m.isEnabled() && m.isActivated()).collect(Collectors.toList());
}

public NodeDescriptor getDescriptor() {
return DescriptorImpl.INSTANCE;
}
@@ -60,10 +60,8 @@ THE SOFTWARE.
<l:main-panel>
<h1>${%Manage Jenkins}</h1>

<j:forEach var="am" items="${app.administrativeMonitors}">
<j:if test="${am.isActivated() and am.isEnabled()}">
<st:include page="message.jelly" it="${am}" />
</j:if>
<j:forEach var="am" items="${app.activeAdministrativeMonitors}">
<st:include page="message.jelly" it="${am}" />
</j:forEach>

<st:include page="downgrade.jelly" />

0 comments on commit ce07ccb

Please sign in to comment.
You can’t perform that action at this time.