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>
</plugin>
</plugins>
<finalName>bench4q-web</finalName>
<finalName>haflow</finalName>
</build>
</project>

View File

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

View File

@ -10,7 +10,7 @@ import haflow.module.ModuleType;
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 = "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),

View File

@ -30,12 +30,23 @@ public class RunHistoryController {
this.runHistoryHelper = runHistoryHelper;
}
@RequestMapping(value = "/{flowId}", method = RequestMethod.GET)
@RequestMapping(value = "/get/{flowId}", method = RequestMethod.GET)
public ModelAndView get(@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");
}
@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");
}
}

View File

@ -12,12 +12,23 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<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>
<body>
<h1>Flow Run History</h1>
<h2>History List</h2>
<%
FlowRunHistoryListModel frhlm =
(FlowRunHistoryListModel)request.getAttribute("flowHistory");
@ -26,7 +37,6 @@
<% if(frhlm != null && frhlm.getFlowHistorys().size() != 0){ %>
<table>
<tr>
<th>History Id</th>
<th>Oozie Job Id</th>
<th>Time</th>
<th>Commit Message</th>
@ -36,7 +46,6 @@
FlowRunHistoryModel frhm = frhlm.getFlowHistorys().get(i);
%>
<tr>
<td><%=frhm.getId() %></td>
<td><%=frhm.getOozieJobId() %></td>
<td><%=frhm.getTimestamp() %></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
HAFlow.Main.prototype.refreshFlowList = function() {
var _currentInstance = this;
@ -921,7 +970,7 @@ HAFlow.Main.prototype.initFlowMenu = function() {
this.menu.runMenu.runHistoryMenuItem = new dijit.MenuItem({
id : "runHistoryMenuItem",
label : "Run History",
disabled : true
disabled : false
});
this.menu.runMenu.debugHistoryMenuItem = new dijit.MenuItem({
id : "debugHistoryMenuItem",