修复#2号bug-激活状态无法编辑任务,需要先暂停任务

This commit is contained in:
郝大全
2017-12-01 10:59:35 +08:00
parent 08a4cd00f8
commit 05e5e45752
3 changed files with 16 additions and 3 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
PPGo_Job

View File

@@ -149,6 +149,10 @@ func (this *TaskController) Edit() {
this.showMsg(err.Error())
}
if task.Status != 0 {
this.ajaxMsg("激活状态无法编辑任务,请先暂停任务", MSG_ERR)
}
if this.isPost() {
task.TaskName = strings.TrimSpace(this.GetString("task_name"))
task.Description = strings.TrimSpace(this.GetString("description"))

View File

@@ -91,14 +91,21 @@
<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}}
{{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}}">
{{end}}
{{if eq $v.status 0}}
<a class="btn btn-info btn-xs" href="{{urlfor "TaskController.Edit"}}?id={{$v.id}}">
<span class="glyphicon glyphicon-edit" aria-hidden="true"></span> 编辑
</a>
{{else}}
<a class="btn btn-default btn-xs" href="javascript:return alert('激活状态无法编辑任务,请先暂停任务');">
<span class="glyphicon glyphicon-edit" aria-hidden="true"></span> 编辑
</a>
{{end}}
<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>