Permalink
Browse files

Merge pull request #2828 from sathiya-mit/master

[JENKINS-42852] - Jenkins Configuration Save Option
  • Loading branch information...
oleg-nenashev committed Apr 7, 2017
2 parents 1ca9c88 + a7bcf1f commit 77804c145134d93b3ac0bd64d3181a2e21538fb7
@@ -27,6 +27,7 @@
import hudson.Extension;
import hudson.model.AdministrativeMonitor;
import jenkins.model.GlobalConfiguration;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
@@ -41,9 +42,15 @@
public class AdministrativeMonitorsConfiguration extends GlobalConfiguration {
@Override
public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
JSONArray monitors = json.optJSONArray("administrativeMonitor");
for (AdministrativeMonitor am : AdministrativeMonitor.all()) {
try {
boolean disable = !json.getJSONArray("administrativeMonitor").contains(am.id);
boolean disable;
if(monitors != null) {
disable = !monitors.contains(am.id);
}else {
disable = !am.id.equals(json.optString("administrativeMonitor"));
}
am.disable(disable);
} catch (IOException e) {
LOGGER.log(Level.WARNING, "Failed to process form submission for " + am.id, e);

0 comments on commit 77804c1

Please sign in to comment.