@ -1,5 +1,4 @@
{{{ template "common/header" . }}}
< div class = "ui grid" >
{{{template "task/menu" .}}}
< div class = "twelve wide column" >
@ -14,107 +13,74 @@
< / div >
< / div >
< form class = "ui form" >
< div class = "five fields" >
< div class = "six fields search" >
< div class = "one wide field" >
< input type = "text" placeholder = "任务ID" name = "id" value = "{{{if gt .Params.Id 0}}}{{{.Params.Id}}}{{{end}}}" >
< / div >
< div class = "field" >
< input type = "text" placeholder = "任务名称" name = "name" >
< input type = "text" placeholder = "任务名称" name = "name" value = "{{{.Params.Name}}}" >
< / div >
< div class = "field" >
< label > 主机< / label >
< div class = "ui dropdown selection" >
< input type = "hidden" name = "protocol" value = "{{{if gt .Params.Protocol 0}}}{{{.Params.Protocol}}}{{{else}}}3{{{end}}}" >
< div class = "default text" > 本地命令< / div >
< i class = "dropdown icon" > < / i >
< div class = "menu" >
< div class = "item" data-value = "3" > 本地命令< / div >
< div class = "item" data-value = "2" > SSH< / div >
< div class = "item" data-value = "1" > HTTP< / div >
< / div >
< / div >
< div class = "inline fields" >
< select name = "host_id" id = "hostId" >
< option value = "" > 选择主机< / option >
{{{range $i, $v := .Hosts}}}
< div class = "field" >
< div class = "ui radio checkbox" >
< input type = "radio" name = "host_id" tabindex = "0" class = "hidden" value = "{{{.Id}}}"
{{{if eq $.Params.HostId .Id }}} checked {{{end}}}>
< / div >
< / div >
< option value = "{{{.Id}}}" { { { if eq $ . Params . HostId . Id } } } selected { { { end } } } > {{{.Alias}}}-{{{.Name}}}< / option >
{{{end}}}
< / div >
< / select >
< / div >
< div class = "field" >
< div class = "ui dropdown selection" >
< input type = "hidden" name = "protocol" value = "{{{if gt .Params.Protocol 0}}}{{{.Params.Protocol}}}{{{else}}}3{{{end}}}" >
< div class = "default text" > 本地命令< / div >
< i class = "dropdown icon" > < / i >
< div class = "menu" >
< div class = "item" data-value = "-1" > 协议< / div >
< div class = "item" data-value = "3" > 本地命令< / div >
< div class = "item" data-value = "2" > SSH< / div >
< div class = "item" data-value = "1" > HTTP< / div >
< / div >
< / div >
< select name = "protocol" id = "protocol" >
< option value = "0" > 选择协议< / option >
< option value = "3" { { { if eq . Params . Protocol 3 } } } selected { { { end } } } > 本地命令< / option >
< option value = "2" { { { if eq . Params . Protocol 2 } } } selected { { { end } } } data-match = "host_id" data-validate-type = "selectProtocol" > SSH< / option >
< option value = "1" { { { if eq . Params . Protocol 1 } } } selected { { { end } } } > HTTP< / option >
< / select >
< / div >
< div class = "field" >
< div class = "ui dropdown selection" >
< input type = "hidden" name = "status" value = "{{{if eq .Params.Status 1}}}1{{{else}}}2{{{end}}}" >
< div class = "default text" > 暂停< / div >
< i class = "dropdown icon" > < / i >
< div class = "menu" >
< div class = "item" data-value = "-1" > 状态< / div >
< div class = "item" data-value = "2" > 暂停< / div >
< div class = "item" data-value = "1" > 激活< / div >
< / div >
< / div >
< select name = "status" >
< option value = "0" > 状态< / option >
< option value = "1" { { { if eq . Params . Status 0 } } } selected { { { end } } } > 暂停< / option >
< option value = "2" { { { if eq . Params . Status 1 } } } selected { { { end } } } > 激活< / option >
< / select >
< / div >
< div class = "field" >
< button class = "ui linkedin submit button" > 搜索< / button >
< / div >
< / div >
< / form >
< 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 >
< 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 > {{{if gt .Timeout 0}}}{{{.Timeout}}}秒{{{else}}}不限制{{{end}}}< / td >
< td > {{{.RetryTimes}}}< / 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" @ click = "changeStatus({{{.Id}}},{{{.Status}}})" > 暂停< / button >
{{{else}}}
< button class = "ui blue button" @ click = "changeStatus({{{.Id}}},{{{.Status}}})" > 激活 < / button >
{{{end}}}
< button class = "ui positive button" @ click = "remove({{{.Id}}})" > 删除< / button > < br >
< div style = "margin-top:10px;" >
< button class = "ui twitter button" @ click = "run({{{.Id}}})" > 手动运行< / button >
< a class = "ui instagram button" href = "/task/log?task_id={{{.Id}}}" > 查看日志< / a >
< / div >
< / td >
< / tr >
{{{end}}}
< / tbody >
< / table >
{{{range $i, $v := .Tasks}}}
< div class = "ui device two column middle aligned vertical grid list segment" >
< div class = "column verborder" >
< div class = "ui info segment" >
< h5 class = "ui header" > {{{.Task.Name}}} {{{if eq .Status 1}}}< i class = "large checkmark blue icon" > < / i > {{{else}}} < i class = "large red minus icon" > < / i > {{{end}}}
< / h5 >
< p > 任务ID: < span class = "stress" > {{{.Id}}}< / span > < / p >
< p > cron表达式: {{{.Spec}}}< / p >
< p > 协议: {{{if eq .Protocol 1}}} HTTP {{{else if eq .Protocol 2}}} SSH {{{else if eq .Protocol 3}}}本地命令{{{end}}}< / p >
< p class = "sensorStatus" > 命令:{{{.Command}}}< / p >
< p class = "sensorStatus" > 超时时间:{{{if gt .Timeout 0}}}{{{.Timeout}}}秒{{{else}}}不限制{{{end}}}< / p >
< p > 重试次数: {{{.RetryTimes}}}< / p >
{{{if eq .Protocol 2}}}
< p > 主机: {{{.Alias}}}< / p >
{{{end}}}
< p > 备注: {{{.Remark}}}< / p >
< / div >
< / div >
< div class = "center aligned column" >
< div class = "ui buttons" >
< a class = "ui purple button" href = "/task/edit/{{{.Id}}}" > 编辑< / a >
{{{if eq .Status 1}}}
< button class = "ui primary button" @ click = "changeStatus({{{.Id}}},{{{.Status}}})" > 暂停< / button >
{{{else}}}
< button class = "ui blue button" @ click = "changeStatus({{{.Id}}},{{{.Status}}})" > 激活 < / button >
{{{end}}}
< button class = "ui positive button" @ click = "remove({{{.Id}}})" > 删除< / button > < br >
< button class = "ui twitter button" @ click = "run({{{.Id}}})" > 手动运行< / button >
< a class = "ui instagram button" href = "/task/log?task_id={{{.Id}}}" > 查看日志< / a >
< / div >
< / div >
< / div >
{{{end}}}
< / div >
< / div >
@ -124,7 +90,7 @@
var vue = new Vue(
{
el: '.ui.violet.table ',
el: '.ui.list ',
methods: {
changeStatus: function (id ,status) {
var url = '';
@ -155,4 +121,4 @@
< / script >
{{{ template "common/footer" . }}}
{{{ template "common/footer" . }}}