Skip to content

Commit

Permalink
Allowing to customise how the proxy is rendered by using the existing…
Browse files Browse the repository at this point in the history
… getHtmlRender()

Signed-off-by: Alexei Barantsev <barancev@gmail.com>
  • Loading branch information
diemol authored and barancev committed Dec 22, 2017
1 parent f2eec92 commit 773e4ae
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 106 deletions.
Expand Up @@ -29,6 +29,7 @@
import org.openqa.grid.internal.listeners.TestSessionListener;
import org.openqa.grid.internal.listeners.TimeoutListener;
import org.openqa.grid.internal.utils.HtmlRenderer;
import org.openqa.grid.web.servlet.beta.WebProxyHtmlRendererBeta;
import org.openqa.selenium.remote.server.jmx.JMXHelper;
import org.openqa.selenium.remote.server.jmx.ManagedAttribute;
import org.openqa.selenium.remote.server.jmx.ManagedService;
Expand Down Expand Up @@ -96,7 +97,7 @@ public void beforeCommand(TestSession session, HttpServletRequest request, HttpS
session.put("lastCommand", request.getMethod() + " - " + request.getPathInfo() + " executing ...");
}

private final HtmlRenderer renderer = new WebProxyHtmlRenderer(this);
private final HtmlRenderer renderer = new WebProxyHtmlRendererBeta(this);

@Override
public HtmlRenderer getHtmlRender() {
Expand Down

This file was deleted.

Expand Up @@ -34,7 +34,6 @@
import java.util.List;
import java.util.logging.Logger;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

Expand All @@ -57,13 +56,13 @@ public ConsoleServlet(GridRegistry registry) {

@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
throws IOException {
process(request, response);
}

@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
throws IOException {
process(request, response);
}

Expand Down Expand Up @@ -122,7 +121,7 @@ protected void process(HttpServletRequest request, HttpServletResponse response)
// TODO freynaud : registry to return a copy of proxies ?
List<String> nodes = new ArrayList<>();
for (RemoteProxy proxy : getRegistry().getAllProxies()) {
HtmlRenderer beta = new WebProxyHtmlRendererBeta(proxy);
HtmlRenderer beta = proxy.getHtmlRender();
nodes.add(beta.renderSummary());
}

Expand Down

2 comments on commit 773e4ae

@mach6
Copy link
Member

@mach6 mach6 commented on 773e4ae Jan 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @diemol

@diemol
Copy link
Member Author

@diemol diemol commented on 773e4ae Jan 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My pleasure! :)

I'll find the time to send another PR to change the rendering, avoiding those parts where we mix Java code and HTML.

For example, this is my console servlet, and this is the HTML template to render it, and this class does rendering.

Please sign in to comment.