[JENKINS-38187] Fixes @daniel-beck reviews

上级 5cff734b
...@@ -1220,6 +1220,7 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve ...@@ -1220,6 +1220,7 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve
} }
@Extension @Extension
@Restricted(NoExternalUse.class)
public static class EnforceSlaveAgentPortAdministrativeMonitor extends AdministrativeMonitor { public static class EnforceSlaveAgentPortAdministrativeMonitor extends AdministrativeMonitor {
@Inject @Inject
Jenkins j; Jenkins j;
...@@ -1234,15 +1235,8 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve ...@@ -1234,15 +1235,8 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve
return Jenkins.getSlaveAgentPortInitialValue(slaveAgentPort); return Jenkins.getSlaveAgentPortInitialValue(slaveAgentPort);
} }
public String getExpectedPortString() {
return Integer.toString(getExpectedPort());
}
/**
* Depending on whether the user said "yes" or "no", send him to the right place.
*/
public void doAct(StaplerRequest req, StaplerResponse rsp) throws IOException { public void doAct(StaplerRequest req, StaplerResponse rsp) throws IOException {
if (req.hasParameter("fix")) { if (req.hasParameter("reset")) {
j.setSlaveAgentPort(getExpectedPort()); j.setSlaveAgentPort(getExpectedPort());
} }
rsp.sendRedirect2(req.getContextPath() + "/manage"); rsp.sendRedirect2(req.getContextPath() + "/manage");
......
<!-- <!--
The MIT License The MIT License
Copyright (c) 2016, CloudBees Copyright (c) 2016, CloudBees, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
...@@ -24,10 +24,10 @@ THE SOFTWARE. ...@@ -24,10 +24,10 @@ THE SOFTWARE.
<?jelly escape-by-default='true'?> <?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"> <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="warning"> <div class="warning">
${%description(it.expectedPortString)} ${%description(it.expectedPort)}
<form method="post" action="${rootURL}/${it.url}/act" name="${it.id}"> <form method="post" action="${rootURL}/${it.url}/act" name="${it.id}">
<div style="float:right"> <div style="float:right">
<f:submit name="fix" value="${%Fix}"/> <f:submit name="reset" value="${%reset(it.expectedPort)}"/>
</div> </div>
</form> </form>
</div> </div>
......
description=Slave Agent Port has been manually changed. Its value will be reset to {0} on restart. description=Slave Agent Port has been manually changed. Its value will be reset to {0,number,#} on restart.
reset=Reset to {0,number,#}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册