From 2b03a896a041f993a8960f85aa495d15f0c4088c Mon Sep 17 00:00:00 2001 From: zhaowei8188127 <18810460332@163.com> Date: Tue, 5 Nov 2013 14:04:39 +0800 Subject: [PATCH] add run history tab to the bottom. --- pom.xml | 2 +- .../java/haflow/module/util/ModuleUtil.java | 2 +- .../java/haflow/module/zrace/HiveModule.java | 2 +- .../ui/controller/RunHistoryController.java | 13 ++++- src/main/webapp/WEB-INF/views/run-history.jsp | 17 +++++-- src/main/webapp/script/haflow.main.js | 51 ++++++++++++++++++- 6 files changed, 78 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index a089095..574c1f8 100644 --- a/pom.xml +++ b/pom.xml @@ -107,6 +107,6 @@ 9.0.3.v20130506 - bench4q-web + haflow diff --git a/src/main/java/haflow/module/util/ModuleUtil.java b/src/main/java/haflow/module/util/ModuleUtil.java index ae0182c..3df8726 100644 --- a/src/main/java/haflow/module/util/ModuleUtil.java +++ b/src/main/java/haflow/module/util/ModuleUtil.java @@ -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(); diff --git a/src/main/java/haflow/module/zrace/HiveModule.java b/src/main/java/haflow/module/zrace/HiveModule.java index d19d8c8..3025413 100644 --- a/src/main/java/haflow/module/zrace/HiveModule.java +++ b/src/main/java/haflow/module/zrace/HiveModule.java @@ -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), diff --git a/src/main/java/haflow/ui/controller/RunHistoryController.java b/src/main/java/haflow/ui/controller/RunHistoryController.java index cf09c13..d7af3e5 100644 --- a/src/main/java/haflow/ui/controller/RunHistoryController.java +++ b/src/main/java/haflow/ui/controller/RunHistoryController.java @@ -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"); } } diff --git a/src/main/webapp/WEB-INF/views/run-history.jsp b/src/main/webapp/WEB-INF/views/run-history.jsp index 705f4c8..4aa8eb4 100644 --- a/src/main/webapp/WEB-INF/views/run-history.jsp +++ b/src/main/webapp/WEB-INF/views/run-history.jsp @@ -1,4 +1,4 @@ -<%@page import="haflow.ui.model.*"%> +<%@ page import="haflow.ui.model.*" %> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> @@ -12,12 +12,23 @@ HaFlow: Flow Run Histories - +

Flow Run History

History List

+ <% FlowRunHistoryListModel frhlm = (FlowRunHistoryListModel)request.getAttribute("flowHistory"); @@ -26,7 +37,6 @@ <% if(frhlm != null && frhlm.getFlowHistorys().size() != 0){ %> - @@ -36,7 +46,6 @@ FlowRunHistoryModel frhm = frhlm.getFlowHistorys().get(i); %> - diff --git a/src/main/webapp/script/haflow.main.js b/src/main/webapp/script/haflow.main.js index 88d956e..df3433c 100644 --- a/src/main/webapp/script/haflow.main.js +++ b/src/main/webapp/script/haflow.main.js @@ -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",
History Id Oozie Job Id Time Commit Message
<%=frhm.getId() %> <%=frhm.getOozieJobId() %> <%=frhm.getTimestamp() %> <%=frhm.getCommitMessage() %>