Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions src/org/labkey/remoteapi/SimpleFormCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package org.labkey.remoteapi;

import org.apache.hc.client5.http.classic.methods.HttpPost;
import org.apache.hc.client5.http.classic.methods.HttpUriRequest;
import org.apache.hc.client5.http.entity.UrlEncodedFormEntity;
import org.apache.hc.core5.http.NameValuePair;
import org.apache.hc.core5.http.message.BasicNameValuePair;

import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class SimpleFormCommand extends Command<CommandResponse, HttpUriRequest>
{
private final Map<String, String> _formData;

public SimpleFormCommand(String controller, String action, Map<String, String> formData)
{
super(controller, action);
_formData = formData;
}

public CommandResponse execute(Connection connection) throws IOException, CommandException
{
return execute(connection, null);
}

@Override
protected HttpUriRequest createRequest(URI uri)
{
HttpPost post = new HttpPost(uri);

List<NameValuePair> args = new ArrayList<>();
for (Map.Entry<String, String> reportVal : _formData.entrySet())
{
args.add(new BasicNameValuePair(reportVal.getKey(), reportVal.getValue()));
}
post.setEntity(new UrlEncodedFormEntity(args));
return post;
}
}
2 changes: 2 additions & 0 deletions src/org/labkey/test/components/core/ProjectMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ public ProjectMenu open()
openMenu.run();
if (!Locator.tagWithClass("div", "folder-nav").existsIn(this))
{
// Menu opened but the folder list didn't load
close();
openMenu.run(); // retry
}
}
Expand Down