add run history tab to the bottom.

This commit is contained in:
zhaowei8188127 2013-11-05 14:04:39 +08:00
parent cdd85cf1fa
commit 2b03a896a0
6 changed files with 78 additions and 9 deletions

View File

@ -107,6 +107,6 @@
<version>9.0.3.v20130506</version> <version>9.0.3.v20130506</version>
</plugin> </plugin>
</plugins> </plugins>
<finalName>bench4q-web</finalName> <finalName>haflow</finalName>
</build> </build>
</project> </project>

View File

@ -50,7 +50,7 @@ public class ModuleUtil {
+ ".class"); + ".class");
String classFileName; String classFileName;
if (classFile.getProtocol().equals("jar")) { if (classFile.getProtocol().equals("jar")) {
classFileName = classFile.getFile().substring("file:".length(), classFileName = classFile.getFile().substring("file:/".length(),
classFile.getFile().indexOf("!")); classFile.getFile().indexOf("!"));
} else { } else {
classFileName = classFile.getFile(); classFileName = classFile.getFile();

View File

@ -10,7 +10,7 @@ import haflow.module.ModuleType;
import java.util.Map; import java.util.Map;
@Module(id = "add600a8-aa63-8901-ca46-aaffa0e0bd2f", name = "Hive", category = "Basic", type = ModuleType.HIVE, configurations = { @Module(id = "add600a8-aa63-8901-ca46-aaffa0e0bd2f", name = "Hive", category = "DataSource", type = ModuleType.HIVE, configurations = {
@ModuleConfiguration(key = "sql", displayName = "Sql Command", pattern = "^(.*)$", type = ModuleConfigurationType.PLAIN_TEXT), @ModuleConfiguration(key = "sql", displayName = "Sql Command", pattern = "^(.*)$", type = ModuleConfigurationType.PLAIN_TEXT),
@ModuleConfiguration(key = "output_dir", displayName = "Output Directory", pattern = "^(.*)$", type = ModuleConfigurationType.PLAIN_TEXT), }, inputs = { @ModuleEndpoint(name = "from", minNumber = 1, maxNumber = 1, dataType = DataType.PlainText) }, outputs = { @ModuleConfiguration(key = "output_dir", displayName = "Output Directory", pattern = "^(.*)$", type = ModuleConfigurationType.PLAIN_TEXT), }, inputs = { @ModuleEndpoint(name = "from", minNumber = 1, maxNumber = 1, dataType = DataType.PlainText) }, outputs = {
@ModuleEndpoint(name = "ok", minNumber = 1, maxNumber = 1, dataType = DataType.PlainText), @ModuleEndpoint(name = "ok", minNumber = 1, maxNumber = 1, dataType = DataType.PlainText),

View File

@ -30,12 +30,23 @@ public class RunHistoryController {
this.runHistoryHelper = runHistoryHelper; this.runHistoryHelper = runHistoryHelper;
} }
@RequestMapping(value = "/{flowId}", method = RequestMethod.GET) @RequestMapping(value = "/get/{flowId}", method = RequestMethod.GET)
public ModelAndView get(@PathVariable UUID flowId, public ModelAndView get(@PathVariable UUID flowId,
HttpServletRequest request, HttpServletResponse response) { HttpServletRequest request, HttpServletResponse response) {
FlowRunHistoryListModel fhlm = this.getRunHistoryHelper() FlowRunHistoryListModel fhlm = this.getRunHistoryHelper()
.getFlowRunHistoryList(flowId); .getFlowRunHistoryList(flowId);
request.setAttribute("flowHistory", fhlm); request.setAttribute("flowHistory", fhlm);
request.setAttribute("flowIdOfHistory", flowId);
return new ModelAndView("run-history");
}
@RequestMapping(value = "/refresh/{flowId}", method = RequestMethod.GET)
public ModelAndView refresh(@PathVariable UUID flowId,
HttpServletRequest request, HttpServletResponse response) {
FlowRunHistoryListModel fhlm = this.getRunHistoryHelper()
.getFlowRunHistoryList(flowId);
request.setAttribute("flowHistory", fhlm);
request.setAttribute("flowIdOfHistory", flowId);
return new ModelAndView("run-history"); return new ModelAndView("run-history");
} }
} }

View File

@ -1,4 +1,4 @@
<%@page import="haflow.ui.model.*"%> <%@ page import="haflow.ui.model.*" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%> pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
@ -12,12 +12,23 @@
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>HaFlow: Flow Run Histories</title> <title>HaFlow: Flow Run Histories</title>
<link rel="stylesheet" href="<%=basePath%>/style/site.css"> <style>
table
{
border-collapse:collapse;
}
table, th, td{
border : 1px solid #C0C0C0;
padding-left : 5px;
padding-right : 5px;
}
</style>
</head> </head>
<body> <body>
<h1>Flow Run History</h1> <h1>Flow Run History</h1>
<h2>History List</h2> <h2>History List</h2>
<% <%
FlowRunHistoryListModel frhlm = FlowRunHistoryListModel frhlm =
(FlowRunHistoryListModel)request.getAttribute("flowHistory"); (FlowRunHistoryListModel)request.getAttribute("flowHistory");
@ -26,7 +37,6 @@
<% if(frhlm != null && frhlm.getFlowHistorys().size() != 0){ %> <% if(frhlm != null && frhlm.getFlowHistorys().size() != 0){ %>
<table> <table>
<tr> <tr>
<th>History Id</th>
<th>Oozie Job Id</th> <th>Oozie Job Id</th>
<th>Time</th> <th>Time</th>
<th>Commit Message</th> <th>Commit Message</th>
@ -36,7 +46,6 @@
FlowRunHistoryModel frhm = frhlm.getFlowHistorys().get(i); FlowRunHistoryModel frhm = frhlm.getFlowHistorys().get(i);
%> %>
<tr> <tr>
<td><%=frhm.getId() %></td>
<td><%=frhm.getOozieJobId() %></td> <td><%=frhm.getOozieJobId() %></td>
<td><%=frhm.getTimestamp() %></td> <td><%=frhm.getTimestamp() %></td>
<td><%=frhm.getCommitMessage() %></td> <td><%=frhm.getCommitMessage() %></td>

View File

@ -278,6 +278,55 @@ HAFlow.Main.prototype.runFlow = function(flowId) {
}); });
}; };
HAFlow.Main.prototype.showRunHistory = function(flowId) {
if( flowId == null){
alert("No flow selected, please double click a flow!");
return;
}
var found = false;
var children = this.ui.bottomContainer.getChildren();
var i;
for( i = 0; i < children.length; i++ ){
var child = children[i];
if( child.id == ("runHistoryPane_" + flowId)){
alert("Run History Panel for " + flowId + " already opened!");
this.ui.bottomContainer.selectChild(child);
found = true;
break;
}
}
var _currentInstance = this;
dojo.xhrGet({
url : _currentInstance.basePath + "runHistory/get/" + flowId,
load : function(data, ioArgs){
if( found == true){
var contentPane = dijit.registry.byId("runHistoryPaneInline_" + flowId);
contentPane.set('content', data);
}else {
var contentPaneInner = new dijit.layout.ContentPane({
id : "runHistoryPaneInline_" + flowId,
title : "History_" + _currentInstance.flows[flowId].name,
content : data,
closable : true
});
var contentPane = new dijit.layout.ContentPane({
id : "runHistoryPane_" + flowId,
title : "History_" + _currentInstance.flows[flowId].name,
content : contentPaneInner,
closable : true
});
_currentInstance.ui.bottomContainer.addChild(contentPane);
_currentInstance.ui.bottomContainer.selectChild(contentPane);
}
},
error : function(err, ioArgs){
alert(err);
}
});
};
// Flow Helper // Flow Helper
HAFlow.Main.prototype.refreshFlowList = function() { HAFlow.Main.prototype.refreshFlowList = function() {
var _currentInstance = this; var _currentInstance = this;
@ -921,7 +970,7 @@ HAFlow.Main.prototype.initFlowMenu = function() {
this.menu.runMenu.runHistoryMenuItem = new dijit.MenuItem({ this.menu.runMenu.runHistoryMenuItem = new dijit.MenuItem({
id : "runHistoryMenuItem", id : "runHistoryMenuItem",
label : "Run History", label : "Run History",
disabled : true disabled : false
}); });
this.menu.runMenu.debugHistoryMenuItem = new dijit.MenuItem({ this.menu.runMenu.debugHistoryMenuItem = new dijit.MenuItem({
id : "debugHistoryMenuItem", id : "debugHistoryMenuItem",