gocron/templates/task/index.html

78 lines
2.6 KiB
HTML

{{{ 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>
<table class="ui violet table">
<thead>
<tr>
<th>任务名称</th>
<th>cron表达式</th>
<th>协议</th>
<th width="5%">命令</th>
<th>超时时间(秒)</th>
<th>主机</th>
<th>备注</th>
<th>状态</th>
<th>操作</th>
</tr>
</thead>
<tbody>
{{{range $i, $v := .Tasks}}}
<tr>
<td>{{{.Task.Name}}}</td>
<td>{{{.Spec}}}</td>
<td>{{{if eq .Protocol 1}}} HTTP {{{else}}} SSH {{{end}}}</td>
<td>{{{.Command}}}</td>
<td>{{{.Timeout}}}</td>
<td>{{{.Alias}}}</td>
<td>{{{.Remark}}}</td>
<td>{{{if eq .Status 1}}}<i class="large checkmark blue icon"></i> {{{else}}} <i class="large red minus icon"></i> {{{end}}}</td>
<td>
<a class="ui purple button" href="/task/edit/{{{.Id}}}">编辑</a>
{{{if eq .Status 1}}}
<button class="ui primary button" onclick="changeStatus({{{.Id}}},{{{.Status}}})">暂停</button>
{{{else}}}
<button class="ui blue button" onclick="changeStatus({{{.Id}}},{{{.Status}}})">激活 </button>
{{{end}}}
<button class="ui positive button" onclick="util.removeConfirm('/task/remove/{{{.Id}}}')">删除</button>
<button class="ui pink button">查看日志</button>
</td>
</tr>
{{{end}}}
</tbody>
</table>
</div>
</div>
<script type="text/javascript">
$('.ui.checkbox').checkbox();
function changeStatus(id ,status) {
var url = '';
if (status) {
url = '/task/disable';
} else {
url = '/task/enable';
}
url += '/' + id;
util.post(url,{}, function() {
location.reload();
});
}
</script>
{{{ template "common/footer" . }}}