gocron/templates/task/index.html

100 lines
3.6 KiB
HTML
Raw Normal View History

{{{ 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-13 09:35:59 +00:00
<table class="ui violet table">
<thead>
<tr>
<th>任务名称</th>
<th>cron表达式</th>
<th>协议</th>
2017-04-13 09:35:59 +00:00
<th width="5%">命令</th>
<th>超时时间(秒)</th>
<th>重试次数</th>
<th>主机</th>
<th>备注</th>
<th>状态</th>
2017-04-13 09:35:59 +00:00
<th>操作</th>
</tr>
</thead>
<tbody>
{{{range $i, $v := .Tasks}}}
<tr>
2017-04-13 09:35:59 +00:00
<td>{{{.Task.Name}}}</td>
<td>{{{.Spec}}}</td>
2017-04-13 09:35:59 +00:00
<td>{{{if eq .Protocol 1}}} HTTP {{{else}}} SSH {{{end}}}</td>
<td>{{{.Command}}}</td>
<td>{{{.Timeout}}}</td>
<td>{{{.RetryTimes}}}</td>
2017-04-13 09:35:59 +00:00
<td>{{{.Alias}}}</td>
<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>
<button class="ui instagram button">查看日志</button>
</div>
2017-04-13 09:35:59 +00:00
</td>
</tr>
{{{end}}}
</tbody>
</table>
</div>
</div>
<script type="text/javascript">
$('.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
</script>
{{{ template "common/footer" . }}}