Skip to content

Commit

Permalink
Merge pull request #2 from calvinjia/master
Browse files Browse the repository at this point in the history
UI Update: add in memory files page.
  • Loading branch information
haoyuan committed Feb 25, 2013
2 parents 9335400 + 4d67f7a commit 982fb35
Show file tree
Hide file tree
Showing 6 changed files with 231 additions and 150 deletions.
2 changes: 2 additions & 0 deletions src/main/java/tachyon/Master.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ private Master(InetSocketAddress address, int selectorThreads, int acceptQueueSi
new ServletHolder(new WebInterfaceGeneralServlet(mMasterInfo)), "/home");
webappcontext.addServlet(
new ServletHolder(new WebInterfaceBrowseServlet(mMasterInfo)), "/browse");
webappcontext.addServlet(
new ServletHolder(new WebInterfaceMemoryServlet(mMasterInfo)), "/memory");

handlers.setHandlers(new Handler[] { webappcontext, new DefaultHandler() });
mWebServer.setHandler(handlers);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/tachyon/WebInterfaceGeneralServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ public int getUsedSpacePercent() {
}
}

public WebInterfaceGeneralServlet(MasterInfo MI) {
mMasterInfo = MI;
public WebInterfaceGeneralServlet(MasterInfo masterInfo) {
mMasterInfo = masterInfo;
}

@Override
Expand Down
35 changes: 35 additions & 0 deletions src/main/java/tachyon/WebInterfaceMemoryServlet.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package tachyon;

import java.util.List;
import java.util.Collections;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class WebInterfaceMemoryServlet extends HttpServlet {
private static final long serialVersionUID = 4293149962399443914L;
private MasterInfo mMasterInfo;

public WebInterfaceMemoryServlet(MasterInfo masterInfo) {
mMasterInfo = masterInfo;
}

@Override
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setAttribute("masterNodeAddress", mMasterInfo.getMasterAddress().toString());
List<String> inMemoryFiles = mMasterInfo.getInMemoryFiles();
Collections.sort(inMemoryFiles);
request.setAttribute("inMemoryFiles", inMemoryFiles);
getServletContext().getRequestDispatcher("/memory.jsp").forward(request, response);
}

@Override
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
return;
}
}
4 changes: 4 additions & 0 deletions src/main/java/tachyon/webapps/browse.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<ul class="nav nav-pills">
<li><a href="./home">Master: ${masterNodeAddress}</a></li>
<li class="active"><a href="./browse?path=/">Browse File System</a></li>
<li><a href="./memory">View Files in Memory</a></li>
</ul>
</div>
</div>
Expand Down Expand Up @@ -76,6 +77,9 @@
</div>
</div>
</div>
<footer>
<p>Tachyon is a project developed at the UC Berkeley <a href="https://amplab.cs.berkeley.edu">AMPLab</a>.</p>
</footer>
</div>
</body>
</html>
293 changes: 145 additions & 148 deletions src/main/java/tachyon/webapps/general.jsp
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
<%@ page isELIgnored ="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
</head>
<title>Tachyon</title>
<body>
<script src="jquery-1.9.1.min.js" type="text/javascript"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
<div class="container-fluid">
<div class="navbar navbar-inverse">
<div class="navbar-inner">
<ul class="nav nav-pills">
<li class="active"><a href="./home">Master: ${masterNodeAddress}</a></li>
<li><a href="./browse?path=/">Browse File System</a></li>
</ul>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
</head>
<title>Tachyon</title>
<body>
<script src="jquery-1.9.1.min.js" type="text/javascript"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
<div class="container-fluid">
<div class="navbar navbar-inverse">
<div class="navbar-inner">
<ul class="nav nav-pills">
<li class="active"><a href="./home">Master: ${masterNodeAddress}</a></li>
<li><a href="./browse?path=/">Browse File System</a></li>
<li><a href="./memory">View Files in Memory</a></li>
</ul>
</div>
</div>
<div class ="row-fluid">
<div class="accordion span6" id="accordion1">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion1" href="#data1">
<h4>Tachyon Summary</h4>
</a>
</div>
</div>
<div class ="row-fluid">
<div class="accordion span6" id="accordion1">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion1" href="#data1">
<h4>Tachyon Summary</h4>
</a>
</div>
<div id="data1" class="accordion-body collapse in">
<div class="accordion-inner">
<table class="table">
<tbody>
<div id="data1" class="accordion-body collapse in">
<div class="accordion-inner">
<table class="table">
<tbody>
<tr>
<th>Started:</th>
<th>${startTime}</th>
Expand All @@ -42,141 +43,137 @@
<th>Version:</th>
<th>${version}</th>
</tr>
</tbody>
</table>
</div>
</tbody>
</table>
</div>
</div>
</div>
</div>

<div class="accordion span6" id="accordion2">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#data2">
<h4>Cluster Summary</h4>
</a>
</div>
<div id="data2" class="accordion-body collapse in">
<div class="accordion-inner">
<table class="table">
<tbody>
<tr>
<th>Memory Storage Capacity:</th>
<th>${capacity}</th>
</tr>
<tr>
<th>Memory Storage In-Use</th>
<th>${usedCapacity}</th>
</tr>
<tr>
<th>Workers Running</th>
<th>${liveWorkerNodes}</th>
</tr>
</tbody>
</table>
</div>
<div class="accordion span6" id="accordion2">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#data2">
<h4>Cluster Summary</h4>
</a>
</div>
<div id="data2" class="accordion-body collapse in">
<div class="accordion-inner">
<table class="table">
<tbody>
<tr>
<th>Memory Storage Capacity:</th>
<th>${capacity}</th>
</tr>
<tr>
<th>Memory Storage In-Use</th>
<th>${usedCapacity}</th>
</tr>
<tr>
<th>Workers Running</th>
<th>${liveWorkerNodes}</th>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>

<div class ="row-fluid">
<div class="accordion span6" id="accordion3">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse"
data-parent="#accordion3" href="#data3">
<h4>Pin List</h4>
</a>
</div>
<div id="data3" class="accordion-body collapse in">
<div class="accordion-inner">
<table class="table">
<tbody>
<tr>
<c:forEach var="file" items="${pinlist}">
<th>${file}</th>
</c:forEach>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class ="row-fluid">
<div class="accordion span6" id="accordion3">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion3" href="#data3">
<h4>Pin List</h4>
</a>
</div>
<div id="data3" class="accordion-body collapse in">
<div class="accordion-inner">
<table class="table">
<tbody>
<tr>
<c:forEach var="file" items="${pinlist}">
<th>${file}</th>
</c:forEach>
</tr>
</tbody>
</table>
</div>
</div>
</div>

<div class="accordion span6" id="accordion4">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse"
data-parent="#accordion4" href="#data4">
<h4>White List</h4>
</a>
</div>
<div id="data4" class="accordion-body collapse in">
<div class="accordion-inner">
<table class="table">
<tbody>
<tr>
<c:forEach var="file" items="${whitelist}">
<th>${file}</th>
</c:forEach>
</tr>
</tbody>
</table>
</div>
</div>
<div class="accordion span6" id="accordion4">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion4" href="#data4">
<h4>White List</h4>
</a>
</div>
<div id="data4" class="accordion-body collapse in">
<div class="accordion-inner">
<table class="table">
<tbody>
<tr>
<c:forEach var="file" items="${whitelist}">
<th>${file}</th>
</c:forEach>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>

<div class="row-fluid">

<div class="accordion span14" id="accordion5">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse"
data-parent="#accordion5" href="#data5">
<h4>Detailed Nodes Summary</h4>
</a>
</div>
<div id="data5" class="accordion-body collapse in">
<div class="accordion-inner">
<table class="table table-hover">
<thead>
<th>Node Name</th>
<th>Last Heartbeat</th>
<th>State</th>
<th>Capacity</th>
<tbody>
<c:forEach var="nodeInfo" items="${nodeInfos}">
<tr>
<th>${nodeInfo.name}</th>
<th>${nodeInfo.lastHeartbeat} seconds ago</th>
<th>${nodeInfo.state}</th>
<th>
<div class="progress">
<div class="bar bar-success" style="width: ${nodeInfo.freeSpacePercent}%;">
<c:if test="${nodeInfo.freeSpacePercent ge nodeInfo.usedSpacePercent}">
${nodeInfo.freeSpacePercent}% Free
</c:if>
</div>
<div class="bar bar-danger" style="width: ${nodeInfo.usedSpacePercent}%;">
<c:if test="${nodeInfo.usedSpacePercent gt nodeInfo.freeSpacePercent}">
${nodeInfo.usedSpacePercent}% Used
</c:if>
</div>
</div>
</th>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</div>
</div>
<div class="row-fluid">
<div class="accordion span14" id="accordion5">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion5" href="#data5">
<h4>Detailed Nodes Summary</h4>
</a>
</div>
<div id="data5" class="accordion-body collapse in">
<div class="accordion-inner">
<table class="table table-hover">
<thead>
<th>Node Name</th>
<th>Last Heartbeat</th>
<th>State</th>
<th>Capacity</th>
<tbody>
<c:forEach var="nodeInfo" items="${nodeInfos}">
<tr>
<th>${nodeInfo.name}</th>
<th>${nodeInfo.lastHeartbeat} seconds ago</th>
<th>${nodeInfo.state}</th>
<th>
<div class="progress">
<div class="bar bar-success" style="width: ${nodeInfo.freeSpacePercent}%;">
<c:if test="${nodeInfo.freeSpacePercent ge nodeInfo.usedSpacePercent}">
${nodeInfo.freeSpacePercent}% Free
</c:if>
</div>
<div class="bar bar-danger" style="width: ${nodeInfo.usedSpacePercent}%;">
<c:if test="${nodeInfo.usedSpacePercent gt nodeInfo.freeSpacePercent}">
${nodeInfo.usedSpacePercent}% Used
</c:if>
</div>
</div>
</th>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</body>
</div>
<footer>
Tachyon is a project developed at the UC Berkeley <a href="https://amplab.cs.berkeley.edu">AMPLab</a>.
</footer>
</div>
</body>
</html>
Loading

0 comments on commit 982fb35

Please sign in to comment.