1、新增服务器资源添加 (新增数据表pp_task_server)
2、新增远程服务器任务执行
3、删除邮件通知功能(pp_task删除两个有关字段)
This commit is contained in:
郝大全
2017-08-17 11:49:53 +08:00
parent 2f15d46d83
commit 3c87908dde
25 changed files with 939 additions and 276 deletions

View File

@@ -55,6 +55,21 @@
</div>
</div>
<div class="form-group" style="margin-top: 15px">
<label class="col-sm-3 control-label" for="server_id">服务器</label>
<div class="col-sm-3" >
<select name="server_id" class="form-control">
<option value="0">本地服务器</option>
{{range $ks, $vs := .servers}}
<option value="{{$vs.Id}}">{{$vs.ServerName}}</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" >
@@ -100,35 +115,6 @@
</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 readonly> 不通知
</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;">
<i style="font-size: 12px;color: red">暂不支持</i>
</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>
@@ -141,28 +127,17 @@
<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 () {
// alert("暂不启用");
// return;
if ($(this).val() > 0) {
$('.notify_email').removeClass('hide');
} else {
$('.notify_email').addClass('hide');
}
});
});
</script>

View File

@@ -56,6 +56,21 @@
</div>
</div>
<div class="form-group" style="margin-top: 15px">
<label class="col-sm-3 control-label" for="server_id">服务器</label>
<div class="col-sm-3" >
<select name="server_id" class="form-control">
<option value="0">本地服务器</option>
{{range $ks, $vs := .servers}}
<option value="{{$vs.Id}}" {{if eq $vs.Id $.task.ServerId}}selected{{end}}>{{$vs.ServerName}}</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" >
@@ -102,35 +117,6 @@
</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;">
<i style="font-size: 12px;color: red">暂不支持</i>
</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">
@@ -155,13 +141,5 @@ $(function () {
}, "json");
return false;
});
$("input[name='notify']").click(function () {
if ($(this).val() > 0) {
$('.notify_email').removeClass('hide');
} else {
$('.notify_email').addClass('hide');
}
});
});
</script>

View File

@@ -60,7 +60,8 @@
<td><input type="checkbox" name="all_check" /></td>
<td>ID</td>
<td width="20%">任务名称</td>
<td>时间表达式</td>
<td>服务器</td>
<td>任务说明</td>
<td>上次执行时间</td>
<td>下次执行时间</td>
@@ -80,7 +81,8 @@
{{end}}
{{$v.group_name}}-{{$v.name}}
</td>
<td> {{$v.cron_spec}} </td>
<td> {{$v.server_name}} </td>
<td> {{$v.description}} </td>
<td> {{$v.prev_time}} </td>
<td> {{$v.next_time}} </td>
@@ -110,7 +112,7 @@
</tbody>
<tfoot>
<tr>
<td colspan="9">
<td colspan="8">
<div class="pull-right">
{{str2html .pageBar}}
</div>