Skip to content

Commit

Permalink
Using <f:bottomButtonBar> in more places.
Browse files Browse the repository at this point in the history
Plus fixing the wrong apply button handling in various code.
  • Loading branch information
kohsuke committed Dec 31, 2012
1 parent b88c996 commit fbb2bca
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 12 deletions.
6 changes: 4 additions & 2 deletions core/src/main/java/hudson/model/ComputerSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@
import hudson.node_monitors.NodeMonitor;
import hudson.slaves.NodeDescriptor;
import hudson.util.DescribableList;
import hudson.util.FormApply;
import hudson.util.FormValidation;
import jenkins.model.Jenkins;
import org.kohsuke.stapler.HttpResponse;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
Expand Down Expand Up @@ -315,7 +317,7 @@ public FormValidation doCheckName(@QueryParameter String value) throws IOExcepti
* Accepts submission from the configuration page.
*/
@RequirePOST
public synchronized void doConfigSubmit( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException, FormException {
public synchronized HttpResponse doConfigSubmit( StaplerRequest req) throws IOException, ServletException, FormException {
BulkChange bc = new BulkChange(MONITORS_OWNER);
try {
Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
Expand All @@ -334,7 +336,7 @@ public synchronized void doConfigSubmit( StaplerRequest req, StaplerResponse rsp
nm.triggerUpdate();
}

rsp.sendRedirect2(".");
return FormApply.success(".");
} finally {
bc.commit();
}
Expand Down
3 changes: 2 additions & 1 deletion core/src/main/java/hudson/model/Run.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import hudson.tasks.BuildStep;
import hudson.tasks.test.AbstractTestResultAction;
import hudson.util.FlushProofOutputStream;
import hudson.util.FormApply;
import hudson.util.IOException2;
import hudson.util.LogTaskListener;
import hudson.util.XStream2;
Expand Down Expand Up @@ -2052,7 +2053,7 @@ public HttpResponse doConfigSubmit( StaplerRequest req ) throws IOException, Ser
} finally {
bc.abort();
}
return HttpResponses.redirectToDot();
return FormApply.success(".");
}

protected void submit(JSONObject json) throws IOException {
Expand Down
3 changes: 2 additions & 1 deletion core/src/main/java/hudson/model/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import hudson.security.AccessControlled;
import hudson.security.Permission;
import hudson.security.SecurityRealm;
import hudson.util.FormApply;
import hudson.util.RunList;
import hudson.util.XStream2;
import jenkins.model.Jenkins;
Expand Down Expand Up @@ -529,7 +530,7 @@ public void doConfigSubmit( StaplerRequest req, StaplerResponse rsp ) throws IOE

save();

rsp.sendRedirect(".");
FormApply.success(".").generateResponse(req,rsp,this);
}

/**
Expand Down
3 changes: 2 additions & 1 deletion core/src/main/java/hudson/model/View.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import hudson.util.AlternativeUiTextProvider.Message;
import hudson.util.DescribableList;
import hudson.util.DescriptorList;
import hudson.util.FormApply;
import hudson.util.IOException2;
import hudson.util.RunList;
import hudson.util.XStream2;
Expand Down Expand Up @@ -902,7 +903,7 @@ public final synchronized void doConfigSubmit( StaplerRequest req, StaplerRespon

save();

rsp.sendRedirect2("../"+name);
FormApply.success("../"+name).generateResponse(req,rsp,this);

This comment has been minimized.

Copy link
@jglick

jglick Jun 17, 2013

Member
}

/**
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/resources/hudson/model/Computer/configure.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ THE SOFTWARE.
<!-- main body of the configuration -->
<st:include it="${instance}" page="configure-entries.jelly" />

<f:block>
<f:bottomButtonBar>
<f:submit value="${%Save}"/>
</f:block>
</f:bottomButtonBar>
</f:form>
</l:main-panel>
</l:layout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ THE SOFTWARE.
descriptors="${it.nodeMonitorDescriptors}"
instances="${it.nonIgnoredMonitors}" />

<f:block>
<f:submit value="OK" />
</f:block>
<f:bottomButtonBar>
<f:submit value="${%OK}" />
<f:apply />
</f:bottomButtonBar>
</f:form>
</l:main-panel>
</l:layout>
Expand Down
5 changes: 3 additions & 2 deletions core/src/main/resources/hudson/model/Run/configure.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ THE SOFTWARE.
</f:entry>

<j:if test="${h.hasPermission(it,it.UPDATE)}">
<f:block>
<f:bottomButtonBar>
<f:submit value="${%Save}" />
</f:block>
<f:apply />
</f:bottomButtonBar>
</j:if>
</f:form>
</l:main-panel>
Expand Down

0 comments on commit fbb2bca

Please sign in to comment.