parent
049091c4a8
commit
ae26cb0c5d
|
After Width: | Height: | Size: 438 KiB |
@ -1,7 +1,95 @@
|
||||
<body style="color:white;background-color:black;" >
|
||||
<pre>
|
||||
<br>
|
||||
<#if result.code == 200>${result.content}
|
||||
<#else>${result.msg}</#if>
|
||||
</pre>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>任务调度中心</title>
|
||||
<#import "/common/common.macro.ftl" as netCommon>
|
||||
<@netCommon.commonStyle />
|
||||
<style type="text/css">
|
||||
.logConsolePre {
|
||||
font-size:12px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
/*bottom: 0;
|
||||
top: 0px;*/
|
||||
position: absolute;
|
||||
/*color:white;background-color:black*/
|
||||
}
|
||||
.logConsoleRunning {
|
||||
font-size: 20px;
|
||||
margin-top: 7px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body class="skin-blue fixed layout-top-nav">
|
||||
|
||||
<div class="wrapper">
|
||||
|
||||
<header class="main-header">
|
||||
<nav class="navbar navbar-static-top">
|
||||
<div class="container">
|
||||
<#-- icon -->
|
||||
<div class="navbar-header">
|
||||
<a href="../../index2.html" class="navbar-brand"><b>日志</b>Console</a>
|
||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse">
|
||||
<i class="fa fa-bars"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<#-- left nav -->
|
||||
<div class="collapse navbar-collapse pull-left" id="navbar-collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<#--<li class="active" ><a href="javascript:;">任务:<span class="sr-only">(current)</span></a></li>-->
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<#-- right nav -->
|
||||
<div class="navbar-custom-menu">
|
||||
<ul class="nav navbar-nav">
|
||||
<li>
|
||||
<a href="javascript:window.location.reload();" >
|
||||
<i class="fa fa-fw fa-refresh" ></i>
|
||||
刷新
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<div class="content-wrapper" >
|
||||
<pre class="logConsolePre"><div id="logConsole"></div><li class="fa fa-refresh fa-spin logConsoleRunning" ></li></pre>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<@netCommon.commonScript />
|
||||
<script>
|
||||
|
||||
// 参数
|
||||
var running = true; // 允许运行
|
||||
var executorAddress;
|
||||
var triggerTime;
|
||||
var logId;
|
||||
|
||||
// init
|
||||
<#if logStatue.code == 200>
|
||||
running = true;
|
||||
$('.logConsoleRunning').show();
|
||||
|
||||
executorAddress = '${executorAddress}';
|
||||
triggerTime = '${triggerTime}';
|
||||
logId = '${logId}';
|
||||
<#else>
|
||||
running = false;
|
||||
$('.logConsoleRunning').hide();
|
||||
|
||||
$('.logConsole').append('${logStatue.msg}');
|
||||
</#if>
|
||||
|
||||
</script>
|
||||
<script src="${request.contextPath}/static/js/logdetail.index.1.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,78 @@
|
||||
$(function() {
|
||||
|
||||
// valid
|
||||
if (!running) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 加载日志
|
||||
var fromLineNum = 0;
|
||||
var pullFailCount = 0;
|
||||
function pullLog() {
|
||||
|
||||
// pullFailCount, max=20
|
||||
if (pullFailCount >= 20) {
|
||||
console.log("pullLog fail-count limit");
|
||||
running = false;
|
||||
}
|
||||
|
||||
// valid
|
||||
if (!running) {
|
||||
$('.logConsoleRunning').hide();
|
||||
logRun = window.clearInterval(logRun)
|
||||
return;
|
||||
}
|
||||
|
||||
// load
|
||||
console.log("pullLog, fromLineNum:" + fromLineNum);
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
async: false, // async, avoid js invoke pagelist before jobId data init
|
||||
url : base_url + '/joblog/logDetailCat',
|
||||
data : {
|
||||
"executorAddress":executorAddress,
|
||||
"triggerTime":triggerTime,
|
||||
"logId":logId,
|
||||
"fromLineNum":fromLineNum
|
||||
},
|
||||
dataType : "json",
|
||||
success : function(data){
|
||||
pullFailCount++;
|
||||
if (data.code == 200) {
|
||||
if (!data.content) {
|
||||
console.log('pullLog fail');
|
||||
return;
|
||||
}
|
||||
if (fromLineNum != data.content.fromLineNum) {
|
||||
console.log('pullLog fromLineNum not match');
|
||||
return;
|
||||
}
|
||||
if (fromLineNum == (data.content.toLineNum + 1) ) {
|
||||
console.log('pullLog already line-end');
|
||||
return;
|
||||
}
|
||||
|
||||
// append
|
||||
fromLineNum = data.content.toLineNum + 1;
|
||||
$('#logConsole').append(data.content.logContent);
|
||||
pullFailCount = 0;
|
||||
|
||||
// valid end
|
||||
if (data.content.end) {
|
||||
running = false;
|
||||
console.log("pullLog already file-end");
|
||||
}
|
||||
} else {
|
||||
ComAlertTec.show(data.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 周期运行
|
||||
pullLog();
|
||||
var logRun = setInterval(function () {
|
||||
pullLog()
|
||||
}, 3000);
|
||||
|
||||
});
|
||||
@ -0,0 +1,47 @@
|
||||
package com.xxl.job.core.biz.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Created by xuxueli on 17/3/23.
|
||||
*/
|
||||
public class LogResult implements Serializable {
|
||||
private static final long serialVersionUID = 42L;
|
||||
|
||||
private int fromLineNum;
|
||||
private int toLineNum;
|
||||
private String logContent;
|
||||
private boolean isEnd;
|
||||
|
||||
public int getFromLineNum() {
|
||||
return fromLineNum;
|
||||
}
|
||||
|
||||
public void setFromLineNum(int fromLineNum) {
|
||||
this.fromLineNum = fromLineNum;
|
||||
}
|
||||
|
||||
public int getToLineNum() {
|
||||
return toLineNum;
|
||||
}
|
||||
|
||||
public void setToLineNum(int toLineNum) {
|
||||
this.toLineNum = toLineNum;
|
||||
}
|
||||
|
||||
public String getLogContent() {
|
||||
return logContent;
|
||||
}
|
||||
|
||||
public void setLogContent(String logContent) {
|
||||
this.logContent = logContent;
|
||||
}
|
||||
|
||||
public boolean isEnd() {
|
||||
return isEnd;
|
||||
}
|
||||
|
||||
public void setEnd(boolean end) {
|
||||
isEnd = end;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue