编辑任务-主机名默认选中

pull/21/merge
ouqiang 2017-04-18 09:13:57 +08:00
parent 5ab787dff5
commit f57561118d
3 changed files with 4 additions and 3 deletions

View File

@ -45,11 +45,10 @@ func Edit(ctx *macaron.Context) {
}
taskModel := new(models.Task)
task, err := taskModel.Detail(id)
if err != nil {
if err != nil || taskModel.Id != id {
logger.Errorf("编辑任务#获取任务详情失败#任务ID-%d#%s", id, err.Error())
ctx.Redirect("/task")
}
ctx.Data["TaskId"] = id
ctx.Data["Task"] = task
ctx.Data["Title"] = "编辑"
ctx.Data["Hosts"] = hosts

View File

@ -36,7 +36,9 @@
<td>{{{.Port}}}</td>
<td>{{{.Remark}}}</td>
<td>
<button class="ui pink button" >编辑</button>
<button class="ui positive button" onclick="util.removeConfirm('/host/remove/{{{.Id}}}')">删除</button>
<button class="ui pink button" >连接测试</button>
<button class="ui pink button" >查看任务</button>
</td>
</tr>

View File

@ -56,7 +56,7 @@
<div class="ui radio checkbox">
{{{if $.Task}}}
<input type="radio" name="host_id" tabindex="0" class="hidden" value="{{{.Id}}}"
{{{if and .Task (eq $.TaskId .Id)}}} checked {{{end}}}
{{{if eq $.Task.HostId .Id}}} checked {{{end}}}
>
{{{else}}}
<input type="radio" name="host_id" tabindex="0" class="hidden">