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(); }
private String createQuery4Node(Node n) throws UnsupportedEncodingException { return createQueryString( "cluster", params.get("cluster"), "host", n.getHost(), "port", "" + n.getPort()); }