Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #58 from recena/JENKINS-34200
[JENKINS-34200] Redirect to indexing log after creating or editing a ComputedFolder
  • Loading branch information
recena committed Apr 26, 2016
2 parents 275ea88 + 8bd3025 commit 0a3fe90
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
@@ -1,7 +1,7 @@
/*
* The MIT License
*
* Copyright 2015 CloudBees, Inc.
* Copyright 2015-2016 CloudBees, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -40,9 +40,6 @@
import hudson.model.Descriptor;
import hudson.model.HealthReport;
import hudson.model.Item;
import static hudson.model.Item.CONFIGURE;
import static hudson.model.Item.CREATE;
import static hudson.model.Item.DELETE;
import hudson.model.ItemGroup;
import static hudson.model.ItemGroupMixIn.loadChildren;
import hudson.model.Items;
Expand Down Expand Up @@ -84,6 +81,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import javax.servlet.ServletException;
import jenkins.model.Jenkins;
import jenkins.model.ModelObjectWithChildren;
Expand Down Expand Up @@ -705,10 +703,22 @@ public void doConfigSubmit(StaplerRequest req, StaplerResponse rsp) throws IOExc
if (namingStrategy.isForceExistingJobs()) {
namingStrategy.checkName(name);
}
FormApply.success(".").generateResponse(req, rsp, this);
FormApply.success(getSuccessfulDestination()).generateResponse(req, rsp, this);
}
}

/**
* Where user will be redirected after creating or reconfiguring a {@code AbstractFolder}.
*
* @return A string that represents the redirect location URL.
*
* @see javax.servlet.http.HttpServletResponse#sendRedirect(String)
*/
@Restricted(NoExternalUse.class)
protected @Nonnull String getSuccessfulDestination() {
return ".";
}

protected void submit(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, Descriptor.FormException {}

// TODO boilerplate like this should not be necessary: JENKINS-22936
Expand Down
Expand Up @@ -75,6 +75,7 @@
import org.apache.commons.io.FileUtils;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.DoNotUse;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.HttpResponse;
import org.kohsuke.stapler.HttpResponses;
import org.kohsuke.stapler.QueryParameter;
Expand Down Expand Up @@ -236,6 +237,11 @@ protected void submit(StaplerRequest req, StaplerResponse rsp) throws IOExceptio
}
}

@Override
protected @Nonnull String getSuccessfulDestination() {
return computation.getSearchUrl() + "console";
}

public Map<TriggerDescriptor,Trigger<?>> getTriggers() {
return triggers.toMap();
}
Expand Down

0 comments on commit 0a3fe90

Please sign in to comment.