Skip to content

Commit

Permalink
Merge pull request #191 from rkivisto/JENKINS-70906
Browse files Browse the repository at this point in the history
[JENKINS-71651] Fix administrative monitor buttons
  • Loading branch information
PierreBtz committed Jul 17, 2023
2 parents 4d00382 + a70e7e1 commit 985eaef
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/main/java/com/cloudbees/jenkins/plugins/advisor/Reminder.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
import jenkins.model.Jenkins;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.HttpResponse;
import org.kohsuke.stapler.HttpResponses;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.interceptor.RequirePOST;

import javax.servlet.ServletException;
import java.io.IOException;

/**
* Displays the reminder that the configuration must be done.
*/
Expand All @@ -33,15 +35,15 @@ public String getDisplayName() {

@Restricted(NoExternalUse.class)
@RequirePOST
public HttpResponse doAct(@QueryParameter(fixEmpty = true) String yes, @QueryParameter(fixEmpty = true) String no) {
public void doAct(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
AdvisorGlobalConfiguration config = AdvisorGlobalConfiguration.getInstance();
if (yes != null) {
return HttpResponses.redirectViaContextPath(config.getUrlName());
} else if (no != null) {
if (req.hasParameter("yes")) {
rsp.sendRedirect(req.getContextPath() + "/manage/" + config.getUrlName());
} else if (req.hasParameter("no")) {
// should never return null if we get here
return HttpResponses.redirectViaContextPath(Jenkins.get().getPluginManager().getSearchUrl() + "/installed");
} else { //remind later
return HttpResponses.forwardToPreviousPage();
rsp.sendRedirect(req.getContextPath() + "/" + Jenkins.get().getPluginManager().getSearchUrl() + "/installed");
} else {
rsp.forwardToPreviousPage(req);
}
}
}

0 comments on commit 985eaef

Please sign in to comment.