コード例 #1
0
 protected void createAddNodeForm() {
   form().id("addNodeForm").action("/admin/node/save").method("POST");
   input().type("hidden").name("cluster").value(params.get("cluster")).end();
   div()
       .span()
       .text("Host")
       .end()
       .span()
       .input()
       .type("text")
       .id("host")
       .name("host")
       .classAttr("validate[required]")
       .end(2)
       .span()
       .text("Port")
       .end()
       .span()
       .input()
       .type("text")
       .id("port")
       .name("port")
       .size("5")
       .classAttr("validate[required,custom[integer]]")
       .end(2)
       .span()
       .input()
       .value("Add Node")
       .type("submit")
       .classAttr("mb-button")
       .end(2);
   end();
   end();
 }
コード例 #2
0
 protected void createAddProxyRuleForm() {
   form().id("addProxyRuleForm").action("/admin/prule/save").method("POST");
   div()
       .span()
       .text("Name")
       .end()
       .span()
       .input()
       .type("text")
       .id("p-name")
       .name("name")
       .classAttr("validate[required]")
       .end(
           2) // id != name so that validation error reports on the page show of at the right
              // places.
       .span()
       .text("Listen Port")
       .end()
       .span()
       .input()
       .type("text")
       .id("p-port")
       .name("port")
       .size("5")
       .classAttr("validate[required,custom[integer]]")
       .end(2)
       .span()
       .input()
       .value("Add")
       .type("submit")
       .classAttr("mb-button")
       .end(2);
   end();
   end();
 }
コード例 #3
0
 public String createPage() throws Exception {
   html();
   createHead("Membrane Administration");
   body();
   div().id("tabs").classAttr("ui-tabs ui-widget ui-widget-content ui-corner-all");
   createTabs(getSelectedTab());
   div().classAttr("ui-tabs-panel ui-widget-content ui-corner-bottom");
   createTabContent();
   end();
   end();
   endAll();
   done();
   return writer.getBuffer().toString();
 }
コード例 #4
0
 protected void createInterceptorTable(List<Interceptor> interceptors) {
   table().attr("cellpadding", "0", "cellspacing", "0", "border", "0", "class", "display");
   thead();
   tr();
   createThs("Name", "Priority");
   end();
   end();
   tbody();
   for (Interceptor i : interceptors) {
     tr();
     createTds(i.getDisplayName(), "" + i.getPriority());
     end();
   }
   end();
   end();
 }
コード例 #5
0
 protected void createSessionsTable(List<Session> sessions) {
   table().attr("cellpadding", "0", "cellspacing", "0", "border", "0", "class", "display");
   thead();
   tr();
   createThs("Id", "Last Used");
   end();
   end();
   tbody();
   for (Session s : sessions) {
     tr();
     createTds(s.getId(), formatDurationHMS(System.currentTimeMillis() - s.getLastUsed()));
     end();
   }
   end();
   end();
 }
コード例 #6
0
 protected void createTabs(int selected) throws Exception {
   ul().classAttr("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");
   li().classAttr(getSelectedTabStyle(0, selected));
   a().href("/admin").text("Rules").end();
   end();
   li().classAttr(getSelectedTabStyle(1, selected));
   createLink("Transport", "transport", null, null);
   end();
   li().classAttr(getSelectedTabStyle(2, selected));
   createLink("System", "system", null, null);
   end();
   li().classAttr(getSelectedTabStyle(3, selected));
   createLink("Loadbalancer", "clusters", null, null);
   end();
   end();
 }
コード例 #7
0
 protected void createNodesTable() throws Exception {
   table().attr("cellpadding", "0", "cellspacing", "0", "border", "0", "class", "display");
   thead();
   tr();
   createThs(
       "Node", "Health", "Count", "Errors", "Time since last up", "Current Threads", "Action");
   end();
   end();
   tbody();
   for (Node n : router.getClusterManager().getAllNodesByCluster(params.get("cluster"))) {
     tr();
     td();
     createLink(
         "" + n.getHost() + ":" + n.getPort(),
         "node",
         "show",
         createQueryString(
             "cluster", params.get("cluster"), "host", n.getHost(), "port", "" + n.getPort()));
     end();
     createTds(
         n.isUp() ? "Up" : "Down",
         "" + n.getCounter(),
         String.format("%1$.2f%%", n.getErrors() * 100),
         formatDurationHMS(System.currentTimeMillis() - n.getLastUpTime()),
         "" + n.getThreads());
     td();
     createIcon("ui-icon-trash", "node", "delete", createQuery4Node(n));
     createIcon("ui-icon-circle-arrow-n", "node", "up", createQuery4Node(n));
     createIcon("ui-icon-circle-arrow-s", "node", "down", createQuery4Node(n));
     end();
     end();
   }
   end();
   end();
 }
コード例 #8
0
 protected void createStatusNodes(Node n) throws Exception {
   table().attr("cellpadding", "0", "cellspacing", "0", "border", "0", "class", "display");
   thead();
   tr();
   createThs("Status Code", "Count");
   end();
   end();
   tbody();
   synchronized (n.getStatusCodes()) {
     for (Map.Entry<Integer, Integer> codes : n.getStatusCodes().entrySet()) {
       tr();
       createTds("" + codes.getKey(), "" + codes.getValue());
       end();
     }
   }
   end();
   end();
 }
コード例 #9
0
 protected void createProxyRulesTable() throws UnsupportedEncodingException {
   table().attr("cellpadding", "0", "cellspacing", "0", "border", "0", "class", "display");
   thead();
   tr();
   createThs("Name", "Listen Port", "Actions");
   end();
   end();
   tbody();
   for (ProxyRule rule : getProxyRules()) {
     tr();
     td();
     createLink(
         rule.toString(),
         "prule",
         "show",
         createQueryString("name", RuleUtil.getRuleIdentifier(rule)));
     end();
     createTds("" + rule.getKey().getPort());
     td().a()
         .href(
             "/admin/rule/delete?name="
                 + URLEncoder.encode(RuleUtil.getRuleIdentifier(rule), "UTF-8"))
         .span()
         .classAttr("ui-icon ui-icon-trash")
         .end(3);
     end();
   }
   end();
   end();
 }
コード例 #10
0
 protected void createAddClusterForm() {
   form().id("addClusterForm").action("/admin/clusters/save").method("POST");
   div()
       .span()
       .text("Name")
       .end()
       .span()
       .input()
       .type("text")
       .id("name")
       .name("name")
       .classAttr("validate[required]")
       .end(2)
       .span()
       .input()
       .value("Add Cluster")
       .type("submit")
       .classAttr("mb-button")
       .end(2);
   end();
   end();
 }
コード例 #11
0
 protected void createHead(String title) {
   head();
   title().text(title).end();
   style()
       .attr("type", "text/css")
       .text(
           "@import '/datatables/css/demo_table_jui.css';\n"
               + "@import '/jquery-ui/css/custom-theme/jquery-ui-1.8.13.custom.css';"
               + "@import '/css/membrane.css';")
       .end();
   link().rel("stylesheet").href("/formValidator/validationEngine.jquery.css").type("text/css");
   script().src("/jquery/jquery-1.6.1.js").end();
   script().src("/datatables/js/jquery.dataTables.min.js").end();
   script().src("/jquery-ui/js/jquery-ui-1.8.13.custom.min.js").end();
   script().src("/formValidator/jquery.validationEngine-en.js").end();
   script().src("/formValidator/jquery.validationEngine.js").end();
   script().src("/js/membrane.js").end();
   createMetaElements();
   end();
 }
コード例 #12
0
  protected void createClustersTable() throws UnsupportedEncodingException {
    table().attr("cellpadding", "0", "cellspacing", "0", "border", "0", "class", "display");
    thead();
    tr();
    createThs("Name", "#Nodes", "Health");
    end();
    end();
    tbody();
    for (Cluster c : router.getClusterManager().getClusters()) {
      tr();
      td();
      createLink(c.getName(), "clusters", "show", createQueryString("cluster", c.getName()));
      end();

      createTds(
          String.valueOf(router.getClusterManager().getAllNodesByCluster(c.getName()).size()),
          getFormatedHealth(c.getName()));
      end();
    }
    end();
    end();
  }
コード例 #13
0
 protected void createTr(String... data) {
   tr();
   for (String d : data) td().text(d).end();
   end();
 }
コード例 #14
0
 protected void createAddFwdRuleForm() {
   form().id("addFwdRuleForm").action("/admin/frule/save").method("POST");
   div()
       .span()
       .text("Name")
       .end()
       .span()
       .input()
       .type("text")
       .id("name")
       .name("name")
       .classAttr("validate[required]")
       .end(2)
       .span()
       .text("Listen Port")
       .end()
       .span()
       .input()
       .type("text")
       .id("port")
       .name("port")
       .size("5")
       .classAttr("validate[required,custom[integer]]")
       .end(2)
       .span()
       .text("Method")
       .end()
       .span()
       .select()
       .id("method")
       .name("method")
       .option()
       .text("*")
       .end()
       .option()
       .text("GET")
       .end()
       .option()
       .text("POST")
       .end()
       .option()
       .text("DELETE")
       .end()
       .end(2)
       .span()
       .text("Target Host")
       .end()
       .span()
       .input()
       .type("text")
       .id("targetHost")
       .name("targetHost")
       .classAttr("validate[required]")
       .end(2)
       .span()
       .text("Target Port")
       .end()
       .span()
       .input()
       .type("text")
       .id("targetPort")
       .name("targetPort")
       .size("5")
       .classAttr("validate[required,custom[integer]]")
       .end(2)
       .span()
       .input()
       .value("Add")
       .type("submit")
       .classAttr("mb-button")
       .end(2);
   end();
   end();
 }