2017-04-08 09:15:30 +00:00
|
|
|
{{{ template "common/header" . }}}
|
2017-04-13 09:35:59 +00:00
|
|
|
<style type="text/css">
|
|
|
|
pre {
|
|
|
|
white-space: pre-wrap;
|
|
|
|
word-wrap: break-word;
|
|
|
|
padding:10px;
|
|
|
|
background-color: #4C4C4C;
|
|
|
|
color: white;
|
|
|
|
}
|
|
|
|
</style>
|
2017-04-08 09:15:30 +00:00
|
|
|
<div class="ui grid">
|
|
|
|
<!--the vertical menu-->
|
|
|
|
{{{ template "task/menu" . }}}
|
|
|
|
|
|
|
|
<div class="twelve wide column">
|
|
|
|
<div class="pageHeader">
|
|
|
|
<div class="segment">
|
|
|
|
<h3 class="ui dividing header">
|
|
|
|
<div class="content">
|
2017-04-13 09:35:59 +00:00
|
|
|
<button class="ui small teal button" onclick="clearLog()">清空日志</button>
|
2017-04-08 09:15:30 +00:00
|
|
|
</div>
|
|
|
|
</h3>
|
|
|
|
</div>
|
|
|
|
</div>
|
2017-04-22 15:39:33 +00:00
|
|
|
<form class="ui form">
|
|
|
|
<div class="six fields search">
|
|
|
|
<div class="field">
|
|
|
|
<input type="text" placeholder="任务ID" name="task_id" value="{{{if gt .Params.TaskId 0}}}{{{.Params.TaskId}}}{{{end}}}">
|
|
|
|
</div>
|
|
|
|
<div class="field">
|
|
|
|
<select name="protocol" id="protocol">
|
2017-05-05 08:31:24 +00:00
|
|
|
<option value="0">执行方式</option>
|
2017-04-24 05:57:39 +00:00
|
|
|
<option value="3" {{{if eq .Params.Protocol 3}}}selected{{{end}}}>系统命令</option>
|
2017-04-22 15:39:33 +00:00
|
|
|
<option value="2" {{{if eq .Params.Protocol 2}}}selected{{{end}}} data-match="host_id" data-validate-type="selectProtocol">SSH</option>
|
|
|
|
<option value="1" {{{if eq .Params.Protocol 1}}}selected{{{end}}}>HTTP</option>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
<div class="field">
|
|
|
|
<select name="status">
|
|
|
|
<option value="0">状态</option>
|
|
|
|
<option value="1" {{{if eq .Params.Status 0}}}selected{{{end}}} >失败</option>
|
|
|
|
<option value="2" {{{if eq .Params.Status 1}}}selected{{{end}}}>执行中</option>
|
|
|
|
<option value="3" {{{if eq .Params.Status 2}}}selected{{{end}}}>成功</option>
|
2017-04-28 03:54:46 +00:00
|
|
|
<option value="4" {{{if eq .Params.Status 3}}}selected{{{end}}}>取消</option>
|
2017-05-04 02:47:14 +00:00
|
|
|
<option value="5" {{{if eq .Params.Status 3}}}selected{{{end}}}>后台运行</option>
|
2017-04-22 15:39:33 +00:00
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
<div class="field">
|
|
|
|
<button class="ui linkedin submit button">搜索</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
2017-04-13 09:35:59 +00:00
|
|
|
<table class="ui pink table">
|
2017-04-08 09:15:30 +00:00
|
|
|
<thead>
|
|
|
|
<tr>
|
2017-04-22 15:39:33 +00:00
|
|
|
<th>任务ID</th>
|
2017-04-13 09:35:59 +00:00
|
|
|
<th>任务名称</th>
|
|
|
|
<th>cron表达式</th>
|
|
|
|
<th>协议</th>
|
2017-04-21 05:36:45 +00:00
|
|
|
<th>超时时间</th>
|
2017-04-21 06:50:40 +00:00
|
|
|
<th>重试次数</th>
|
2017-04-13 09:35:59 +00:00
|
|
|
<th>主机</th>
|
2017-04-21 05:36:45 +00:00
|
|
|
<th>执行时长</th>
|
2017-04-13 09:35:59 +00:00
|
|
|
<th>状态</th>
|
|
|
|
<th>执行结果</th>
|
2017-04-08 09:15:30 +00:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{{{range $i, $v := .Logs}}}
|
|
|
|
<tr>
|
2017-04-22 15:39:33 +00:00
|
|
|
<td><a href="/task?id={{{.TaskId}}}">{{{.TaskId}}}</a></td>
|
2017-04-08 09:15:30 +00:00
|
|
|
<td>{{{.Name}}}</td>
|
|
|
|
<td>{{{.Spec}}}</td>
|
2017-04-24 05:57:39 +00:00
|
|
|
<td>{{{if eq .Protocol 1}}} HTTP {{{else if eq .Protocol 2}}} SSH {{{else}}} 系统命令 {{{end}}}</td>
|
2017-05-07 03:38:03 +00:00
|
|
|
<td>{{{if eq .Timeout -1}}}后台运行{{{else if gt .Timeout 0}}}{{{.Timeout}}}秒{{{else}}}不限制{{{end}}}</td>
|
2017-04-21 06:50:40 +00:00
|
|
|
<td>{{{.RetryTimes}}}</td>
|
2017-04-13 09:35:59 +00:00
|
|
|
<td>{{{.Hostname}}}</td>
|
|
|
|
<td>
|
2017-05-04 02:47:14 +00:00
|
|
|
{{{if and (ne .Status 3) (ne .Status 4)}}}
|
2017-04-21 05:36:45 +00:00
|
|
|
{{{if gt .TotalTime 0}}}{{{.TotalTime}}}秒{{{else}}}1秒{{{end}}}<br>
|
|
|
|
开始时间: {{{.StartTime.Format "2006-01-02 15:04:05" }}}<br>
|
|
|
|
{{{if ne .Status 1}}}
|
|
|
|
结束时间: {{{.EndTime.Format "2006-01-02 15:04:05" }}}
|
|
|
|
{{{end}}}
|
2017-04-25 17:47:38 +00:00
|
|
|
{{{end}}}
|
2017-04-13 09:35:59 +00:00
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
{{{if eq .Status 2}}}
|
|
|
|
成功
|
|
|
|
{{{else if eq .Status 1}}}
|
|
|
|
<span style="color:green">执行中</span>
|
|
|
|
{{{else if eq .Status 0}}}
|
|
|
|
<span style="color:red">失败</span>
|
2017-04-25 17:47:38 +00:00
|
|
|
{{{else if eq .Status 3}}}
|
|
|
|
<span style="color:#4499EE">取消</span>
|
2017-05-04 02:47:14 +00:00
|
|
|
{{{else if eq .Status 4}}}
|
|
|
|
<span style="color:#43A102">后台运行</span>
|
2017-04-13 09:35:59 +00:00
|
|
|
{{{end}}}
|
|
|
|
</td>
|
|
|
|
<td>
|
2017-05-10 09:14:57 +00:00
|
|
|
{{{if or (eq .Status 2) (eq .Status 0)}}}
|
2017-04-21 05:36:45 +00:00
|
|
|
<button class="ui small primary button"
|
|
|
|
onclick="showResult('{{{.Name}}}', '{{{.Command}}}', '{{{.Result}}}')"
|
|
|
|
>查看结果
|
|
|
|
</button>
|
|
|
|
{{{end}}}
|
2017-04-13 09:35:59 +00:00
|
|
|
</td>
|
2017-04-08 09:15:30 +00:00
|
|
|
</tr>
|
|
|
|
{{{end}}}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2017-04-23 06:11:53 +00:00
|
|
|
{{{ template "common/pagination" .}}}
|
2017-04-08 09:15:30 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2017-04-13 09:35:59 +00:00
|
|
|
<div class="message">
|
|
|
|
<result></result>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script type="text/x-vue-template" id="task-result">
|
|
|
|
<div class="ui modal">
|
|
|
|
<i class="close icon"></i>
|
|
|
|
<div class="header">
|
|
|
|
{{name}}
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<pre style="background-color:#04477C;color:lightslategray">{{command}}</pre>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<pre>{{result}}</pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</script>
|
2017-04-08 09:15:30 +00:00
|
|
|
|
|
|
|
<script type="text/javascript">
|
2017-04-21 05:36:45 +00:00
|
|
|
function showTime(startTime, endTime, status) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-04-13 09:35:59 +00:00
|
|
|
function showResult(name, command,result) {
|
|
|
|
$('.message').html($('#task-result').html());
|
|
|
|
new Vue(
|
|
|
|
{
|
|
|
|
el: '.message',
|
|
|
|
data: {
|
|
|
|
result: result.replace(/\\n/,"<br>"),
|
|
|
|
name: name,
|
|
|
|
command: command
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
$('.ui.modal.transition').remove();
|
|
|
|
$('.ui.modal').modal({
|
|
|
|
detachable: false,
|
|
|
|
observeChanges: true
|
|
|
|
}).modal('refresh').modal('show');
|
|
|
|
}
|
|
|
|
|
|
|
|
function clearLog() {
|
|
|
|
util.confirm("确定要删除所有日志吗?", function() {
|
|
|
|
util.post("/task/log/clear",{}, function() {
|
|
|
|
location.reload();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
2017-04-08 09:15:30 +00:00
|
|
|
</script>
|
|
|
|
{{{ template "common/footer" . }}}
|