2017-04-08 09:15:30 +00:00
|
|
|
{{{ template "common/header" . }}}
|
|
|
|
|
|
|
|
<div class="ui grid">
|
|
|
|
{{{template "task/menu" .}}}
|
|
|
|
<div class="twelve wide column">
|
|
|
|
<div class="pageHeader">
|
|
|
|
<div class="segment">
|
|
|
|
<h3 class="ui dividing header">
|
|
|
|
<i class="tasks icon"></i>
|
|
|
|
<div class="content">
|
|
|
|
任务列表
|
|
|
|
</div>
|
|
|
|
</h3>
|
|
|
|
</div>
|
|
|
|
</div>
|
2017-04-21 09:41:59 +00:00
|
|
|
<form class="ui form">
|
|
|
|
<div class="five fields">
|
|
|
|
<div class="field">
|
|
|
|
<input type="text" placeholder="任务名称" name="name">
|
|
|
|
</div>
|
|
|
|
<div class="field">
|
|
|
|
<label>主机</label>
|
|
|
|
<div class="ui dropdown selection">
|
|
|
|
<input type="hidden" name="protocol" value="{{{if gt .Params.Protocol 0}}}{{{.Params.Protocol}}}{{{else}}}3{{{end}}}">
|
|
|
|
<div class="default text">本地命令</div>
|
|
|
|
<i class="dropdown icon"></i>
|
|
|
|
<div class="menu">
|
|
|
|
<div class="item" data-value="3">本地命令</div>
|
|
|
|
<div class="item" data-value="2">SSH</div>
|
|
|
|
<div class="item" data-value="1">HTTP</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="inline fields">
|
|
|
|
{{{range $i, $v := .Hosts}}}
|
|
|
|
<div class="field">
|
|
|
|
<div class="ui radio checkbox">
|
|
|
|
<input type="radio" name="host_id" tabindex="0" class="hidden" value="{{{.Id}}}"
|
|
|
|
{{{if eq $.Params.HostId .Id }}} checked {{{end}}}>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{{{end}}}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="field">
|
|
|
|
<div class="ui dropdown selection">
|
|
|
|
<input type="hidden" name="protocol" value="{{{if gt .Params.Protocol 0}}}{{{.Params.Protocol}}}{{{else}}}3{{{end}}}">
|
|
|
|
<div class="default text">本地命令</div>
|
|
|
|
<i class="dropdown icon"></i>
|
|
|
|
<div class="menu">
|
|
|
|
<div class="item" data-value="-1">协议</div>
|
|
|
|
<div class="item" data-value="3">本地命令</div>
|
|
|
|
<div class="item" data-value="2">SSH</div>
|
|
|
|
<div class="item" data-value="1">HTTP</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="field">
|
|
|
|
<div class="ui dropdown selection">
|
|
|
|
<input type="hidden" name="status" value="{{{if eq .Params.Status 1}}}1{{{else}}}2{{{end}}}">
|
|
|
|
<div class="default text">暂停</div>
|
|
|
|
<i class="dropdown icon"></i>
|
|
|
|
<div class="menu">
|
|
|
|
<div class="item" data-value="-1">状态</div>
|
|
|
|
<div class="item" data-value="2">暂停</div>
|
|
|
|
<div class="item" data-value="1">激活</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</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 violet table">
|
2017-04-08 09:15:30 +00:00
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>任务名称</th>
|
|
|
|
<th>cron表达式</th>
|
|
|
|
<th>协议</th>
|
2017-04-13 09:35:59 +00:00
|
|
|
<th width="5%">命令</th>
|
2017-04-08 09:15:30 +00:00
|
|
|
<th>超时时间(秒)</th>
|
2017-04-21 06:50:40 +00:00
|
|
|
<th>重试次数</th>
|
2017-04-08 09:15:30 +00:00
|
|
|
<th>主机</th>
|
|
|
|
<th>备注</th>
|
|
|
|
<th>状态</th>
|
2017-04-13 09:35:59 +00:00
|
|
|
<th>操作</th>
|
2017-04-08 09:15:30 +00:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{{{range $i, $v := .Tasks}}}
|
|
|
|
<tr>
|
2017-04-13 09:35:59 +00:00
|
|
|
<td>{{{.Task.Name}}}</td>
|
2017-04-08 09:15:30 +00:00
|
|
|
<td>{{{.Spec}}}</td>
|
2017-04-13 09:35:59 +00:00
|
|
|
<td>{{{if eq .Protocol 1}}} HTTP {{{else}}} SSH {{{end}}}</td>
|
2017-04-08 09:15:30 +00:00
|
|
|
<td>{{{.Command}}}</td>
|
2017-04-21 09:41:59 +00:00
|
|
|
<td>{{{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>{{{.Alias}}}</td>
|
2017-04-08 09:15:30 +00:00
|
|
|
<td>{{{.Remark}}}</td>
|
2017-04-13 09:35:59 +00:00
|
|
|
<td>{{{if eq .Status 1}}}<i class="large checkmark blue icon"></i> {{{else}}} <i class="large red minus icon"></i> {{{end}}}</td>
|
|
|
|
<td>
|
2017-04-17 10:04:30 +00:00
|
|
|
<a class="ui purple button" href="/task/edit/{{{.Id}}}">编辑</a>
|
2017-04-13 09:35:59 +00:00
|
|
|
{{{if eq .Status 1}}}
|
2017-04-21 05:36:45 +00:00
|
|
|
<button class="ui primary button" @click="changeStatus({{{.Id}}},{{{.Status}}})">暂停</button>
|
2017-04-13 09:35:59 +00:00
|
|
|
{{{else}}}
|
2017-04-21 05:36:45 +00:00
|
|
|
<button class="ui blue button" @click="changeStatus({{{.Id}}},{{{.Status}}})">激活 </button>
|
2017-04-13 09:35:59 +00:00
|
|
|
{{{end}}}
|
2017-04-21 05:36:45 +00:00
|
|
|
<button class="ui positive button" @click="remove({{{.Id}}})">删除</button> <br>
|
|
|
|
<div style="margin-top:10px;">
|
|
|
|
<button class="ui twitter button" @click="run({{{.Id}}})">手动运行</button>
|
2017-04-21 09:41:59 +00:00
|
|
|
<a class="ui instagram button" href="/task/log?task_id={{{.Id}}}">查看日志</a>
|
2017-04-21 05:36:45 +00:00
|
|
|
</div>
|
2017-04-13 09:35:59 +00:00
|
|
|
</td>
|
2017-04-08 09:15:30 +00:00
|
|
|
</tr>
|
|
|
|
{{{end}}}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
2017-04-10 09:37:16 +00:00
|
|
|
$('.ui.checkbox').checkbox();
|
2017-04-13 09:35:59 +00:00
|
|
|
|
2017-04-21 05:36:45 +00:00
|
|
|
var vue = new Vue(
|
|
|
|
{
|
|
|
|
el: '.ui.violet.table',
|
|
|
|
methods: {
|
|
|
|
changeStatus: function (id ,status) {
|
|
|
|
var url = '';
|
|
|
|
if (status) {
|
|
|
|
url = '/task/disable';
|
|
|
|
} else {
|
|
|
|
url = '/task/enable';
|
|
|
|
}
|
|
|
|
url += '/' + id;
|
|
|
|
util.post(url,{}, function() {
|
|
|
|
location.reload();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
remove: function(id) {
|
|
|
|
util.removeConfirm('/task/remove/' + id);
|
|
|
|
},
|
|
|
|
run: function(id) {
|
|
|
|
util.get("/task/run/" + id, function(code, message) {
|
|
|
|
swal('操作成功', message, 'success');
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
|
2017-04-13 09:35:59 +00:00
|
|
|
|
|
|
|
|
2017-04-08 09:15:30 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
{{{ template "common/footer" . }}}
|