mirror of https://github.com/ouqiang/gocron
模板分隔符改为"{% %}"
parent
50638e6dfa
commit
4c940c2088
|
@ -142,16 +142,8 @@ func RegisterMiddleware(m *macaron.Macaron) {
|
|||
}
|
||||
m.Use(macaron.Static(StaticDir))
|
||||
m.Use(macaron.Renderer(macaron.RenderOptions{
|
||||
Directory: "templates",
|
||||
Extensions: []string{".html"},
|
||||
// 模板语法分隔符,默认为 ["{{", "}}"]
|
||||
Delims: macaron.Delims{"{{{", "}}}"},
|
||||
// 追加的 Content-Type 头信息,默认为 "UTF-8"
|
||||
Charset: "UTF-8",
|
||||
// 渲染具有缩进格式的 JSON,默认为不缩进
|
||||
IndentJSON: true,
|
||||
// 渲染具有缩进格式的 XML,默认为不缩进
|
||||
IndentXML: true,
|
||||
Delims: macaron.Delims{"{%", "%}"},
|
||||
Funcs: []template.FuncMap{map[string]interface{}{
|
||||
"HostFormat": func(index int) bool {
|
||||
return (index+1)%3 == 0
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="renderer" content="webkit">
|
||||
<title>{{{.Title}}}</title>
|
||||
<title>{%.Title%}</title>
|
||||
<link type="text/css" rel="stylesheet" href="/resource/css/framework.css" />
|
||||
<link type="text/css" rel="stylesheet" href="/resource/css/main.css" />
|
||||
<link type="text/css" rel="stylesheet" href="/resource/sweetalert/sweetalert.css" />
|
||||
|
@ -29,29 +29,29 @@
|
|||
</head>
|
||||
<body>
|
||||
<div class="page">
|
||||
{{{if not .DisableNav}}}
|
||||
{%if not .DisableNav%}
|
||||
<!--header begin-->
|
||||
<header>
|
||||
<div class="bigcontainer">
|
||||
<div id="logo">
|
||||
{{{.AppName}}}
|
||||
{%.AppName%}
|
||||
</div>
|
||||
<div class="user">
|
||||
<div class="ui inline labeled icon top right pointing dropdown">
|
||||
{{{if not .LoginUsername}}}
|
||||
{%if not .LoginUsername%}
|
||||
你好
|
||||
<i class="dropdown icon"></i>
|
||||
<div class="menu">
|
||||
<a class="item" href="/user/login"><i class="sign in icon"></i>登录</a>
|
||||
</div>
|
||||
{{{else}}}
|
||||
你好,{{{.LoginUsername}}}
|
||||
{%else%}
|
||||
你好,{%.LoginUsername%}
|
||||
<i class="dropdown icon"></i>
|
||||
<div class="menu">
|
||||
<a href="/user/editMyPassword" class="item"><i class="edit icon"></i>修改密码</a>
|
||||
<a class="item" href="/user/logout"><i class="sign out icon"></i>退出</a>
|
||||
</div>
|
||||
{{{end}}}
|
||||
{%end%}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -60,13 +60,13 @@
|
|||
<div class="ui teal inverted menu">
|
||||
<div class="bigcontainer">
|
||||
<div class="right menu">
|
||||
<a class="item {{{if or (eq .Controller "task") (eq .Controller "delaytask")}}}active{{{end}}}" href="/task"><i class="tasks icon"></i>任务</a>
|
||||
<a class="item {{{if eq .Controller "host"}}}active{{{end}}}" href="/host"><i class="linux icon"></i>任务节点</a>
|
||||
{{{if .IsAdmin}}}
|
||||
<a class="item {{{if eq .Controller "user"}}}active{{{end}}}" href="/user"><i class="user icon"></i>用户管理</a>
|
||||
<a class="item {{{if eq .Controller "manage"}}}active{{{end}}}" href="/manage/slack/edit"><i class="settings icon"></i>系统管理</a>
|
||||
{{{end}}}
|
||||
<a class="item {%if or (eq .Controller "task") (eq .Controller "delaytask")%}active{%end%}" href="/task"><i class="tasks icon"></i>任务</a>
|
||||
<a class="item {%if eq .Controller "host"%}active{%end%}" href="/host"><i class="linux icon"></i>任务节点</a>
|
||||
{%if .IsAdmin%}
|
||||
<a class="item {%if eq .Controller "user"%}active{%end%}" href="/user"><i class="user icon"></i>用户管理</a>
|
||||
<a class="item {%if eq .Controller "manage"%}active{%end%}" href="/manage/slack/edit"><i class="settings icon"></i>系统管理</a>
|
||||
{%end%}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{{end}}}
|
||||
{%end%}
|
|
@ -1,41 +1,41 @@
|
|||
{{{if gt .Pagination.Total 0}}}
|
||||
{%if gt .Pagination.Total 0%}
|
||||
|
||||
<div class="ui pagination menu">
|
||||
{{{if not .Pagination.IsFirst}}}
|
||||
<a class="item" href="{{{.URI}}}?{{{ .Params.PageParams}}}&page=1">
|
||||
{%if not .Pagination.IsFirst%}
|
||||
<a class="item" href="{%.URI%}?{% .Params.PageParams%}&page=1">
|
||||
首页
|
||||
</a>
|
||||
{{{end}}}
|
||||
{%end%}
|
||||
|
||||
{{{if .Pagination.HasPrevious}}}
|
||||
<a class="icon item" href="{{{.URI}}}?{{{ .Params.PageParams}}}&page={{{.Pagination.Previous}}}">
|
||||
{%if .Pagination.HasPrevious%}
|
||||
<a class="icon item" href="{%.URI%}?{% .Params.PageParams%}&page={%.Pagination.Previous%}">
|
||||
<i class="icon left arrow"></i>
|
||||
</a>
|
||||
{{{end}}}
|
||||
{%end%}
|
||||
|
||||
{{{range .Pagination.Pages}}}
|
||||
{{{if eq .Num -1}}}
|
||||
{%range .Pagination.Pages%}
|
||||
{%if eq .Num -1%}
|
||||
<div class="disabled item">
|
||||
...
|
||||
</div>
|
||||
{{{else}}}
|
||||
<a class="icon {{{if .IsCurrent}}}active{{{end}}} item" href="{{{$.URI}}}?{{{ $.Params.PageParams}}}&page={{{.Num}}}">
|
||||
{{{.Num}}}
|
||||
{%else%}
|
||||
<a class="icon {%if .IsCurrent%}active{%end%} item" href="{%$.URI%}?{% $.Params.PageParams%}&page={%.Num%}">
|
||||
{%.Num%}
|
||||
</a>
|
||||
{{{end}}}
|
||||
{{{end}}}
|
||||
{%end%}
|
||||
{%end%}
|
||||
|
||||
{{{if .Pagination.HasNext}}}
|
||||
<a class="icon item" href="{{{.URI}}}?{{{ .Params.PageParams}}}&page={{{.Pagination.Next}}}">
|
||||
{%if .Pagination.HasNext%}
|
||||
<a class="icon item" href="{%.URI%}?{% .Params.PageParams%}&page={%.Pagination.Next%}">
|
||||
<i class="icon right arrow"></i>
|
||||
</a>
|
||||
{{{end}}}
|
||||
{{{if not .Pagination.IsLast}}}
|
||||
<a class="icon item" href="{{{.URI}}}?{{{ .Params.PageParams}}}&page={{{.Pagination.TotalPages}}}">
|
||||
{%end%}
|
||||
{%if not .Pagination.IsLast%}
|
||||
<a class="icon item" href="{%.URI%}?{% .Params.PageParams%}&page={%.Pagination.TotalPages%}">
|
||||
尾页
|
||||
</a>
|
||||
{{{end}}}
|
||||
<div class="item">{{{.Pagination.Total}}}条/{{{.Pagination.TotalPages}}}页</div>
|
||||
{%end%}
|
||||
<div class="item">{%.Pagination.Total%}条/{%.Pagination.TotalPages%}页</div>
|
||||
</div>
|
||||
|
||||
{{{end}}}
|
||||
{%end%}
|
|
@ -1,4 +1,4 @@
|
|||
{{{ template "common/header" . }}}
|
||||
{% template "common/header" . %}
|
||||
<script>
|
||||
swal({
|
||||
title: "404 - NOT FOUND",
|
||||
|
@ -9,4 +9,4 @@
|
|||
location.href = "/"
|
||||
});
|
||||
</script>
|
||||
{{{ template "common/footer" . }}}
|
||||
{% template "common/footer" . %}
|
|
@ -1,4 +1,4 @@
|
|||
{{{ template "common/header" . }}}
|
||||
{% template "common/header" . %}
|
||||
<script>
|
||||
swal({
|
||||
title: "500 - INTERNAL SERVER ERROR",
|
||||
|
@ -8,4 +8,4 @@
|
|||
confirmButtonText: "确定"
|
||||
});
|
||||
</script>
|
||||
{{{ template "common/footer" . }}}
|
||||
{% template "common/footer" . %}
|
|
@ -1,3 +1,3 @@
|
|||
{{{ template "common/header" . }}}
|
||||
{% template "common/header" . %}
|
||||
|
||||
{{{ template "common/footer" . }}}
|
||||
{% template "common/footer" . %}
|
|
@ -1,7 +1,7 @@
|
|||
{{{ template "common/header" . }}}
|
||||
{% template "common/header" . %}
|
||||
|
||||
<div class="ui grid">
|
||||
{{{ template "host/menu" . }}}
|
||||
{% template "host/menu" . %}
|
||||
|
||||
<div class="twelve wide column">
|
||||
<div class="pageHeader">
|
||||
|
@ -14,24 +14,24 @@
|
|||
</div>
|
||||
</div>
|
||||
<form class="ui form fluid vertical segment">
|
||||
<input type="hidden" name="id" value="{{{.Host.Id}}}">
|
||||
<input type="hidden" name="id" value="{%.Host.Id%}">
|
||||
<div class="four fields">
|
||||
<div class="field">
|
||||
<label>主机名</label>
|
||||
<div class="ui small input">
|
||||
<input type="text" name="name" value="{{{.Host.Name}}}" placeholder="127.0.0.1">
|
||||
<input type="text" name="name" value="{%.Host.Name%}" placeholder="127.0.0.1">
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>端口</label>
|
||||
<div class="ui small input">
|
||||
<input type="text" name="port" value="{{{.Host.Port}}}" placeholder="5921">
|
||||
<input type="text" name="port" value="{%.Host.Port%}" placeholder="5921">
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>节点名称</label>
|
||||
<div class="ui small input">
|
||||
<input type="text" name="alias" value="{{{.Host.Alias}}}"
|
||||
<input type="text" name="alias" value="{%.Host.Alias%}"
|
||||
placeholder="节点名称如web">
|
||||
</div>
|
||||
</div>
|
||||
|
@ -40,7 +40,7 @@
|
|||
<div class="field">
|
||||
<label>备注</label>
|
||||
<div class="ui small input">
|
||||
<textarea rows="7" name="remark" >{{{.Host.Remark}}}</textarea>
|
||||
<textarea rows="7" name="remark" >{%.Host.Remark%}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -113,4 +113,4 @@
|
|||
});
|
||||
</script>
|
||||
|
||||
{{{ template "common/footer" . }}}
|
||||
{% template "common/footer" . %}
|
|
@ -1,10 +1,10 @@
|
|||
{{{ template "common/header" . }}}
|
||||
{% template "common/header" . %}
|
||||
|
||||
<div class="ui grid">
|
||||
{{{ template "host/menu" . }}}
|
||||
{% template "host/menu" . %}
|
||||
|
||||
<div class="twelve wide column">
|
||||
{{{if .IsAdmin}}}
|
||||
{%if .IsAdmin%}
|
||||
<div class="pageHeader">
|
||||
<div class="segment">
|
||||
<h3 class="ui dividing header">
|
||||
|
@ -17,14 +17,14 @@
|
|||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
{{{end}}}
|
||||
{%end%}
|
||||
<form class="ui form">
|
||||
<div class="three fields">
|
||||
<div class="field">
|
||||
<input type="text" placeholder="ID" name="id" value="{{{if gt .Params.Id 0}}}{{{.Params.Id}}}{{{end}}}">
|
||||
<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" value="{{{.Params.Name}}}">
|
||||
<input type="text" placeholder="主机名" name="name" value="{%.Params.Name%}">
|
||||
</div>
|
||||
<div class="field">
|
||||
<button class="ui linkedin submit button">搜索</button>
|
||||
|
@ -43,30 +43,30 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{{range $i, $v := .Hosts}}}
|
||||
{%range $i, $v := .Hosts%}
|
||||
<tr>
|
||||
<td>{{{.Id}}}</td>
|
||||
<td>{{{.Name}}}</td>
|
||||
<td>{{{.Alias}}}</td>
|
||||
<td>{{{.Port}}}</td>
|
||||
<td>{{{.Remark}}}</td>
|
||||
<td>{%.Id%}</td>
|
||||
<td>{%.Name%}</td>
|
||||
<td>{%.Alias%}</td>
|
||||
<td>{%.Port%}</td>
|
||||
<td>{%.Remark%}</td>
|
||||
<td class="operation">
|
||||
{{{if $.IsAdmin}}}
|
||||
<a class="ui purple button" href="/host/edit/{{{.Id}}}">编辑</a>
|
||||
<button class="ui positive button" onclick="util.removeConfirm('/host/remove/{{{.Id}}}')">删除</button><br>
|
||||
{{{end}}}
|
||||
{%if $.IsAdmin%}
|
||||
<a class="ui purple button" href="/host/edit/{%.Id%}">编辑</a>
|
||||
<button class="ui positive button" onclick="util.removeConfirm('/host/remove/{%.Id%}')">删除</button><br>
|
||||
{%end%}
|
||||
<div style="margin-top: 5px;">
|
||||
<a class="ui twitter button" href="/task?host_id={{{.Id}}}">查看任务</a>
|
||||
{{{if $.IsAdmin}}}
|
||||
<button class="ui blue button" @click="ping({{{.Id}}})">连接测试</button>
|
||||
{{{end}}}
|
||||
<a class="ui twitter button" href="/task?host_id={%.Id%}">查看任务</a>
|
||||
{%if $.IsAdmin%}
|
||||
<button class="ui blue button" @click="ping({%.Id%})">连接测试</button>
|
||||
{%end%}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{{{end}}}
|
||||
{%end%}
|
||||
</tbody>
|
||||
</table>
|
||||
{{{ template "common/pagination" .}}}
|
||||
{% template "common/pagination" .%}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -83,4 +83,4 @@
|
|||
});
|
||||
</script>
|
||||
|
||||
{{{ template "common/footer" . }}}
|
||||
{% template "common/footer" . %}
|
|
@ -1,7 +1,7 @@
|
|||
<div class="four wide column">
|
||||
<div class="verticalMenu">
|
||||
<div class="ui vertical pointing menu fluid">
|
||||
<a class="{{{if eq .URI "/host"}}}active teal{{{end}}} item" href="/host">
|
||||
<a class="{%if eq .URI "/host"%}active teal{%end%} item" href="/host">
|
||||
<i class="linux icon"></i> 节点列表
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{{{ template "common/header" . }}}
|
||||
{% template "common/header" . %}
|
||||
|
||||
<div class="ui grid">
|
||||
{{{ template "install/menu" . }}}
|
||||
{% template "install/menu" . %}
|
||||
<div class="ten wide column">
|
||||
<form class="ui form">
|
||||
<div class="ui blue center aligned segment">
|
||||
|
@ -186,4 +186,4 @@
|
|||
|
||||
</script>
|
||||
|
||||
{{{ template "common/footer" . }}}
|
||||
{% template "common/footer" . %}
|
|
@ -1,7 +1,7 @@
|
|||
{{{ template "common/header" . }}}
|
||||
{% template "common/header" . %}
|
||||
|
||||
<div class="ui grid">
|
||||
{{{ template "manage/menu" . }}}
|
||||
{% template "manage/menu" . %}
|
||||
|
||||
<div class="twelve wide column">
|
||||
<div class="pageHeader">
|
||||
|
@ -22,18 +22,18 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{{range $i, $v := .LoginLogs}}}
|
||||
{%range $i, $v := .LoginLogs%}
|
||||
<tr>
|
||||
<td>{{{.Username}}}</td>
|
||||
<td>{{{.Ip}}}</td>
|
||||
<td>{{{.Created}}}</td>
|
||||
<td>{%.Username%}</td>
|
||||
<td>{%.Ip%}</td>
|
||||
<td>{%.Created%}</td>
|
||||
</tr>
|
||||
{{{end}}}
|
||||
{%end%}
|
||||
</tbody>
|
||||
</table>
|
||||
{{{ template "common/pagination" .}}}
|
||||
{% template "common/pagination" .%}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{{{ template "common/footer" . }}}
|
||||
{% template "common/footer" . %}
|
|
@ -1,12 +1,12 @@
|
|||
{{{ template "common/header" . }}}
|
||||
{% template "common/header" . %}
|
||||
<div class="ui grid">
|
||||
{{{template "manage/menu" .}}}
|
||||
{%template "manage/menu" .%}
|
||||
<div class="twelve wide column">
|
||||
<div class="pageHeader">
|
||||
<div class="segment">
|
||||
<h3 class="ui dividing header">
|
||||
<div class="content">
|
||||
{{{.Title}}}
|
||||
{%.Title%}
|
||||
</div>
|
||||
</h3>
|
||||
</div>
|
||||
|
@ -19,7 +19,7 @@
|
|||
SMTP服务器
|
||||
</label>
|
||||
<div class="ui small input">
|
||||
<input type="text" name="host" value="{{{.Mail.Host}}}">
|
||||
<input type="text" name="host" value="{%.Mail.Host%}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
|
@ -27,7 +27,7 @@
|
|||
端口
|
||||
</label>
|
||||
<div class="ui small input">
|
||||
<input type="text" name="port" value="{{{if gt .Mail.Port 0}}}{{{.Mail.Port}}}{{{end}}}">
|
||||
<input type="text" name="port" value="{%if gt .Mail.Port 0%}{%.Mail.Port%}{%end%}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
|
@ -35,7 +35,7 @@
|
|||
用户名
|
||||
</label>
|
||||
<div class="ui small input">
|
||||
<input type="text" name="user" value="{{{.Mail.User}}}">
|
||||
<input type="text" name="user" value="{%.Mail.User%}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
|
@ -43,25 +43,25 @@
|
|||
密码
|
||||
</label>
|
||||
<div class="ui small input">
|
||||
<input type="text" name="password" value="{{{.Mail.Password}}}">
|
||||
<input type="text" name="password" value="{%.Mail.Password%}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button class="ui primary button">保存</button>
|
||||
{{{if .Mail.Host}}}
|
||||
{%if .Mail.Host%}
|
||||
<a class="ui green button" onclick="clearMailServer()">删除</a>
|
||||
{{{end}}}
|
||||
{%end%}
|
||||
<br><br><br>
|
||||
<div>
|
||||
<div class="content">邮箱用户</div><p></p>
|
||||
<div class="fields">
|
||||
{{{range $i, $v := .Mail.MailUsers}}}
|
||||
{%range $i, $v := .Mail.MailUsers%}
|
||||
<div class="field">
|
||||
<div class="ui segment">
|
||||
{{{.Username}}}-{{{.Email}}} <div class="ui blue button" onclick="removeMailUser({{{.Id}}})">删除</div>
|
||||
{%.Username%}-{%.Email%} <div class="ui blue button" onclick="removeMailUser({%.Id%})">删除</div>
|
||||
</div>
|
||||
</div>
|
||||
{{{end}}}
|
||||
{%end%}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
@ -198,4 +198,4 @@
|
|||
});
|
||||
}
|
||||
</script>
|
||||
{{{ template "common/footer" . }}}
|
||||
{% template "common/footer" . %}
|
|
@ -1,13 +1,13 @@
|
|||
<div class="three wide column">
|
||||
<div class="verticalMenu">
|
||||
<div class="ui vertical pointing menu fluid">
|
||||
<a class="{{{if eq .URI "/manage/slack/edit"}}}active teal{{{end}}} item" href="/manage/slack/edit">
|
||||
<a class="{%if eq .URI "/manage/slack/edit"%}active teal{%end%} item" href="/manage/slack/edit">
|
||||
<i class="slack icon"></i> Slack配置
|
||||
</a>
|
||||
<a class="{{{if eq .URI "/manage/mail/edit"}}}active teal{{{end}}} item" href="/manage/mail/edit">
|
||||
<a class="{%if eq .URI "/manage/mail/edit"%}active teal{%end%} item" href="/manage/mail/edit">
|
||||
<i class="slack icon"></i> 邮件配置
|
||||
</a>
|
||||
<a class="{{{if eq .URI "/manage/login-log"}}}active teal{{{end}}} item" href="/manage/login-log">
|
||||
<a class="{%if eq .URI "/manage/login-log"%}active teal{%end%} item" href="/manage/login-log">
|
||||
<i class="slack icon"></i> 登录日志
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{{{ template "common/header" . }}}
|
||||
{% template "common/header" . %}
|
||||
<div class="ui grid">
|
||||
{{{template "manage/menu" .}}}
|
||||
{%template "manage/menu" .%}
|
||||
<div class="twelve wide column">
|
||||
<div class="pageHeader">
|
||||
<div class="segment">
|
||||
<h3 class="ui dividing header">
|
||||
<div class="content">
|
||||
{{{.Title}}}
|
||||
{%.Title%}
|
||||
</div>
|
||||
</h3>
|
||||
</div>
|
||||
|
@ -18,7 +18,7 @@
|
|||
<div class="content">Slack WebHook URL</div>
|
||||
</label>
|
||||
<div class="ui small input">
|
||||
<input type="text" id="url" value="{{{.Slack.Url}}}">
|
||||
<input type="text" id="url" value="{%.Slack.Url%}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui primary button" @click="updateUrl">保存</div>
|
||||
|
@ -27,13 +27,13 @@
|
|||
<div>
|
||||
<div class="content">Slack Channel(配置任务通知时,可选择多Channel)</div><p></p>
|
||||
<div class="fields">
|
||||
{{{range $i, $v := .Slack.Channels}}}
|
||||
{%range $i, $v := .Slack.Channels%}
|
||||
<div class="field">
|
||||
<div class="ui segment">
|
||||
{{{.Name}}} <div class="ui blue button" @click="removeChannel({{{.Id}}})">删除</div>
|
||||
{%.Name%} <div class="ui blue button" @click="removeChannel({%.Id%})">删除</div>
|
||||
</div>
|
||||
</div>
|
||||
{{{end}}}
|
||||
{%end%}
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui facebook button" @click="createChannel">新增Channel</div>
|
||||
|
@ -85,4 +85,4 @@
|
|||
}
|
||||
});
|
||||
</script>
|
||||
{{{ template "common/footer" . }}}
|
||||
{% template "common/footer" . %}
|
|
@ -1,8 +1,8 @@
|
|||
{{{ template "common/header" . }}}
|
||||
{% template "common/header" . %}
|
||||
<div class="ui grid">
|
||||
{{{template "task/menu" .}}}
|
||||
{%template "task/menu" .%}
|
||||
<div class="twelve wide column">
|
||||
{{{if .IsAdmin}}}
|
||||
{%if .IsAdmin%}
|
||||
<div class="pageHeader">
|
||||
<div class="segment">
|
||||
<h3 class="ui dividing header">
|
||||
|
@ -15,40 +15,40 @@
|
|||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
{{{end}}}
|
||||
{%end%}
|
||||
<form class="ui form">
|
||||
<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}}}">
|
||||
<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" value="{{{.Params.Name}}}">
|
||||
<input type="text" placeholder="任务名称" name="name" value="{%.Params.Name%}">
|
||||
</div>
|
||||
<div class="field">
|
||||
<input type="text" placeholder="标签名称" name="tag" value="{{{.Params.Tag}}}">
|
||||
<input type="text" placeholder="标签名称" name="tag" value="{%.Params.Tag%}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="six fields search">
|
||||
<div class="field">
|
||||
<select name="host_id" id="hostId">
|
||||
<option value="">选择节点</option>
|
||||
{{{range $i, $v := .Hosts}}}
|
||||
<option value="{{{.Id}}}" {{{if eq $.Params.HostId .Id }}} selected {{{end}}} >{{{.Alias}}}-{{{.Name}}}</option>
|
||||
{{{end}}}
|
||||
{%range $i, $v := .Hosts%}
|
||||
<option value="{%.Id%}" {%if eq $.Params.HostId .Id %} selected {%end%} >{%.Alias%}-{%.Name%}</option>
|
||||
{%end%}
|
||||
</select>
|
||||
</div>
|
||||
<div class="field">
|
||||
<select name="protocol" id="protocol">
|
||||
<option value="0">执行方式</option>
|
||||
<option value="2" {{{if eq .Params.Protocol 2}}}selected{{{end}}} data-match="host_id" data-validate-type="selectProtocol">SHELL</option>
|
||||
<option value="1" {{{if eq .Params.Protocol 1}}}selected{{{end}}}>HTTP</option>
|
||||
<option value="2" {%if eq .Params.Protocol 2%}selected{%end%} data-match="host_id" data-validate-type="selectProtocol">SHELL</option>
|
||||
<option value="1" {%if eq .Params.Protocol 1%}selected{%end%}>HTTP</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="field">
|
||||
<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>
|
||||
<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">
|
||||
|
@ -56,7 +56,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{{{if .IsAdmin}}}
|
||||
{%if .IsAdmin%}
|
||||
<div class="field">
|
||||
<select id="batch-operation">
|
||||
<option value="0">批量操作</option>
|
||||
|
@ -65,16 +65,16 @@
|
|||
<option value="3">删除</option>
|
||||
</select>
|
||||
</div>
|
||||
{{{end}}}
|
||||
{%end%}
|
||||
<br>
|
||||
<table class="ui celled table task-list">
|
||||
<thead>
|
||||
<tr>
|
||||
{{{if .IsAdmin}}}
|
||||
{%if .IsAdmin%}
|
||||
<th>
|
||||
<input type="checkbox" onclick="checkAll(this)" style="width:25px;height: 25px;">
|
||||
</th>
|
||||
{{{end}}}
|
||||
{%end%}
|
||||
<th>任务ID</th>
|
||||
<th>任务名称</th>
|
||||
<th>任务类型</th>
|
||||
|
@ -90,58 +90,58 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{{range $i, $v := .Tasks}}}
|
||||
{%range $i, $v := .Tasks%}
|
||||
<tr>
|
||||
{{{if $.IsAdmin}}}
|
||||
{%if $.IsAdmin%}
|
||||
<td>
|
||||
<input type="checkbox"
|
||||
class="sub-check"
|
||||
data-id="{{{.Id}}}"
|
||||
data-id="{%.Id%}"
|
||||
style="width:25px;height: 25px;">
|
||||
</td>
|
||||
{{{end}}}
|
||||
<td>{{{.Id}}}</td>
|
||||
<td>{{{.Name}}}</td>
|
||||
<td>{{{if eq .Level 1}}}主任务{{{else}}}子任务{{{end}}}</td>
|
||||
<td>{{{.Tag}}}</td>
|
||||
<td>{{{.Spec}}}</td>
|
||||
<td>{{{if eq .Protocol 1}}} HTTP {{{else if eq .Protocol 2}}} SHELL {{{end}}}</td>
|
||||
<td>{{{if eq .Timeout -1}}}后台运行{{{else if gt .Timeout 0}}}{{{.Timeout}}}秒{{{else}}}不限制{{{end}}}</td>
|
||||
<td>{{{.RetryTimes}}}</td>
|
||||
<td>{{{if gt .Multi 0}}}否{{{else}}}是{{{end}}}</td>
|
||||
{%end%}
|
||||
<td>{%.Id%}</td>
|
||||
<td>{%.Name%}</td>
|
||||
<td>{%if eq .Level 1%}主任务{%else%}子任务{%end%}</td>
|
||||
<td>{%.Tag%}</td>
|
||||
<td>{%.Spec%}</td>
|
||||
<td>{%if eq .Protocol 1%} HTTP {%else if eq .Protocol 2%} SHELL {%end%}</td>
|
||||
<td>{%if eq .Timeout -1%}后台运行{%else if gt .Timeout 0%}{%.Timeout%}秒{%else%}不限制{%end%}</td>
|
||||
<td>{%.RetryTimes%}</td>
|
||||
<td>{%if gt .Multi 0%}否{%else%}是{%end%}</td>
|
||||
<td>
|
||||
{{{range $k, $h := .Hosts}}}
|
||||
{{{$h.Alias}}}<br>
|
||||
{{{end}}}
|
||||
{%range $k, $h := .Hosts%}
|
||||
{%$h.Alias%}<br>
|
||||
{%end%}
|
||||
</td>
|
||||
<td>
|
||||
{{{if eq .Level 1}}}
|
||||
{{{if eq .Status 1}}}<span><i class="checkmark big icon"></i></span>{{{else}}}<span><i class="minus big icon"></i><span>{{{end}}}
|
||||
{{{end}}}
|
||||
{%if eq .Level 1%}
|
||||
{%if eq .Status 1%}<span><i class="checkmark big icon"></i></span>{%else%}<span><i class="minus big icon"></i><span>{%end%}
|
||||
{%end%}
|
||||
</td>
|
||||
<td>
|
||||
<div class="ui buttons operation">
|
||||
{{{if $.IsAdmin}}}
|
||||
<a href="/task/edit/{{{.Id}}}" ><i class="edit big icon" title="编辑"></i></a>
|
||||
{{{if eq .Level 1}}}
|
||||
{{{if eq .Status 1}}}
|
||||
<a href="javascript:void(0);" @click="changeStatus({{{.Id}}},{{{.Status}}})"><i class="pause circle big icon" title="停止"></i></a>
|
||||
{{{else}}}
|
||||
<a href="javascript:void(0);" @click="changeStatus({{{.Id}}},{{{.Status}}})"><i class="play big icon" title="激活"></i></a>
|
||||
{{{end}}}
|
||||
{{{end}}}
|
||||
<a href="javascript:void(0);" @click="remove({{{.Id}}})"><i class="remove big icon" title="删除"></i></a>
|
||||
<a href="javascript:void(0);" @click="run({{{.Id}}})"><i class="rocket big icon" title="手动执行"></i></a>
|
||||
{{{end}}}
|
||||
{%if $.IsAdmin%}
|
||||
<a href="/task/edit/{%.Id%}" ><i class="edit big icon" title="编辑"></i></a>
|
||||
{%if eq .Level 1%}
|
||||
{%if eq .Status 1%}
|
||||
<a href="javascript:void(0);" @click="changeStatus({%.Id%},{%.Status%})"><i class="pause circle big icon" title="停止"></i></a>
|
||||
{%else%}
|
||||
<a href="javascript:void(0);" @click="changeStatus({%.Id%},{%.Status%})"><i class="play big icon" title="激活"></i></a>
|
||||
{%end%}
|
||||
{%end%}
|
||||
<a href="javascript:void(0);" @click="remove({%.Id%})"><i class="remove big icon" title="删除"></i></a>
|
||||
<a href="javascript:void(0);" @click="run({%.Id%})"><i class="rocket big icon" title="手动执行"></i></a>
|
||||
{%end%}
|
||||
|
||||
<a href="/task/log?task_id={{{.Id}}}"><i class="bar chart icon big" title="查看日志"></i></a>
|
||||
<a href="/task/log?task_id={%.Id%}"><i class="bar chart icon big" title="查看日志"></i></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{{{end}}}
|
||||
{%end%}
|
||||
</tbody>
|
||||
</table>
|
||||
{{{ template "common/pagination" .}}}
|
||||
{% template "common/pagination" .%}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -239,4 +239,4 @@
|
|||
}
|
||||
</script>
|
||||
|
||||
{{{ template "common/footer" . }}}
|
||||
{% template "common/footer" . %}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{{{ template "common/header" . }}}
|
||||
{% template "common/header" . %}
|
||||
<style type="text/css">
|
||||
pre {
|
||||
white-space: pre-wrap;
|
||||
|
@ -10,10 +10,10 @@
|
|||
</style>
|
||||
<div class="ui grid">
|
||||
<!--the vertical menu-->
|
||||
{{{ template "task/menu" . }}}
|
||||
{% template "task/menu" . %}
|
||||
|
||||
<div class="twelve wide column">
|
||||
{{{if .IsAdmin}}}
|
||||
{%if .IsAdmin%}
|
||||
<div class="pageHeader">
|
||||
<div class="segment">
|
||||
<h3 class="ui dividing header">
|
||||
|
@ -23,26 +23,26 @@
|
|||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
{{{end}}}
|
||||
{%end%}
|
||||
<form class="ui form">
|
||||
<div class="six fields search">
|
||||
<div class="field">
|
||||
<input type="text" placeholder="任务ID" name="task_id" value="{{{if gt .Params.TaskId 0}}}{{{.Params.TaskId}}}{{{end}}}">
|
||||
<input type="text" placeholder="任务ID" name="task_id" value="{%if gt .Params.TaskId 0%}{%.Params.TaskId%}{%end%}">
|
||||
</div>
|
||||
<div class="field">
|
||||
<select name="protocol" id="protocol">
|
||||
<option value="0">执行方式</option>
|
||||
<option value="2" {{{if eq .Params.Protocol 2}}}selected{{{end}}} data-match="host_id" data-validate-type="selectProtocol">SHELL</option>
|
||||
<option value="1" {{{if eq .Params.Protocol 1}}}selected{{{end}}}>HTTP</option>
|
||||
<option value="2" {%if eq .Params.Protocol 2%}selected{%end%} data-match="host_id" data-validate-type="selectProtocol">SHELL</option>
|
||||
<option value="1" {%if eq .Params.Protocol 1%}selected{%end%}>HTTP</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="field">
|
||||
<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>
|
||||
<option value="3" {{{if eq .Params.Status 2}}}selected{{{end}}}>成功</option>
|
||||
<option value="4" {{{if eq .Params.Status 3}}}selected{{{end}}}>取消</option>
|
||||
<option value="1" {%if eq .Params.Status 0%}selected{%end%} >失败</option>
|
||||
<option value="2" {%if eq .Params.Status 1%}selected{%end%}>执行中</option>
|
||||
<option value="3" {%if eq .Params.Status 2%}selected{%end%}>成功</option>
|
||||
<option value="4" {%if eq .Params.Status 3%}selected{%end%}>取消</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="field">
|
||||
|
@ -65,54 +65,54 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{{range $i, $v := .Logs}}}
|
||||
{%range $i, $v := .Logs%}
|
||||
<tr>
|
||||
<td><a href="/task?id={{{.TaskId}}}">{{{.TaskId}}}</a></td>
|
||||
<td>{{{.Name}}}</td>
|
||||
<td>{{{.Spec}}}</td>
|
||||
<td>{{{if eq .Protocol 1}}} HTTP {{{else if eq .Protocol 2}}} SHELL {{{end}}}</td>
|
||||
<td>{{{.RetryTimes}}}</td>
|
||||
<td>{{{unescape .Hostname}}}</td>
|
||||
<td><a href="/task?id={%.TaskId%}">{%.TaskId%}</a></td>
|
||||
<td>{%.Name%}</td>
|
||||
<td>{%.Spec%}</td>
|
||||
<td>{%if eq .Protocol 1%} HTTP {%else if eq .Protocol 2%} SHELL {%end%}</td>
|
||||
<td>{%.RetryTimes%}</td>
|
||||
<td>{%unescape .Hostname%}</td>
|
||||
<td>
|
||||
{{{if and (ne .Status 3) (ne .Status 4)}}}
|
||||
{{{if gt .TotalTime 0}}}{{{.TotalTime}}}秒{{{else}}}1秒{{{end}}}<br>
|
||||
开始时间: {{{.StartTime.Format "2006-01-02 15:04:05" }}}<br>
|
||||
{{{if ne .Status 1}}}
|
||||
结束时间: {{{.EndTime.Format "2006-01-02 15:04:05" }}}
|
||||
{{{end}}}
|
||||
{{{end}}}
|
||||
{%if and (ne .Status 3) (ne .Status 4)%}
|
||||
{%if gt .TotalTime 0%}{%.TotalTime%}秒{%else%}1秒{%end%}<br>
|
||||
开始时间: {%.StartTime.Format "2006-01-02 15:04:05" %}<br>
|
||||
{%if ne .Status 1%}
|
||||
结束时间: {%.EndTime.Format "2006-01-02 15:04:05" %}
|
||||
{%end%}
|
||||
{%end%}
|
||||
</td>
|
||||
<td>
|
||||
{{{if eq .Status 2}}}
|
||||
{%if eq .Status 2%}
|
||||
成功
|
||||
{{{else if eq .Status 1}}}
|
||||
{%else if eq .Status 1%}
|
||||
<span style="color:green">执行中</span>
|
||||
{{{else if eq .Status 0}}}
|
||||
{%else if eq .Status 0%}
|
||||
<span style="color:red">失败</span>
|
||||
{{{else if eq .Status 3}}}
|
||||
{%else if eq .Status 3%}
|
||||
<span style="color:#4499EE">取消</span>
|
||||
{{{end}}}
|
||||
{%end%}
|
||||
</td>
|
||||
<td>
|
||||
{{{if or (eq .Status 2) (eq .Status 0)}}}
|
||||
{%if or (eq .Status 2) (eq .Status 0)%}
|
||||
<button class="ui small primary button"
|
||||
onclick="showResult('{{{.Name}}}', '{{{.Command}}}', '{{{.Result}}}')"
|
||||
onclick="showResult('{%.Name%}', '{%.Command%}', '{%.Result%}')"
|
||||
>查看结果
|
||||
</button>
|
||||
{{{end}}}
|
||||
{%end%}
|
||||
|
||||
|
||||
{{{if $.IsAdmin}}}
|
||||
{{{if and (eq .Status 1) (eq .Protocol 2) }}}
|
||||
<button class="ui small blue button" onclick="stopTask({{{.Id}}}, {{{.TaskId}}})">停止任务</button>
|
||||
{{{end}}}
|
||||
{{{end}}}
|
||||
{%if $.IsAdmin%}
|
||||
{%if and (eq .Status 1) (eq .Protocol 2) %}
|
||||
<button class="ui small blue button" onclick="stopTask({%.Id%}, {%.TaskId%})">停止任务</button>
|
||||
{%end%}
|
||||
{%end%}
|
||||
</td>
|
||||
</tr>
|
||||
{{{end}}}
|
||||
{%end%}
|
||||
</tbody>
|
||||
</table>
|
||||
{{{ template "common/pagination" .}}}
|
||||
{% template "common/pagination" .%}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -171,4 +171,4 @@
|
|||
});
|
||||
}
|
||||
</script>
|
||||
{{{ template "common/footer" . }}}
|
||||
{% template "common/footer" . %}
|
|
@ -1,10 +1,10 @@
|
|||
<div class="three wide column">
|
||||
<div class="verticalMenu">
|
||||
<div class="ui vertical pointing menu fluid">
|
||||
<a class="{{{if eq .URI "/task"}}}active teal{{{end}}} item" href="/task">
|
||||
<a class="{%if eq .URI "/task"%}active teal{%end%} item" href="/task">
|
||||
<i class="tasks icon"></i> 定时任务列表
|
||||
</a>
|
||||
<a class="item {{{if eq .URI "/task/log"}}}active teal{{{end}}} " href="/task/log">
|
||||
<a class="item {%if eq .URI "/task/log"%}active teal{%end%} " href="/task/log">
|
||||
<i class="bar chart icon"></i> 定时任务日志
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
{{{ template "common/header" . }}}
|
||||
{% template "common/header" . %}
|
||||
<div class="ui grid">
|
||||
{{{template "task/menu" .}}}
|
||||
{%template "task/menu" .%}
|
||||
<div class="twelve wide column">
|
||||
<div class="pageHeader">
|
||||
<div class="segment">
|
||||
<h3 class="ui dividing header">
|
||||
<div class="content">
|
||||
{{{.Title}}}
|
||||
{%.Title%}
|
||||
</div>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<form class="ui form fluid vertical segment">
|
||||
<input type="hidden" name="id" value="{{{.Task.Id}}}">
|
||||
<input type="hidden" name="id" value="{%.Task.Id%}">
|
||||
<div class="two fields">
|
||||
<div class="field">
|
||||
<label>
|
||||
<div class="content">任务名称</div>
|
||||
</label>
|
||||
<div class="ui small input">
|
||||
<input type="text" name="name" placeholder="任务名称" value="{{{.Task.Name}}}">
|
||||
<input type="text" name="name" placeholder="任务名称" value="{%.Task.Name%}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
|||
<div class="content">标签名称</div>
|
||||
</label>
|
||||
<div class="ui small input">
|
||||
<input type="text" name="tag" placeholder="标签用于任务分类" value="{{{.Task.Tag}}}">
|
||||
<input type="text" name="tag" placeholder="标签用于任务分类" value="{%.Task.Tag%}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -41,9 +41,9 @@
|
|||
任务类型新增后不能变更
|
||||
</div>
|
||||
</label>
|
||||
<select name="level" id="level" {{{if .Task}}}disabled="disabled"{{{end}}}>
|
||||
<option value="1" {{{if .Task}}} {{{if eq .Task.Level 1}}}selected{{{end}}} {{{end}}}>主任务</option>
|
||||
<option value="2" {{{if .Task}}} {{{if eq .Task.Level 2}}}selected{{{end}}} {{{end}}}>子任务</option>
|
||||
<select name="level" id="level" {%if .Task%}disabled="disabled"{%end%}>
|
||||
<option value="1" {%if .Task%} {%if eq .Task.Level 1%}selected{%end%} {%end%}>主任务</option>
|
||||
<option value="2" {%if .Task%} {%if eq .Task.Level 2%}selected{%end%} {%end%}>子任务</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -58,8 +58,8 @@
|
|||
</div>
|
||||
</label>
|
||||
<select name="dependency_status" id="dependency_status">
|
||||
<option value="1" {{{if .Task}}} {{{if eq .Task.DependencyStatus 1}}}selected{{{end}}} {{{end}}}>强依赖</option>
|
||||
<option value="2" {{{if .Task}}} {{{if eq .Task.DependencyStatus 2}}}selected{{{end}}} {{{end}}}>弱依赖</option>
|
||||
<option value="1" {%if .Task%} {%if eq .Task.DependencyStatus 1%}selected{%end%} {%end%}>强依赖</option>
|
||||
<option value="2" {%if .Task%} {%if eq .Task.DependencyStatus 2%}selected{%end%} {%end%}>弱依赖</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="field">
|
||||
|
@ -71,7 +71,7 @@
|
|||
</div>
|
||||
</label>
|
||||
<div class="ui small input">
|
||||
<input type="text" name="dependency_task_id" placeholder="可选" value="{{{.Task.DependencyTaskId}}}">
|
||||
<input type="text" name="dependency_task_id" placeholder="可选" value="{%.Task.DependencyTaskId%}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -83,7 +83,7 @@
|
|||
</div>
|
||||
</label>
|
||||
<div class="ui small input">
|
||||
<input type="text" name="spec" value="{{{.Task.Spec}}}" placeholder="秒 分 时 天 月 周"/>
|
||||
<input type="text" name="spec" value="{%.Task.Spec%}" placeholder="秒 分 时 天 月 周"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -92,9 +92,9 @@
|
|||
<div class="field">
|
||||
<label>执行方式</label>
|
||||
<select name="protocol" id="protocol">
|
||||
<option value="2" {{{if .Task}}} {{{if eq .Task.Protocol 2}}}selected{{{end}}} {{{end}}}
|
||||
<option value="2" {%if .Task%} {%if eq .Task.Protocol 2%}selected{%end%} {%end%}
|
||||
data-validate-type="selectProtocol">SHELL</option>
|
||||
<option value="1" {{{if .Task}}} {{{if eq .Task.Protocol 1}}}selected{{{end}}} {{{end}}}>HTTP</option>
|
||||
<option value="1" {%if .Task%} {%if eq .Task.Protocol 1%}selected{%end%} {%end%}>HTTP</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -102,12 +102,12 @@
|
|||
<div class="field">
|
||||
<label>选择任务节点</label>
|
||||
<div id="hostId">
|
||||
{{{range $i, $v := .Hosts}}}
|
||||
{%range $i, $v := .Hosts%}
|
||||
<label>
|
||||
<input type="checkbox" value="{{{.Id}}}" {{{if $.Task}}}{{{if $v.Selected}}} checked {{{end}}}{{{end}}} style="width:25px;height: 25px;">{{{.Alias}}}-{{{.Name}}}
|
||||
{{{if (HostFormat $i) }}}<br>{{{end}}}
|
||||
<input type="checkbox" value="{%.Id%}" {%if $.Task%}{%if $v.Selected%} checked {%end%}{%end%} style="width:25px;height: 25px;">{%.Alias%}-{%.Name%}
|
||||
{%if (HostFormat $i) %}<br>{%end%}
|
||||
</label>
|
||||
{{{end}}}
|
||||
{%end%}
|
||||
</div> <br> <a class="ui blue button" href="/host/create" target="_blank">添加节点</a>
|
||||
|
||||
</div>
|
||||
|
@ -116,8 +116,8 @@
|
|||
<div class="field">
|
||||
<label>请求方法</label>
|
||||
<select name="http_method">
|
||||
<option value="1" {{{if .Task}}} {{{if eq .Task.HttpMethod 1}}}selected{{{end}}} {{{end}}}>GET</option>
|
||||
<option value="2" {{{if .Task}}} {{{if eq .Task.HttpMethod 2}}}selected{{{end}}} {{{end}}}
|
||||
<option value="1" {%if .Task%} {%if eq .Task.HttpMethod 1%}selected{%end%} {%end%}>GET</option>
|
||||
<option value="2" {%if .Task%} {%if eq .Task.HttpMethod 2%}selected{%end%} {%end%}
|
||||
data-validate-type="selectProtocol">POST</option>
|
||||
</select>
|
||||
</div>
|
||||
|
@ -125,19 +125,19 @@
|
|||
<div class="two fields">
|
||||
<div class="field">
|
||||
<label>命令</label>
|
||||
<textarea rows="5" name="command" placeholder="请输入系统命令" id="command">{{{.Task.Command}}}</textarea>
|
||||
<textarea rows="5" name="command" placeholder="请输入系统命令" id="command">{%.Task.Command%}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="two fields">
|
||||
<div class="field">
|
||||
<label>任务超时时间(秒, 0-86400)</label>
|
||||
<input type="text" name="timeout" placeholder="默认0, 不限制" value="{{{if .Task}}} {{{.Task.Timeout}}} {{{else}}}0{{{end}}}">
|
||||
<input type="text" name="timeout" placeholder="默认0, 不限制" value="{%if .Task%} {%.Task.Timeout%} {%else%}0{%end%}">
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>允许多实例同时运行</label>
|
||||
<select name="multi">
|
||||
<option value="2" {{{if .Task}}} {{{if eq .Task.Multi 0}}}selected{{{end}}} {{{end}}}>否</option>
|
||||
<option value="1"{{{if .Task}}} {{{if eq .Task.Multi 1}}}selected{{{end}}} {{{end}}}>是</option>
|
||||
<option value="2" {%if .Task%} {%if eq .Task.Multi 0%}selected{%end%} {%end%}>否</option>
|
||||
<option value="1"{%if .Task%} {%if eq .Task.Multi 1%}selected{%end%} {%end%}>是</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -145,11 +145,11 @@
|
|||
<div class="two fields">
|
||||
<div class="field">
|
||||
<label>任务失败重试次数 (0-10)</label>
|
||||
<input type="text" name="retry_times" placeholder="默认0, 不重试" value="{{{if .Task}}} {{{.Task.RetryTimes}}} {{{else}}}0{{{end}}}">
|
||||
<input type="text" name="retry_times" placeholder="默认0, 不重试" value="{%if .Task%} {%.Task.RetryTimes%} {%else%}0{%end%}">
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>任务失败重试间隔时间 (秒, 0-3600)</label>
|
||||
<input type="text" name="retry_interval" placeholder="默认0, 执行默认重试策略" value="{{{if .Task}}} {{{.Task.RetryInterval}}} {{{else}}}0{{{end}}}">
|
||||
<input type="text" name="retry_interval" placeholder="默认0, 执行默认重试策略" value="{%if .Task%} {%.Task.RetryInterval%} {%else%}0{%end%}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -157,9 +157,9 @@
|
|||
<div class="field">
|
||||
<label>任务通知</label>
|
||||
<select name="notify_status" id="task-status">
|
||||
<option value="1"{{{if .Task}}} {{{if eq .Task.NotifyStatus 0}}}selected{{{end}}} {{{end}}}>不通知</option>
|
||||
<option value="2" {{{if .Task}}} {{{if eq .Task.NotifyStatus 1}}}selected{{{end}}} {{{end}}}>失败通知</option>
|
||||
<option value="3" {{{if .Task}}} {{{if eq .Task.NotifyStatus 2}}}selected{{{end}}} {{{end}}}>执行结束通知</option>
|
||||
<option value="1"{%if .Task%} {%if eq .Task.NotifyStatus 0%}selected{%end%} {%end%}>不通知</option>
|
||||
<option value="2" {%if .Task%} {%if eq .Task.NotifyStatus 1%}selected{%end%} {%end%}>失败通知</option>
|
||||
<option value="3" {%if .Task%} {%if eq .Task.NotifyStatus 2%}selected{%end%} {%end%}>执行结束通知</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -167,9 +167,9 @@
|
|||
<div class="field" >
|
||||
<label>通知类型</label>
|
||||
<select name="notify_type">
|
||||
<option value="1"{{{if .Task}}} {{{if eq .Task.NotifyType 0}}}selected{{{end}}} {{{end}}}>请选择</option>
|
||||
<option value="2" {{{if .Task}}} {{{if eq .Task.NotifyType 1}}}selected{{{end}}} {{{end}}}>邮件</option>
|
||||
<option value="3" {{{if .Task}}} {{{if eq .Task.NotifyType 2}}}selected{{{end}}} {{{end}}}>Slack</option>
|
||||
<option value="1"{%if .Task%} {%if eq .Task.NotifyType 0%}selected{%end%} {%end%}>请选择</option>
|
||||
<option value="2" {%if .Task%} {%if eq .Task.NotifyType 1%}selected{%end%} {%end%}>邮件</option>
|
||||
<option value="3" {%if .Task%} {%if eq .Task.NotifyType 2%}selected{%end%} {%end%}>Slack</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -177,7 +177,7 @@
|
|||
<div class="two fields">
|
||||
<div class="field">
|
||||
<label>备注</label>
|
||||
<textarea rows="5" name="remark" placeholder="任务备注信息">{{{.Task.Remark}}}</textarea>
|
||||
<textarea rows="5" name="remark" placeholder="任务备注信息">{%.Task.Remark%}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui primary submit button">保存</div> <a class="ui button" onclick="location.href='/task';">取消</a>
|
||||
|
@ -256,11 +256,11 @@
|
|||
}
|
||||
|
||||
function showNotify() {
|
||||
var notifyStatus = {{{.Task.NotifyStatus}}};
|
||||
var notifyStatus = {%.Task.NotifyStatus%};
|
||||
if (notifyStatus > 0) {
|
||||
$('#task-notify-type').show();
|
||||
}
|
||||
var notifyReceiverIds = '{{{.Task.NotifyReceiverId}}}'.split(',');
|
||||
var notifyReceiverIds = '{%.Task.NotifyReceiverId%}'.split(',');
|
||||
changeNotify(notifyReceiverIds);
|
||||
}
|
||||
|
||||
|
@ -465,4 +465,4 @@
|
|||
});
|
||||
</script>
|
||||
|
||||
{{{ template "common/footer" . }}}
|
||||
{% template "common/footer" . %}
|
|
@ -1,4 +1,4 @@
|
|||
{{{ template "common/header" . }}}
|
||||
{% template "common/header" . %}
|
||||
<div class="ui small modal">
|
||||
<div class="header">修改密码</div>
|
||||
<div class="content">
|
||||
|
@ -70,4 +70,4 @@
|
|||
inline : true
|
||||
});
|
||||
</script>
|
||||
{{{ template "common/footer" . }}}
|
||||
{% template "common/footer" . %}
|
|
@ -1,4 +1,4 @@
|
|||
{{{ template "common/header" . }}}
|
||||
{% template "common/header" . %}
|
||||
<div class="ui small modal">
|
||||
<div class="header">修改密码</div>
|
||||
<div class="content">
|
||||
|
@ -25,7 +25,7 @@
|
|||
$('.ui.form').form(
|
||||
{
|
||||
onSuccess: function(event, fields) {
|
||||
util.post('/user/editPassword/{{{.Id}}}', fields, function(code, message) {
|
||||
util.post('/user/editPassword/{%.Id%}', fields, function(code, message) {
|
||||
swal("操作成功", '修改成功', 'success');
|
||||
location.href = "/user"
|
||||
});
|
||||
|
@ -55,4 +55,4 @@
|
|||
inline : true
|
||||
});
|
||||
</script>
|
||||
{{{ template "common/footer" . }}}
|
||||
{% template "common/footer" . %}
|
|
@ -1,7 +1,7 @@
|
|||
{{{ template "common/header" . }}}
|
||||
{% template "common/header" . %}
|
||||
|
||||
<div class="ui grid">
|
||||
{{{ template "user/menu" . }}}
|
||||
{% template "user/menu" . %}
|
||||
|
||||
<div class="twelve wide column">
|
||||
<div class="pageHeader">
|
||||
|
@ -28,30 +28,30 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{{range $i, $v := .Users}}}
|
||||
{%range $i, $v := .Users%}
|
||||
<tr>
|
||||
<td>{{{.Id}}}</td>
|
||||
<td>{{{.Name}}}</td>
|
||||
<td>{{{.Email}}}</td>
|
||||
<td>{{{if .IsAdmin}}}管理员{{{else}}}普通用户{{{end}}}</td>
|
||||
<td>{{{if .Status}}}启用{{{else}}}禁用{{{end}}}</td>
|
||||
<td>{%.Id%}</td>
|
||||
<td>{%.Name%}</td>
|
||||
<td>{%.Email%}</td>
|
||||
<td>{%if .IsAdmin%}管理员{%else%}普通用户{%end%}</td>
|
||||
<td>{%if .Status%}启用{%else%}禁用{%end%}</td>
|
||||
<td class="operation">
|
||||
<a class="ui purple button" href="/user/edit/{{{.Id}}}">编辑</a>
|
||||
{{{if eq .Status 1}}}
|
||||
<button class="ui button red" onclick="changeStatus({{{.Id}}},{{{.Status}}})">禁用</button>
|
||||
{{{else}}}
|
||||
<button class="ui button twitter" onclick="changeStatus({{{.Id}}},{{{.Status}}})">启用</button>
|
||||
{{{end}}}
|
||||
<a href="/user/editPassword/{{{.Id}}}">
|
||||
<a class="ui purple button" href="/user/edit/{%.Id%}">编辑</a>
|
||||
{%if eq .Status 1%}
|
||||
<button class="ui button red" onclick="changeStatus({%.Id%},{%.Status%})">禁用</button>
|
||||
{%else%}
|
||||
<button class="ui button twitter" onclick="changeStatus({%.Id%},{%.Status%})">启用</button>
|
||||
{%end%}
|
||||
<a href="/user/editPassword/{%.Id%}">
|
||||
<button class="ui button facebook">修改密码</button>
|
||||
</a>
|
||||
<button class="ui positive button" onclick="util.removeConfirm('/user/remove/{{{.Id}}}')">删除</button>
|
||||
<button class="ui positive button" onclick="util.removeConfirm('/user/remove/{%.Id%}')">删除</button>
|
||||
</td>
|
||||
</tr>
|
||||
{{{end}}}
|
||||
{%end%}
|
||||
</tbody>
|
||||
</table>
|
||||
{{{ template "common/pagination" .}}}
|
||||
{% template "common/pagination" .%}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -70,4 +70,4 @@
|
|||
}
|
||||
</script>
|
||||
|
||||
{{{ template "common/footer" . }}}
|
||||
{% template "common/footer" . %}
|
|
@ -1,4 +1,4 @@
|
|||
{{{ template "common/header" . }}}
|
||||
{% template "common/header" . %}
|
||||
<div class="ui small modal">
|
||||
<div class="header">用户登录</div>
|
||||
<div class="content">
|
||||
|
@ -15,7 +15,7 @@
|
|||
</div>
|
||||
<div class="two fields">
|
||||
<div class="field">
|
||||
{{{.Captcha.CreateHtml}}}
|
||||
{%.Captcha.CreateHtml%}
|
||||
<input type="text" name="captcha" placeholder="验证码">
|
||||
</div>
|
||||
</div>
|
||||
|
@ -71,4 +71,4 @@
|
|||
inline : true
|
||||
});
|
||||
</script>
|
||||
{{{ template "common/footer" . }}}
|
||||
{% template "common/footer" . %}
|
|
@ -1,7 +1,7 @@
|
|||
<div class="four wide column">
|
||||
<div class="verticalMenu">
|
||||
<div class="ui vertical pointing menu fluid">
|
||||
<a class="{{{if eq .URI "/user"}}}active teal{{{end}}} item" href="/user">
|
||||
<a class="{%if eq .URI "/user"%}active teal{%end%} item" href="/user">
|
||||
<i class="user icon"></i> 用户列表
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{{{ template "common/header" . }}}
|
||||
{% template "common/header" . %}
|
||||
|
||||
<div class="ui grid">
|
||||
{{{ template "user/menu" . }}}
|
||||
{% template "user/menu" . %}
|
||||
|
||||
<div class="twelve wide column">
|
||||
<div class="pageHeader">
|
||||
|
@ -14,22 +14,22 @@
|
|||
</div>
|
||||
</div>
|
||||
<form class="ui form fluid vertical segment">
|
||||
<input type="hidden" name="id" value="{{{.User.Id}}}">
|
||||
<input type="hidden" name="id" value="{%.User.Id%}">
|
||||
<div class="three fields">
|
||||
<div class="field">
|
||||
<label>用户名</label>
|
||||
<div class="ui small input">
|
||||
<input type="text" name="name" value="{{{.User.Name}}}" placeholder="请输入用户名">
|
||||
<input type="text" name="name" value="{%.User.Name%}" placeholder="请输入用户名">
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>邮箱</label>
|
||||
<div class="ui small input">
|
||||
<input type="text" name="email" value="{{{.User.Email}}}" placeholder="请输入邮箱">
|
||||
<input type="text" name="email" value="{%.User.Email%}" placeholder="请输入邮箱">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{{if eq .User.Id 0}}}
|
||||
{%if eq .User.Id 0%}
|
||||
<div class="three fields">
|
||||
<div class="field">
|
||||
<label>密码</label>
|
||||
|
@ -41,20 +41,20 @@
|
|||
<input type="password" name="confirm_password" placeholder="请再次输入密码">
|
||||
</div>
|
||||
</div>
|
||||
{{{end}}}
|
||||
{%end%}
|
||||
|
||||
<div class="three fields">
|
||||
<div class="field">
|
||||
<label>角色</label>
|
||||
<input type="radio" name="is_admin" value="0" {{{if eq .User.IsAdmin 0}}}checked{{{end}}}> 普通用户
|
||||
<input type="radio" name="is_admin" value="1" {{{if eq .User.IsAdmin 1}}}checked{{{end}}}> 管理员
|
||||
<input type="radio" name="is_admin" value="0" {%if eq .User.IsAdmin 0%}checked{%end%}> 普通用户
|
||||
<input type="radio" name="is_admin" value="1" {%if eq .User.IsAdmin 1%}checked{%end%}> 管理员
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label>状态</label>
|
||||
<input type="radio" name="status" value="1" {{{if eq .User.Status 1}}}checked{{{end}}}> 启用
|
||||
<input type="radio" name="status" value="1" {%if eq .User.Status 1%}checked{%end%}> 启用
|
||||
<input type="radio" name="status" value="0"
|
||||
{{{if eq .User.Status 0}}}checked{{{end}}}
|
||||
{%if eq .User.Status 0%}checked{%end%}
|
||||
> 禁用
|
||||
</div>
|
||||
</div>
|
||||
|
@ -139,4 +139,4 @@
|
|||
});
|
||||
</script>
|
||||
|
||||
{{{ template "common/footer" . }}}
|
||||
{% template "common/footer" . %}
|
Loading…
Reference in New Issue