初版
定时任务管理
This commit is contained in:
67
views/group/add.html
Normal file
67
views/group/add.html
Normal file
@@ -0,0 +1,67 @@
|
||||
<!-- 新增任务 -->
|
||||
<div class="container-fluid">
|
||||
<div class="info-center">
|
||||
<!--title-->
|
||||
<div class="info-center">
|
||||
<div class="page-header">
|
||||
<div class="pull-left">
|
||||
<h4>{{.pageTitle}}</h4>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<!-- <button type="button" class="btn btn-mystyle btn-sm refresh">刷新</button>
|
||||
<button type="button" class="btn btn-mystyle btn-sm reback">返回</button> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!--content-list-->
|
||||
<div class="content-list">
|
||||
<form action="{{urlfor "GroupController.Add"}}" method="post" class="form-horizontal">
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="group_name">组名</label>
|
||||
<div class="col-sm-3" >
|
||||
<input type="text" class="form-control input-sm" placeholder="" name="group_name" value="" required />
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-top:5px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="description">任务说明</label>
|
||||
<div class="col-sm-5" >
|
||||
<textarea name="description" class="form-control" id="description" rows="3"></textarea>
|
||||
</div>
|
||||
<div class="col-sm-4" style="padding-top:5px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div class="modal-footer" style="text-align:center">
|
||||
<button type="submit" class="btn btn-primary submit_attr_button">保存</button>
|
||||
<button type="button" class="btn btn-default reback">返回</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
$("form").submit(function () {
|
||||
// $(".alert").hide();
|
||||
$("button[type='submit']").attr('disabled', true);
|
||||
$.post('{{urlfor "GroupController.Add"}}', $(this).serialize(), function (out) {
|
||||
if (out.status == 0) {
|
||||
window.location.href = '{{urlfor "GroupController.List"}}';
|
||||
} else {
|
||||
alert_message(out.msg,"alert-danger","alert-success");
|
||||
$("button[type='submit']").attr('disabled', false);
|
||||
}
|
||||
}, "json");
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
67
views/group/edit.html
Normal file
67
views/group/edit.html
Normal file
@@ -0,0 +1,67 @@
|
||||
<!-- 新增任务 -->
|
||||
<div class="container-fluid">
|
||||
<div class="info-center">
|
||||
<!--title-->
|
||||
<div class="info-center">
|
||||
<div class="page-header">
|
||||
<div class="pull-left">
|
||||
<h4>{{.pageTitle}}</h4>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<!-- <button type="button" class="btn btn-mystyle btn-sm refresh">刷新</button>
|
||||
<button type="button" class="btn btn-mystyle btn-sm reback">返回</button> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!--content-list-->
|
||||
<div class="content-list">
|
||||
<form action="{{urlfor "GroupController.Edit"}}" method="post" class="form-horizontal">
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="group_name">组名</label>
|
||||
<div class="col-sm-3" >
|
||||
<input type="text" class="form-control input-sm" placeholder="" name="group_name" value="{{.group.GroupName}}" required />
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-top:5px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="description">任务说明</label>
|
||||
<div class="col-sm-5" >
|
||||
<textarea name="description" class="form-control" id="description" rows="3">{{.group.Description}}</textarea>
|
||||
</div>
|
||||
<div class="col-sm-4" style="padding-top:5px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<input type="hidden" name="id" value="{{.group.Id}}" />
|
||||
<div class="modal-footer" style="text-align:center">
|
||||
<button type="submit" class="btn btn-primary submit_attr_button">保存</button>
|
||||
<button type="button" class="btn btn-default reback">返回</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
$("form").submit(function () {
|
||||
$("button[type='submit']").attr('disabled', true);
|
||||
$.post('{{urlfor "GroupController.Edit"}}', $(this).serialize(), function (out) {
|
||||
if (out.status == 0) {
|
||||
window.location.href = '{{urlfor "GroupController.List"}}';
|
||||
} else {
|
||||
alert_message(out.msg,"alert-danger","alert-success");
|
||||
$("button[type='submit']").attr('disabled', false);
|
||||
}
|
||||
}, "json");
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
108
views/group/list.html
Normal file
108
views/group/list.html
Normal file
@@ -0,0 +1,108 @@
|
||||
<!-- 分组列表 -->
|
||||
<div class="container-fluid">
|
||||
<div class="info-center">
|
||||
<!--title-->
|
||||
<div class="info-center">
|
||||
<div class="page-header">
|
||||
<div class="pull-left">
|
||||
<h4>{{.pageTitle}}</h4>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<!-- <button type="button" class="btn btn-mystyle btn-sm refresh">刷新</button>
|
||||
<button type="button" class="btn btn-mystyle btn-sm reback">返回</button> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<!--content-list-->
|
||||
<div class="content-list">
|
||||
<div class="search-box row">
|
||||
<div class="col-md-4">
|
||||
<div class="btn-group pull-left" role="group" aria-label="...">
|
||||
<a href='{{urlfor "GroupController.Add"}}' class="btn btn-primary"><span class="glyphicon glyphicon-plus"></span> 新增分组</a>
|
||||
<div class="btn-group" role="group">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<span class="glyphicon glyphicon-edit"></span> 批量操作
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="javascript:;" onclick="javascript:batch('delete');"><span class="glyphicon glyphicon-remove-sign" aria-hidden="true"></span> 删除</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class=" btn-large pull-right" >
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
<div class="table-margin">
|
||||
<form id="form-list" method="post" action="">
|
||||
<table class="table table-bordered table-header">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><input type="checkbox" name="all_check" /></td>
|
||||
<td>ID</td>
|
||||
<td width="20%">分组名称</td>
|
||||
<td>描述</td>
|
||||
<td width="25%">操作</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{range $k,$v := .list}}
|
||||
<tr>
|
||||
<td class="chk"><input type="checkbox" name="ids" value="{{$v.Id}}" /></td>
|
||||
<td class="center">{{$v.Id}}</td>
|
||||
<td>{{$v.GroupName}}</td>
|
||||
<td>{{$v.Description}}</td>
|
||||
|
||||
<td>
|
||||
|
||||
<a class="btn btn-info btn-xs" href="{{urlfor "GroupController.Edit"}}?id={{$v.Id}}">
|
||||
<span class="glyphicon glyphicon-file" aria-hidden="true"></span> 编辑
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="7">
|
||||
<div class="pull-right">
|
||||
{{str2html .pageBar}}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function batch(action) {
|
||||
if ($("input[name='ids']:checked").size() < 1) {
|
||||
alert_message("请选择要操作的任务","alert-danger","alert-success");
|
||||
} else {
|
||||
if(action=='delete'){
|
||||
if(!confirm("确定要删除所选吗?")) return;
|
||||
}
|
||||
var url = "{{urlfor "GroupController.Batch"}}";
|
||||
$.post(url + "?action=" + action, $("#form-list").serialize(), function(out) {
|
||||
if (out.status != 0) {
|
||||
alert_message(out.msg,"alert-danger","alert-success");
|
||||
} else {
|
||||
window.location.reload();
|
||||
}
|
||||
}, "json");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
86
views/help/index.html
Normal file
86
views/help/index.html
Normal file
@@ -0,0 +1,86 @@
|
||||
<!-- 分组列表 -->
|
||||
<div class="container-fluid">
|
||||
<div class="info-center">
|
||||
<!--title-->
|
||||
<div class="info-center">
|
||||
<div class="page-header">
|
||||
<div class="pull-left">
|
||||
<h4>{{.pageTitle}}</h4>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<!-- <button type="button" class="btn btn-mystyle btn-sm refresh">刷新</button>
|
||||
<button type="button" class="btn btn-mystyle btn-sm reback">返回</button> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<!--content-list-->
|
||||
<div class="content-list">
|
||||
<div class="widget-content">
|
||||
<h4>Cron表达式说明</h4>
|
||||
<hr />
|
||||
<p>
|
||||
Cron表达式是一个字符串,字符串以空格隔开,分为5或6个域,每一个域代表一个含义,系统支持的表达式格式如下:<br />
|
||||
<pre>Seconds Minutes Hours DayofMonth Month [DayofWeek]</pre>
|
||||
其中 DayofWeek 为可选域。
|
||||
</p>
|
||||
<p>
|
||||
每一个域可出现的字符如下:
|
||||
<ul>
|
||||
<li><b>Seconds:</b> 可出现"* / , -"四个字符,有效范围为0-59的整数</li>
|
||||
<li><b>Minutes:</b> 可出现"* / , -"四个字符,有效范围为0-59的整数 </li>
|
||||
<li><b>Hours:</b> 可出现"* / , -"四个字符,有效范围为0-23的整数 </li>
|
||||
<li><b>DayofMonth:</b> 可出现"* / , - ?"五个字符,有效范围为0-31的整数</li>
|
||||
<li><b>Month:</b> 可出现", - * /"四个字符,有效范围为1-12的整数或JAN-DEC</li>
|
||||
<li><b>DayofWeek:</b> 可出现"* / , - ?"五个字符,有效范围为0-6的整数或SUN-SAT两个范围。0表示星期天,1表示星期一, 依次类推 </li>
|
||||
</ul>
|
||||
</p>
|
||||
<p>
|
||||
各个字符的含义如下:
|
||||
<ul>
|
||||
<li>* 表示匹配该域的任意值,假如在Minutes域使用*, 即表示每分钟都会触发事件。</li>
|
||||
<li>? 字符仅被用于天(月)和天(星期)两个子表达式,表示不指定值,当2个子表达式其中之一被指定了值以后,为了避免冲突,需要将另一个子表达式的值设为“?”。</li>
|
||||
<li>- 表示范围,例如在Minutes域使用5-20,表示从5分到20分钟每分钟触发一次。</li>
|
||||
<li>/ 表示起始时间开始触发,然后每隔固定时间触发一次,例如在Minutes域使用5/20,则意味着5分钟触发一次,而25,45等分别触发一次。</li>
|
||||
<li>, 表示列出枚举值值。例如:在Minutes域使用5,20,则意味着在5和20分每分钟触发一次。</li>
|
||||
</ul>
|
||||
</p>
|
||||
<p>
|
||||
一些例子:
|
||||
<pre>
|
||||
0 0 10,14,16 * * ? 每天上午10点,下午2点,4点触发
|
||||
|
||||
0 0/30 9-17 * * ? 朝九晚五工作时间内每半小时触发
|
||||
|
||||
0 0 12 ? * WED 表示每个星期三中午12点触发
|
||||
|
||||
0 0 12 * * ? 每天中午12点触发
|
||||
|
||||
0 15 10 ? * * 每天上午10:15触发
|
||||
|
||||
0 15 10 * * ? 每天上午10:15触发
|
||||
|
||||
0 15 10 * * ? * 每天上午10:15触发
|
||||
|
||||
0 * 14 * * ? 在每天下午2点到下午2:59期间的每1分钟触发
|
||||
|
||||
0 0/5 14 * * ? 在每天下午2点到下午2:55期间的每5分钟触发
|
||||
|
||||
0 0/5 14,18 * * ? 在每天下午2点到2:55期间和下午6点到6:55期间的每5分钟触发
|
||||
|
||||
0 0-5 14 * * ? 在每天下午2点到下午2:05期间的每1分钟触发
|
||||
|
||||
0 10,44 14 ? 3 WED 每年三月的星期三的下午2:10和2:44触发
|
||||
|
||||
0 15 10 ? * MON-FRI 周一至周五的上午10:15触发
|
||||
|
||||
0 15 10 15 * ? 每月15日上午10:15触发
|
||||
|
||||
0 15 10 L * ? 每月最后一日的上午10:15触发
|
||||
</pre>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
95
views/index.tpl
Normal file
95
views/index.tpl
Normal file
File diff suppressed because one or more lines are too long
139
views/main/index.html
Normal file
139
views/main/index.html
Normal file
@@ -0,0 +1,139 @@
|
||||
<div class="container-fluid">
|
||||
<div class="info-center">
|
||||
<!--title-->
|
||||
<div class="info-center">
|
||||
<div class="page-header">
|
||||
<div class="pull-left">
|
||||
<h4>{{.pageTitle}}</h4>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<!-- <button type="button" class="btn btn-mystyle btn-sm refresh">刷新</button>
|
||||
<button type="button" class="btn btn-mystyle btn-sm reback">返回</button> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<!--content-list-->
|
||||
<div class="content-list">
|
||||
<!-- <div class="row" style="height: 120px">
|
||||
<div class="col-md-3">
|
||||
<div class="content" style="height: 110px;">
|
||||
<div class="w30 left-icon pull-left">
|
||||
<span class="glyphicon glyphicon-ok green"></span>
|
||||
</div>
|
||||
<div class="w70 right-title pull-right">
|
||||
<div class="title-content">
|
||||
<p>今日执行任务成功的次数</p>
|
||||
<h3 class="number">11</h3>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="content" style="height: 110px;">
|
||||
<div class="w30 left-icon pull-left">
|
||||
<span class="glyphicon glyphicon-remove" style="background:#d9534f"></span>
|
||||
</div>
|
||||
<div class="w70 right-title pull-right">
|
||||
<div class="title-content">
|
||||
<p>今日执行任务失败的次数</p>
|
||||
<h3 class="number">0</h3>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="content" style="height: 110px;">
|
||||
<div class="w30 left-icon pull-left">
|
||||
<span class="glyphicon glyphicon-hourglass orange"></span>
|
||||
</div>
|
||||
<div class="w70 right-title pull-right">
|
||||
<div class="title-content">
|
||||
<p>即将执行的任务</p>
|
||||
<h3 class="number">1</h3>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="content" style="height: 110px;">
|
||||
<div class="w30 left-icon pull-left">
|
||||
<span class="glyphicon glyphicon-stats violet"></span>
|
||||
</div>
|
||||
<div class="w70 right-title pull-right">
|
||||
<div class="title-content">
|
||||
<p>定时任务总数量</p>
|
||||
<h3 class="number">10</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<!--信息列表-->
|
||||
<div class="row newslist" style="margin-top:20px;">
|
||||
<div class="col-md-6">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
最近执行的任务
|
||||
<a href="/" class="pull-right">
|
||||
<span class="glyphicon glyphicon-refresh"></span>
|
||||
</a>
|
||||
</div>
|
||||
{{range $k, $v := .recentLogs}}
|
||||
<div class="panel-body">
|
||||
<div class="w45 pull-left">
|
||||
<a href="{{urlfor "TaskController.ViewLog" "id" $v.id}}" class="news-item-title">{{$v.task_name}} # {{$v.id}}</a>
|
||||
</div>
|
||||
<div class="w45 pull-left">{{$v.start_time}} </div>
|
||||
<div class="w10 pull-left">
|
||||
{{if eq $v.status 0}}
|
||||
正常
|
||||
{{else if eq $v.status -1}}
|
||||
<span style="color:red">异常</span>
|
||||
{{else}}
|
||||
<span style="color:red">超时</span>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="panel-body">
|
||||
<div style="width: 100%">暂无信息</div>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
即将执行的任务
|
||||
<a href="/" class="pull-right"><span class="glyphicon glyphicon-refresh"></span></a>
|
||||
</div>
|
||||
|
||||
{{range $k, $v := .jobs}}
|
||||
<div class="panel-body">
|
||||
<div class="w50 pull-left">
|
||||
<a href="{{urlfor "TaskController.Logs" "id" $v.task_id}}" class="news-item-title">{{$v.task_name}} # {{$v.task_id}}</a>
|
||||
</div>
|
||||
<div class="w50 pull-left">{{$v.next_time}}</div>
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="panel-body">
|
||||
<div style="width: 100%">暂无信息</div>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
1
views/main/password.html
Normal file
1
views/main/password.html
Normal file
@@ -0,0 +1 @@
|
||||
密码修改
|
||||
90
views/main/profile.html
Normal file
90
views/main/profile.html
Normal file
@@ -0,0 +1,90 @@
|
||||
<!-- 个人资料 -->
|
||||
<div class="container-fluid">
|
||||
<div class="info-center">
|
||||
<!--title-->
|
||||
<div class="info-center">
|
||||
<div class="page-header">
|
||||
<div class="pull-left">
|
||||
<h4>{{.pageTitle}}</h4>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<!-- <button type="button" class="btn btn-mystyle btn-sm refresh">刷新</button>
|
||||
<button type="button" class="btn btn-mystyle btn-sm reback">返回</button> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!--content-list-->
|
||||
<div class="content-list">
|
||||
<form action="{{urlfor "MainController.Profile"}}" method="post" class="form-horizontal">
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="user_name">用户名</label>
|
||||
<div class="col-sm-3" >
|
||||
<input type="text" class="form-control input-sm" placeholder="" name="user_name" value="{{.user.UserName}}" disabled="" />
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-top:5px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="email">Email</label>
|
||||
<div class="col-sm-3" >
|
||||
<input type="text" class="form-control input-sm" placeholder="" name="email" value="{{.user.Email}}" />
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-top:5px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="password">新密码</label>
|
||||
<div class="col-sm-3" >
|
||||
<input type="text" class="form-control input-sm" placeholder="" name="password" value="" />
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-top:5px;">
|
||||
<i>不修改密码请留空</i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="concurrent">确认密码</label>
|
||||
<div class="col-sm-3" >
|
||||
<input type="text" class="form-control input-sm" placeholder="" name="password2" value="" />
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-top:5px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<br />
|
||||
<div class="modal-footer" style="text-align:center">
|
||||
<button type="submit" class="btn btn-primary submit_attr_button">保存</button>
|
||||
<button type="button" class="btn btn-default reback">返回</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
$("form").submit(function () {
|
||||
|
||||
$("button[type='submit']").attr('disabled', true);
|
||||
$.post('{{urlfor "MainController.Profile"}}', $(this).serialize(), function (out) {
|
||||
if (out.status == 0) {
|
||||
alert("保存成功");
|
||||
window.location.href = '{{urlfor "MainController.Index"}}';
|
||||
} else {
|
||||
alert_message(out.msg,"alert-danger","alert-success");
|
||||
$("button[type='submit']").attr('disabled', false);
|
||||
}
|
||||
}, "json");
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
329
views/public/layout.html
Normal file
329
views/public/layout.html
Normal file
@@ -0,0 +1,329 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
|
||||
<title>定时任务管理后台</title>
|
||||
<link href="/static/bootstrap/css/bootstrap.min.css" title="" rel="stylesheet" />
|
||||
|
||||
<link title="" href="/static/css/style.css" rel="stylesheet" type="text/css" />
|
||||
<link title="blue" href="/static/css/dermadefault.css" rel="stylesheet" type="text/css"/>
|
||||
<link title="green" href="/static/css/dermagreen.css" rel="stylesheet" type="text/css" disabled="disabled"/>
|
||||
<link title="orange" href="/static/css/dermaorange.css" rel="stylesheet" type="text/css" disabled="disabled"/>
|
||||
|
||||
<link href="/static/css/templatecss.css" rel="stylesheet" title="" type="text/css" />
|
||||
<script src="/static/js/jquery-1.11.1.min.js" type="text/javascript"></script>
|
||||
<script src="/static/js/jquery.cookie.js" type="text/javascript"></script>
|
||||
<script src="/static/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<nav class="nav navbar-default navbar-mystyle navbar-fixed-top">
|
||||
<div class="navbar-header">
|
||||
<button class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand mystyle-brand">
|
||||
<span class="glyphicon glyphicon-time"></span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="li-border">
|
||||
<a class="mystyle-color" href="#" style="font-size: 20px">定时任务管理后台</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="nav navbar-nav pull-right">
|
||||
<li class="li-border">
|
||||
|
||||
<a class="mystyle-color" href="#" id="server-time" style="font-size: 10px"></a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="nav navbar-nav pull-right">
|
||||
<li class="li-border">
|
||||
<a href="#" class="mystyle-color">
|
||||
<span class="glyphicon glyphicon-bell"></span>
|
||||
<span class="topbar-num">0</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="dropdown li-border">
|
||||
<a href="#" class="dropdown-toggle mystyle-color" data-toggle="dropdown">
|
||||
帮助文档<span class="caret"></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="/help">帮助文档</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown li-border">
|
||||
<a href="#" class="dropdown-toggle mystyle-color" data-toggle="dropdown">
|
||||
{{.loginUserName}}<span class="caret"></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="/logout">退出</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle mystyle-color" data-toggle="dropdown">
|
||||
换肤<span class="caret"></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu changecolor">
|
||||
<li id="blue"><a href="#">蓝色</a></li>
|
||||
<li class="divider"></li>
|
||||
<li id="green"><a href="#">绿色</a></li>
|
||||
<li class="divider"></li>
|
||||
<li id="orange"><a href="#">橙色</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="down-main">
|
||||
<div class="left-main left-full">
|
||||
<div class="sidebar-fold">
|
||||
<span class="glyphicon glyphicon-menu-hamburger"></span>
|
||||
</div>
|
||||
|
||||
<div class="subNavBox">
|
||||
<div class="sBox">
|
||||
<ul class="navContent" >
|
||||
<li {{if eq .curRoute "main.index"}}class="active"{{end}} id="home_page">
|
||||
<a href="/">
|
||||
<span class="sublist-icon glyphicon glyphicon-home"></span><span class="sub-title">系统首页</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="subNavBox">
|
||||
<div class="sBox">
|
||||
<div class="subNav sublist-down">
|
||||
<span class="title-icon glyphicon glyphicon-chevron-down"></span>
|
||||
<span class="sublist-title">任务管理</span>
|
||||
</div>
|
||||
<ul class="navContent" style="display:block">
|
||||
|
||||
<li {{if eq .menuTag "task"}}class="active"{{end}}>
|
||||
<div class="showtitle" style="width:100px;">
|
||||
任务列表
|
||||
</div>
|
||||
<a href="/task/list">
|
||||
<span class="sublist-icon glyphicon glyphicon-th-list"></span>
|
||||
<span class="sub-title">任务列表</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li {{if eq .menuTag "group"}}class="active"{{end}}>
|
||||
<div class="showtitle" style="width:100px;">
|
||||
任务分类
|
||||
</div>
|
||||
<a href="/group/list">
|
||||
<span class="sublist-icon glyphicon glyphicon-bookmark"></span>
|
||||
<span class="sub-title">任务分类</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li {{if eq .curRoute "help.index"}}class="active"{{end}}>
|
||||
<div class="showtitle" style="width:100px;">
|
||||
使用帮助
|
||||
</div>
|
||||
<a href="/help">
|
||||
<span class="sublist-icon glyphicon glyphicon-question-sign"></span>
|
||||
<span class="sub-title">使用帮助</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="subNavBox">
|
||||
<div class="sBox">
|
||||
<div class="subNav sublist-down">
|
||||
<span class="title-icon glyphicon glyphicon-chevron-down"></span>
|
||||
<span class="sublist-title">账户管理</span>
|
||||
</div>
|
||||
<ul class="navContent" >
|
||||
|
||||
<li {{if eq .curRoute "main.profile"}}class="active"{{end}}>
|
||||
<div class="showtitle" style="width:100px;">
|
||||
资料修改
|
||||
</div>
|
||||
<a href="/profile">
|
||||
<span class="sublist-icon glyphicon glyphicon-user"></span>
|
||||
<span class="sub-title">资料修改</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="right-product view-product right-full">
|
||||
<!--message start-->
|
||||
<div class="message">
|
||||
<div class="alert alert-danger box" role="alert" style="padding: 0px; line-height: 40px">
|
||||
<div class="col-sm-1 pull-right">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-11 pull-left">
|
||||
<strong id="message">保存成功</strong>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--message end-->
|
||||
{{.LayoutContent}}
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
function alert_message(message,addClass,removeClass)
|
||||
{
|
||||
$('.box').addClass(addClass);
|
||||
$('.box').removeClass(removeClass);
|
||||
$("#message").html(message);
|
||||
$('.message').fadeIn(1000);
|
||||
$('.message').fadeOut(5000);
|
||||
}
|
||||
$(function(){
|
||||
/*换肤*/
|
||||
$(".dropdown .changecolor li").click(function(){
|
||||
var style = $(this).attr("id");
|
||||
$("link[title!='']").attr("disabled","disabled");
|
||||
$("link[title='"+style+"']").removeAttr("disabled");
|
||||
|
||||
$.cookie('mystyle', style, { expires: 7 }); // 存储一个带7天期限的 cookie
|
||||
})
|
||||
var cookie_style = $.cookie("mystyle");
|
||||
if(cookie_style!=null){
|
||||
$("link[title!='']").attr("disabled","disabled");
|
||||
$("link[title='"+cookie_style+"']").removeAttr("disabled");
|
||||
}
|
||||
/*左侧导航栏显示隐藏功能*/
|
||||
$(".subNav").click(function(){
|
||||
/*显示*/
|
||||
if($(this).find("span:first-child").attr('class')=="title-icon glyphicon glyphicon-chevron-down")
|
||||
{
|
||||
$(this).find("span:first-child").removeClass("glyphicon-chevron-down");
|
||||
$(this).find("span:first-child").addClass("glyphicon-chevron-up");
|
||||
$(this).removeClass("sublist-down");
|
||||
$(this).addClass("sublist-up");
|
||||
}
|
||||
/*隐藏*/
|
||||
else
|
||||
{
|
||||
$(this).find("span:first-child").removeClass("glyphicon-chevron-up");
|
||||
$(this).find("span:first-child").addClass("glyphicon-chevron-down");
|
||||
$(this).removeClass("sublist-up");
|
||||
$(this).addClass("sublist-down");
|
||||
}
|
||||
// 修改数字控制速度, slideUp(500)控制卷起速度
|
||||
$(this).next(".navContent").slideToggle(300).siblings(".navContent").slideUp(300);
|
||||
})
|
||||
/*左侧导航栏缩进功能*/
|
||||
$(".left-main .sidebar-fold").click(function(){
|
||||
if($(this).parent().attr('class')=="left-main left-full")
|
||||
{
|
||||
$(this).parent().removeClass("left-full");
|
||||
$(this).parent().addClass("left-off");
|
||||
|
||||
$(this).parent().parent().find(".right-product").removeClass("right-full");
|
||||
$(this).parent().parent().find(".right-product").addClass("right-off");
|
||||
}
|
||||
else
|
||||
{
|
||||
$(this).parent().removeClass("left-off");
|
||||
$(this).parent().addClass("left-full");
|
||||
|
||||
$(this).parent().parent().find(".right-product").removeClass("right-off");
|
||||
$(this).parent().parent().find(".right-product").addClass("right-full");
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
/*左侧鼠标移入提示功能*/
|
||||
$(".sBox ul li").mouseenter(function(){
|
||||
if($(this).find("span:last-child").css("display")=="none")
|
||||
{$(this).find("div").show();}
|
||||
}).mouseleave(function(){$(this).find("div").hide();})
|
||||
});
|
||||
|
||||
/*刷新*/
|
||||
$(".refresh").on("click",function() {
|
||||
window.location.reload();
|
||||
});
|
||||
|
||||
/*返回上一页*/
|
||||
$(".reback").on("click",function() {
|
||||
window.history.go(-1);
|
||||
});
|
||||
|
||||
/*全选*/
|
||||
$("input[name=all_check]").click(function(){
|
||||
var all_status = this.checked;
|
||||
//全选
|
||||
if(all_status == true){
|
||||
$(".chk").find("input[type=checkbox]").each(function(){
|
||||
|
||||
if($(this).val()>0){
|
||||
$(this).prop("checked",true);
|
||||
}
|
||||
});
|
||||
}
|
||||
if(all_status == false){
|
||||
//反选
|
||||
$(".chk").find("input[type=checkbox]:checked").each(function(){
|
||||
if($(this).val()>0){
|
||||
$(this).prop("checked",false);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//服务器时间
|
||||
Date.prototype.Format = function (fmt) {
|
||||
var o = {
|
||||
"M+": this.getMonth() + 1,
|
||||
"d+": this.getDate(),
|
||||
"h+": this.getHours(),
|
||||
"m+": this.getMinutes(),
|
||||
"s+": this.getSeconds(),
|
||||
"q+": Math.floor((this.getMonth() + 3) / 3),
|
||||
"S": this.getMilliseconds()
|
||||
};
|
||||
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
|
||||
for (var k in o)
|
||||
if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
|
||||
return fmt;
|
||||
}
|
||||
|
||||
$(function () {
|
||||
$('.subnavbar').find ('li').each (function (i) {
|
||||
var mod = i % 3;
|
||||
if (mod === 2) {
|
||||
$(this).addClass ('subnavbar-open-right');
|
||||
}
|
||||
});
|
||||
initTime = new Date().getTime();
|
||||
$.getJSON("/gettime", function(out) {
|
||||
setTime(initTime, out.time);
|
||||
});
|
||||
});
|
||||
|
||||
function setTime(initTime,serverTime) {
|
||||
ellapsedTime = new Date().getTime()-initTime;
|
||||
$('#server-time').html('当前服务器时间: <strong>'+new Date(serverTime+ellapsedTime).Format("yyyy-MM-dd hh:mm:ss")+'</strong>');
|
||||
setTimeout('setTime('+initTime+','+serverTime+');',500);
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
93
views/public/login.html
Normal file
93
views/public/login.html
Normal file
@@ -0,0 +1,93 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="login_page_html">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>登录</title>
|
||||
<link rel='shortcut icon' href="/static/img/favicon.png"/>
|
||||
<link rel="stylesheet" type="text/css" href="/static/login/style.css" />
|
||||
<link href="/static/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<!--登录超时,跳出框架显示登录页 start-->
|
||||
<script>
|
||||
if(self.location !== top.location){
|
||||
top.location = self.location;
|
||||
}
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
/**
|
||||
* 提示信息框
|
||||
*/
|
||||
.message{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
z-index: 9999;
|
||||
display: none;
|
||||
}
|
||||
.message .box{
|
||||
position: absolute;
|
||||
left: 0%;
|
||||
top: 0%;
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
</style>
|
||||
<!--登录超时,跳出框架显示登录页 end-->
|
||||
<body class="login_page">
|
||||
<div class="login_page_bg">
|
||||
<div class="login_page_panel">
|
||||
<h1 style="color: #fff;font-size: 40px;text-align:center;">定时任务管理</h1>
|
||||
<form action="/login" method="post">
|
||||
<div class="username">
|
||||
<input type="text" name="username" id="username" class="box_sizing" autofocus="autofocus" autocomplete="off" placeholder="账号" required />
|
||||
</div>
|
||||
<div class="password">
|
||||
<input type="password" name="password" id="password" class="box_sizing" placeholder="密码" required />
|
||||
</div>
|
||||
|
||||
<div class="remember" style="margin-top: 10px;color: #fff">
|
||||
<input type="checkbox" name="remember" id="remember" value="yes"> 一周内自动登录
|
||||
</div>
|
||||
|
||||
<div class="login_button">
|
||||
<button id="login_button" class="box_sizing">登 录</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--message start-->
|
||||
<div class="message">
|
||||
<div class="alert alert-danger box" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<strong id="message">保存成功</strong>
|
||||
</div>
|
||||
</div>
|
||||
<!--message end-->
|
||||
<script src="/static/js/jquery-1.11.1.min.js"></script>
|
||||
<script src="/static/bootstrap/js/bootstrap.js"></script>
|
||||
<script type="text/javascript">
|
||||
//alert-success alert-danger
|
||||
function alert_message(message,addClass,removeClass)
|
||||
{
|
||||
$('.box').addClass(addClass);
|
||||
$('.box').removeClass(removeClass);
|
||||
$("#message").html(message);
|
||||
$('.message').fadeIn(1000);
|
||||
$('.message').fadeOut(4000);
|
||||
}
|
||||
var error_info = "{{.flash.error}}";
|
||||
if(error_info)
|
||||
{
|
||||
alert_message(error_info,"alert-danger","alert-success");
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
167
views/task/add.html
Normal file
167
views/task/add.html
Normal file
@@ -0,0 +1,167 @@
|
||||
<!-- 新增任务 -->
|
||||
<div class="container-fluid">
|
||||
<div class="info-center">
|
||||
<!--title-->
|
||||
<div class="info-center">
|
||||
<div class="page-header">
|
||||
<div class="pull-left">
|
||||
<h4>{{.pageTitle}}</h4>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<!-- <button type="button" class="btn btn-mystyle btn-sm refresh">刷新</button>
|
||||
<button type="button" class="btn btn-mystyle btn-sm reback">返回</button> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!--content-list-->
|
||||
<div class="content-list">
|
||||
<form action="{{urlfor "TaskController.Add"}}" method="post" class="form-horizontal">
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="task_name">任务名称</label>
|
||||
<div class="col-sm-3" >
|
||||
<input type="text" class="form-control input-sm" placeholder="" name="task_name" value="" required />
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-top:5px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="description">任务说明</label>
|
||||
<div class="col-sm-5" >
|
||||
<textarea name="description" class="form-control" id="description" rows="3"></textarea>
|
||||
</div>
|
||||
<div class="col-sm-4" style="padding-top:5px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="group_id">任务分组</label>
|
||||
<div class="col-sm-3" >
|
||||
<select name="group_id" class="form-control">
|
||||
<option value="0">未分组</option>
|
||||
{{range $k, $v := .groups}}
|
||||
<option value="{{$v.Id}}">{{$v.GroupName}}</option>
|
||||
{{end}}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-top:5px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="concurrent">是否单例</label>
|
||||
<div class="col-sm-3" >
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="concurrent" value="0" checked> 是
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="concurrent" value="1"> 否
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-top:5px;">
|
||||
<i>设为“是”的话,如果该任务在上一个时间点还没执行完,则略过不执行</i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="cron_spec">时间表达式</label>
|
||||
<div class="col-sm-3" >
|
||||
<input type="text" class="form-control input-sm" placeholder="" name="cron_spec" value="" />
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-top:5px;">
|
||||
<a href="{{urlfor "HelpController.Index"}}" target="_blank">参见使用帮助</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="command">命令脚本</label>
|
||||
<div class="col-sm-5" >
|
||||
<textarea name="command" class="form-control" id="command" rows="3"></textarea>
|
||||
</div>
|
||||
<div class="col-sm-4" style="padding-top:5px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="timeout">超时设置</label>
|
||||
<div class="col-sm-3" >
|
||||
<input type="text" class="form-control input-sm" placeholder="秒" name="timeout" value="" />
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-top:5px;">
|
||||
单位秒,不设置的话,默认超时时间为1天
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="notify">邮件通知</label>
|
||||
<div class="col-sm-6" >
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="notify" value="0" checked> 不通知
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="notify" value="1"> 执行失败通知
|
||||
</label>
|
||||
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="notify" value="2"> 执行结束通知
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-sm-3" style="padding-top:5px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group notify_email hide" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="notify_email">通知邮件抄送人</label>
|
||||
<div class="col-sm-5" >
|
||||
<textarea name="notify_email" class="form-control" id="notify_email" rows="3"></textarea>
|
||||
</div>
|
||||
<div class="col-sm-4" style="padding-top:5px;">
|
||||
每行一个email地址,如果不需要抄送给其他人请留空
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<div class="modal-footer" style="text-align:center">
|
||||
<button type="submit" class="btn btn-primary submit_attr_button">保存</button>
|
||||
<button type="button" class="btn btn-default reback">返回</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
$("form").submit(function () {
|
||||
// $(".alert").hide();
|
||||
$("button[type='submit']").attr('disabled', true);
|
||||
$.post('{{urlfor "TaskController.Add"}}', $(this).serialize(), function (out) {
|
||||
if (out.status == 0) {
|
||||
window.location.href = '{{urlfor "TaskController.List"}}';
|
||||
} else {
|
||||
alert_message(out.msg,"alert-danger","alert-success");
|
||||
// $(".alert").text(out.msg);
|
||||
// $(".alert").show();
|
||||
$("button[type='submit']").attr('disabled', false);
|
||||
}
|
||||
}, "json");
|
||||
return false;
|
||||
});
|
||||
$("input[name='notify']").click(function () {
|
||||
if ($(this).val() > 0) {
|
||||
$('.notify_email').removeClass('hide');
|
||||
} else {
|
||||
$('.notify_email').addClass('hide');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
166
views/task/edit.html
Normal file
166
views/task/edit.html
Normal file
@@ -0,0 +1,166 @@
|
||||
<!-- 新增任务 -->
|
||||
<div class="container-fluid">
|
||||
<div class="info-center">
|
||||
<!--title-->
|
||||
<div class="info-center">
|
||||
<div class="page-header">
|
||||
<div class="pull-left">
|
||||
<h4>{{.pageTitle}}</h4>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<!-- <button type="button" class="btn btn-mystyle btn-sm refresh">刷新</button>
|
||||
<button type="button" class="btn btn-mystyle btn-sm reback">返回</button> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!--content-list-->
|
||||
<div class="content-list">
|
||||
<form action="{{urlfor "TaskController.Add"}}" method="post" class="form-horizontal">
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="task_name">任务名称</label>
|
||||
<div class="col-sm-3" >
|
||||
<input type="text" class="form-control input-sm" placeholder="" name="task_name" value="{{.task.TaskName}}" />
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-top:5px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="task_name">任务说明</label>
|
||||
<div class="col-sm-5" >
|
||||
<textarea name="description" class="form-control" id="description" rows="3">{{.task.Description}}</textarea>
|
||||
</div>
|
||||
<div class="col-sm-4" style="padding-top:5px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="task_name">任务分组</label>
|
||||
<div class="col-sm-3" >
|
||||
<select name="group_id" class="form-control">
|
||||
<option value="0">未分组</option>
|
||||
{{range $k, $v := .groups}}
|
||||
<option value="{{$v.Id}}" {{if eq $v.Id $.task.GroupId}}selected{{end}}>{{$v.GroupName}}</option>
|
||||
{{end}}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-top:5px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="concurrent">是否单例</label>
|
||||
<div class="col-sm-3" >
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="concurrent" value="0" {{if eq .task.Concurrent 0}}checked{{end}}> 是
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="concurrent" value="1" {{if eq .task.Concurrent 1}}checked{{end}}> 否
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-top:5px;">
|
||||
<i>设为“是”的话,如果该任务在上一个时间点还没执行完,则略过不执行</i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="cron_spec">时间表达式</label>
|
||||
<div class="col-sm-3" >
|
||||
<input type="text" class="form-control input-sm" placeholder="" name="cron_spec" value="{{.task.CronSpec}}" />
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-top:5px;">
|
||||
<a href="{{urlfor "HelpController.Index"}}" target="_blank">参见使用帮助</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="task_name">命令脚本</label>
|
||||
<div class="col-sm-5" >
|
||||
<textarea name="command" class="form-control" id="command" rows="3">{{.task.Command}}</textarea>
|
||||
</div>
|
||||
<div class="col-sm-4" style="padding-top:5px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="cron_spec">超时设置</label>
|
||||
<div class="col-sm-3" >
|
||||
<input type="text" class="form-control input-sm" placeholder="秒" name="timeout" value="{{.task.Timeout}}" />
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-top:5px;">
|
||||
单位秒,不设置的话,默认超时时间为1天
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="concurrent">邮件通知</label>
|
||||
<div class="col-sm-6" >
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="notify" value="0" {{if eq .task.Notify 0}}checked{{end}}> 不通知
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="notify" value="1" {{if eq .task.Notify 1}}checked{{end}}> 执行失败通知
|
||||
</label>
|
||||
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="notify" value="2" {{if eq .task.Notify 2}}checked{{end}}> 执行结束通知
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-sm-3" style="padding-top:5px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group notify_email {{if eq .task.Notify 0}}hide{{end}}" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="task_name">通知邮件抄送人</label>
|
||||
<div class="col-sm-5" >
|
||||
<textarea name="notify_email" class="form-control" id="notify_email" rows="3">{{.task.NotifyEmail}}</textarea>
|
||||
</div>
|
||||
<div class="col-sm-4" style="padding-top:5px;">
|
||||
每行一个email地址,如果不需要抄送给其他人请留空
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<input type="hidden" name="id" value="{{.task.Id}}" />
|
||||
<div class="modal-footer" style="text-align:center">
|
||||
<button type="submit" class="btn btn-primary submit_attr_button">保存</button>
|
||||
<button type="button" class="btn btn-default reback">返回</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
$("form").submit(function () {
|
||||
$("button[type='submit']").attr('disabled', true);
|
||||
$.post('{{urlfor "TaskController.Edit"}}', $(this).serialize(), function (out) {
|
||||
if (out.status == 0) {
|
||||
window.location.href = '{{urlfor "TaskController.List"}}';
|
||||
} else {
|
||||
alert_message(out.msg,"alert-danger","alert-success");
|
||||
$("button[type='submit']").attr('disabled', false);
|
||||
}
|
||||
}, "json");
|
||||
return false;
|
||||
});
|
||||
|
||||
$("input[name='notify']").click(function () {
|
||||
if ($(this).val() > 0) {
|
||||
$('.notify_email').removeClass('hide');
|
||||
} else {
|
||||
$('.notify_email').addClass('hide');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
156
views/task/list.html
Normal file
156
views/task/list.html
Normal file
@@ -0,0 +1,156 @@
|
||||
<!-- 任务列表 -->
|
||||
<div class="container-fluid">
|
||||
<div class="info-center">
|
||||
<!--title-->
|
||||
<div class="info-center">
|
||||
<div class="page-header">
|
||||
<div class="pull-left">
|
||||
<h4>{{.pageTitle}}</h4>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<!-- <button type="button" class="btn btn-mystyle btn-sm refresh">刷新</button>
|
||||
<button type="button" class="btn btn-mystyle btn-sm reback">返回</button> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<!--content-list-->
|
||||
<div class="content-list">
|
||||
<div class="search-box row">
|
||||
<div class="col-md-4">
|
||||
<div class="btn-group pull-left" role="group" aria-label="...">
|
||||
<a href='{{urlfor "TaskController.Add"}}' class="btn btn-primary"><span class="glyphicon glyphicon-plus"></span> 新增任务</a>
|
||||
<div class="btn-group" role="group">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<span class="glyphicon glyphicon-edit"></span> 批量操作
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="javascript:;" onclick="javascript:batch('active');"><span class="glyphicon glyphicon-expand" aria-hidden="true"></span> 激活</a></li>
|
||||
<li><a href="javascript:;" onclick="javascript:batch('pause');"><span class="glyphicon glyphicon-pause" aria-hidden="true"></span> 暂停</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="javascript:;" onclick="javascript:batch('delete');"><span class="glyphicon glyphicon-remove-sign" aria-hidden="true"></span> 删除</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class=" btn-large pull-right" >
|
||||
<form method="post" name="s" action="{{urlfor "TaskController.List"}}">
|
||||
<select name="groupid" class="btn-large form-control">
|
||||
<option value="0">全部分组</option>
|
||||
{{range $k, $v := .groups}}
|
||||
<option value="{{$v.Id}}" {{if eq $v.Id $.groupid}}selected{{end}} >{{$v.GroupName}}</option>
|
||||
{{end}}
|
||||
|
||||
</select>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
<div class="table-margin">
|
||||
<form id="form-list" method="post" action="">
|
||||
<table class="table table-bordered table-header">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><input type="checkbox" name="all_check" /></td>
|
||||
<td>ID</td>
|
||||
<td width="20%">任务名称</td>
|
||||
<td>时间表达式</td>
|
||||
<td>上次执行时间</td>
|
||||
<td>下次执行时间</td>
|
||||
<td width="25%">操作</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{range $k,$v := .list}}
|
||||
<tr>
|
||||
<td class="chk"><input type="checkbox" name="ids" value="{{$v.id}}" /></td>
|
||||
<td> {{$v.id}} </td>
|
||||
<td>
|
||||
{{if eq $v.running 0}}
|
||||
<span class="glyphicon glyphicon-minus-sign brand-danger" aria-hidden="true"></span>
|
||||
{{else}}
|
||||
<span class="glyphicon glyphicon-ok-sign brand-success " aria-hidden="true"></span>
|
||||
{{end}}
|
||||
{{$v.name}}
|
||||
</td>
|
||||
<td> {{$v.cron_spec}} </td>
|
||||
<td> {{$v.prev_time}} </td>
|
||||
<td> {{$v.next_time}} </td>
|
||||
<td>
|
||||
{{if eq $v.status 0}}
|
||||
<a class="btn btn-danger btn-xs" href="{{urlfor "TaskController.Start"}}?id={{$v.id}}">
|
||||
<span class="glyphicon glyphicon-expand" aria-hidden="true"></span> 激活
|
||||
</a>
|
||||
{{else}}
|
||||
<a class="btn btn-success btn-xs" href="{{urlfor "TaskController.Pause"}}?id={{$v.id}}">
|
||||
<span class="glyphicon glyphicon-pause" aria-hidden="true"></span> 暂停
|
||||
</a>
|
||||
{{end}}
|
||||
<a class="btn btn-info btn-xs" href="{{urlfor "TaskController.Edit"}}?id={{$v.id}}">
|
||||
<span class="glyphicon glyphicon-edit" aria-hidden="true"></span> 编辑
|
||||
</a>
|
||||
<a class="btn btn-info btn-run btn-xs" href="{{urlfor "TaskController.Run"}}?id={{$v.id}}">
|
||||
<span class="glyphicon glyphicon-flash" aria-hidden="true"></span> 执行
|
||||
</a>
|
||||
<a class="btn btn-info btn-xs" href="{{urlfor "TaskController.Logs"}}?id={{$v.id}}">
|
||||
<span class="glyphicon glyphicon-file" aria-hidden="true"></span> 日志
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="7">
|
||||
<div class="pull-right">
|
||||
{{str2html .pageBar}}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$('[data-toggle="tooltip"]').tooltip()
|
||||
$("select[name='groupid']").change(function () {
|
||||
$("form[name='s']").submit();
|
||||
});
|
||||
$(".btn-run").click(function () {
|
||||
return confirm("该功能建议只用来做任务测试,确定要立即执行该任务吗?");
|
||||
});
|
||||
});
|
||||
|
||||
function batch(action) {
|
||||
|
||||
if ($("input[name=ids]:checked").size() < 1) {
|
||||
alert_message("请选择要操作的任务","alert-danger","alert-success");
|
||||
} else {
|
||||
|
||||
if(action=='delete'){
|
||||
if(!confirm("确定要删除所选吗?")) return;
|
||||
}
|
||||
|
||||
var url = "{{urlfor "TaskController.Batch"}}";
|
||||
$.post(url + "?action=" + action, $("#form-list").serialize(), function(out) {
|
||||
if (out.status != 0) {
|
||||
alert_message(out.msg,"alert-danger","alert-success");
|
||||
} else {
|
||||
window.location.reload();
|
||||
}
|
||||
}, "json");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
130
views/task/logs.html
Normal file
130
views/task/logs.html
Normal file
@@ -0,0 +1,130 @@
|
||||
<!-- 新增任务 -->
|
||||
<div class="container-fluid">
|
||||
<div class="info-center">
|
||||
<!--title-->
|
||||
<div class="info-center">
|
||||
<div class="page-header">
|
||||
<div class="pull-left">
|
||||
<h4>{{.pageTitle}}</h4>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<!-- <button type="button" class="btn btn-mystyle btn-sm refresh">刷新</button>
|
||||
<button type="button" class="btn btn-mystyle btn-sm reback">返回</button> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!--content-list-->
|
||||
<div class="content-list">
|
||||
<div class="search-box row">
|
||||
<p>
|
||||
<h5>{{.task.TaskName}} (#{{.task.Id}})</h5>
|
||||
<pre>{{.task.Command}}</pre>
|
||||
</p>
|
||||
</div>
|
||||
<hr />
|
||||
<div class="mt20"></div>
|
||||
<div class="search-box row">
|
||||
<div class="col-md-4">
|
||||
<div class="btn-group pull-left" role="group" aria-label="...">
|
||||
<div class="btn-group" role="group">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
批量操作
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
|
||||
<li><a href="javascript:;" onclick="javascript:batch('delete');"> <span class="glyphicon glyphicon-remove-sign"></span> 删除</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<button type="button" class="btn btn-default reback">返回</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
<div class="table-margin">
|
||||
<form id="form-list" method="post" action="">
|
||||
<table class="table table-bordered table-header">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><input type="checkbox" name="all_check" /></td>
|
||||
<td>ID</td>
|
||||
<td width="20%">开始时间</td>
|
||||
<td>执行时间</td>
|
||||
<td>输出</td>
|
||||
<td>状态</td>
|
||||
<td width="10%">操作</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{range $k,$v := .list}}
|
||||
<tr>
|
||||
<td class="chk"><input type="checkbox" name="ids" value="{{$v.id}}" /></td>
|
||||
<td> {{$v.id}} </td>
|
||||
<td> {{$v.start_time}} </td>
|
||||
<td>{{$v.process_time}} 秒</td>
|
||||
<td>{{$v.ouput_size}}</td>
|
||||
|
||||
<td>
|
||||
{{if eq $v.status 0}}
|
||||
<span class="glyphicon glyphicon-ok-sign brand-success" aria-hidden="true"> </span>正常
|
||||
{{else if eq $v.status -1}}
|
||||
<span class="glyphicon glyphicon-remove-sign brand-danger" aria-hidden="true"> </span> 出错
|
||||
{{else if eq $v.status -2}}
|
||||
<span class="glyphicon glyphicon-exclamation-sign brand-warning" aria-hidden="true"> </span> 超时
|
||||
{{end}}
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<a class="btn btn-info btn-xs" href="{{urlfor "TaskController.ViewLog"}}?id={{$v.id}}">
|
||||
<i class="glyphicon glyphicon-file"></i> 详情
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="7">
|
||||
<div class="pull-right">
|
||||
{{str2html .pageBar}}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
function batch(action) {
|
||||
if ($("input[name='ids']:checked").size() < 1) {
|
||||
alert_message("请选择要操作的任务","alert-danger","alert-success");
|
||||
} else {
|
||||
if (!confirm("确实要删除所选吗?")) return;
|
||||
var url = "{{urlfor "TaskController.LogBatch"}}";
|
||||
$.post(url + "?action=" + action, $("#form-list").serialize(), function(out) {
|
||||
if (out.status != 0) {
|
||||
alert_message(out.msg,"alert-danger","alert-success");
|
||||
} else {
|
||||
window.location.reload();
|
||||
}
|
||||
}, "json");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
47
views/task/viewlog.html
Normal file
47
views/task/viewlog.html
Normal file
@@ -0,0 +1,47 @@
|
||||
<!-- 新增任务 -->
|
||||
<div class="container-fluid">
|
||||
<div class="info-center">
|
||||
<!--title-->
|
||||
<div class="info-center">
|
||||
<div class="page-header">
|
||||
<div class="pull-left">
|
||||
<h4>{{.pageTitle}}</h4>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<!-- <button type="button" class="btn btn-mystyle btn-sm refresh">刷新</button>
|
||||
<button type="button" class="btn btn-mystyle btn-sm reback">返回</button> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!--content-list-->
|
||||
<div class="content-list">
|
||||
<div class="search-box row">
|
||||
<h4>{{.task.TaskName}}</h4>
|
||||
日志ID:#{{.data.id}} <br />
|
||||
执行时间:{{.data.start_time}} <br />
|
||||
执行耗时:{{.data.process_time}}秒 <br />
|
||||
输出大小:{{.data.ouput_size}}
|
||||
|
||||
<hr />
|
||||
<h4>任务命令</h4>
|
||||
<pre class="pre-scrollable">{{.task.Command}}</pre>
|
||||
<hr />
|
||||
|
||||
<h4>执行输出</h4>
|
||||
<pre class="pre-scrollable">{{.data.output}}</pre>
|
||||
|
||||
<h4>错误输出</h4>
|
||||
<pre class="pre-scrollable">{{.data.error}}</pre>
|
||||
<hr />
|
||||
|
||||
<div class="btn-group">
|
||||
<a href="{{urlfor "TaskController.Logs" "id" .task.Id}}" class="btn btn-default"><span class="icon-chevron-left"></span> 返 回</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user