2017-04-07 01:13:36 +00:00
|
|
|
|
{{{ template "common/header" . }}}
|
|
|
|
|
|
|
|
|
|
<div class="ui grid">
|
|
|
|
|
{{{template "task/menu" .}}}
|
|
|
|
|
<div class="twelve wide column">
|
2017-04-07 09:26:46 +00:00
|
|
|
|
<div class="pageHeader">
|
|
|
|
|
<div class="segment">
|
|
|
|
|
<h3 class="ui dividing header">
|
|
|
|
|
<i class="large add icon"></i>
|
|
|
|
|
<div class="content">
|
2017-04-17 10:04:30 +00:00
|
|
|
|
{{{.Title}}}
|
2017-04-07 09:26:46 +00:00
|
|
|
|
</div>
|
|
|
|
|
</h3>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2017-04-07 01:13:36 +00:00
|
|
|
|
<form class="ui form fluid vertical segment">
|
2017-04-17 10:04:30 +00:00
|
|
|
|
<input type="hidden" name="id" value="{{{.Task.Id}}}">
|
2017-04-07 01:13:36 +00:00
|
|
|
|
<div class="two fields">
|
|
|
|
|
<div class="field">
|
|
|
|
|
<label>任务名称</label>
|
|
|
|
|
<div class="ui small left icon input">
|
2017-04-21 05:36:45 +00:00
|
|
|
|
<input type="text" name="name" value="{{{.Task.Task.Name}}}">
|
2017-04-07 01:13:36 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="two fields">
|
|
|
|
|
<div class="field">
|
|
|
|
|
<label>crontab表达式 (每行一个表达式)</label>
|
2017-04-21 05:36:45 +00:00
|
|
|
|
<textarea rows="5" name="spec">{{{.Task.Spec}}}</textarea>
|
2017-04-07 01:13:36 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="three fields">
|
|
|
|
|
<div class="field">
|
|
|
|
|
<label>协议</label>
|
|
|
|
|
<div class="ui dropdown selection">
|
2017-04-17 10:04:30 +00:00
|
|
|
|
{{{if .Task}}}
|
|
|
|
|
<input type="hidden" name="protocol" value="{{{if (gt .Task.Protocol 0)}}}{{{.Task.Protocol}}}{{{else}}}3{{{end}}}">
|
|
|
|
|
{{{else}}}
|
|
|
|
|
<input type="hidden" name="protocol" value="3">
|
|
|
|
|
{{{end}}}
|
2017-04-16 18:01:41 +00:00
|
|
|
|
<div class="default text">本地命令</div>
|
2017-04-07 01:13:36 +00:00
|
|
|
|
<i class="dropdown icon"></i>
|
|
|
|
|
<div class="menu">
|
2017-04-17 10:04:30 +00:00
|
|
|
|
<div class="item" data-value="3">本地命令</div>
|
|
|
|
|
<div class="item" data-value="2">SSH</div>
|
2017-04-13 09:35:59 +00:00
|
|
|
|
<div class="item" data-value="1">HTTP</div>
|
2017-04-07 01:13:36 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2017-04-07 09:26:46 +00:00
|
|
|
|
</div>
|
|
|
|
|
<div class="field">
|
|
|
|
|
<label>主机</label>
|
|
|
|
|
<div class="inline fields">
|
|
|
|
|
{{{range $i, $v := .Hosts}}}
|
|
|
|
|
<div class="field">
|
2017-04-10 09:37:16 +00:00
|
|
|
|
<div class="ui radio checkbox">
|
2017-04-17 10:04:30 +00:00
|
|
|
|
{{{if $.Task}}}
|
|
|
|
|
<input type="radio" name="host_id" tabindex="0" class="hidden" value="{{{.Id}}}"
|
2017-04-21 05:36:45 +00:00
|
|
|
|
{{{if and (eq $.Task.Protocol 2) (eq $.Task.HostId .Id) }}} checked {{{end}}}
|
2017-04-17 10:04:30 +00:00
|
|
|
|
>
|
|
|
|
|
{{{else}}}
|
2017-04-20 01:36:42 +00:00
|
|
|
|
<input type="radio" name="host_id" tabindex="0" class="hidden" value="{{{.Id}}}">
|
2017-04-17 10:04:30 +00:00
|
|
|
|
{{{end}}}
|
2017-04-07 09:26:46 +00:00
|
|
|
|
<label>{{{.Alias}}}-{{{.Name}}}</label>
|
2017-04-07 01:13:36 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2017-04-07 09:26:46 +00:00
|
|
|
|
{{{end}}}
|
2017-04-07 01:13:36 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2017-04-21 05:36:45 +00:00
|
|
|
|
<div class="two fields">
|
|
|
|
|
<div class="field">
|
|
|
|
|
<label>命令(shell命令|URL地址, 多条shell命令";"分隔)</label>
|
|
|
|
|
<textarea rows="5" name="command">{{{.Task.Command}}}</textarea>
|
|
|
|
|
</div>
|
2017-04-07 01:13:36 +00:00
|
|
|
|
</div>
|
2017-04-21 09:41:59 +00:00
|
|
|
|
<div class="two fields">
|
2017-04-07 01:13:36 +00:00
|
|
|
|
<div class="field">
|
2017-04-21 06:50:40 +00:00
|
|
|
|
<label>任务超时时间 (单位秒, 默认0,不限制超时)</label>
|
2017-04-21 05:36:45 +00:00
|
|
|
|
<input type="text" name="timeout" value="{{{.Task.Timeout}}}">
|
2017-04-07 01:13:36 +00:00
|
|
|
|
</div>
|
2017-04-21 06:50:40 +00:00
|
|
|
|
<div class="field">
|
2017-04-21 09:41:59 +00:00
|
|
|
|
<label>任务执行事变 (单位秒,0不限制,不能超过24小时)</label>
|
|
|
|
|
<input type="text" name="timeout" value="{{{.Task.Timeout}}}">
|
2017-04-21 06:50:40 +00:00
|
|
|
|
</div>
|
2017-04-13 09:35:59 +00:00
|
|
|
|
</div>
|
2017-04-21 09:41:59 +00:00
|
|
|
|
<div class="three fields">
|
2017-04-07 01:13:36 +00:00
|
|
|
|
<div class="field">
|
2017-04-13 09:35:59 +00:00
|
|
|
|
<label>任务状态 (任务添加成功后,是否立即调度)</label>
|
|
|
|
|
<div class="ui dropdown selection">
|
2017-04-17 10:04:30 +00:00
|
|
|
|
{{{if .Task}}}
|
|
|
|
|
<input type="hidden" name="status" value="{{{if and .Task.Status (eq .Task.Status 1)}}}1{{{else}}}2{{{end}}}">
|
|
|
|
|
{{{else}}}
|
|
|
|
|
<input type="hidden" name="status" value="2">
|
|
|
|
|
{{{end}}}
|
|
|
|
|
<div class="default text">暂停</div>
|
2017-04-13 09:35:59 +00:00
|
|
|
|
<i class="dropdown icon"></i>
|
|
|
|
|
<div class="menu">
|
2017-04-17 10:04:30 +00:00
|
|
|
|
<div class="item" data-value="2">暂停</div>
|
2017-04-13 09:35:59 +00:00
|
|
|
|
<div class="item" data-value="1">激活</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2017-04-07 01:13:36 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2017-04-21 05:36:45 +00:00
|
|
|
|
<div class="two fields">
|
2017-04-07 01:13:36 +00:00
|
|
|
|
<div class="field">
|
|
|
|
|
<label>备注</label>
|
2017-04-21 05:36:45 +00:00
|
|
|
|
<textarea rows="5" name="remark">{{{.Task.Remark}}}</textarea>
|
2017-04-07 01:13:36 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2017-04-17 10:04:30 +00:00
|
|
|
|
<div class="ui primary submit button">保存</div>
|
2017-04-07 01:13:36 +00:00
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
2017-04-07 09:26:46 +00:00
|
|
|
|
$('.ui.checkbox')
|
|
|
|
|
.checkbox()
|
|
|
|
|
;
|
|
|
|
|
$('.ui.form').form(
|
|
|
|
|
{
|
|
|
|
|
onSuccess: function(event, fields) {
|
|
|
|
|
util.post('/task/store', fields, function(code, message) {
|
2017-04-08 09:15:30 +00:00
|
|
|
|
location.href = "/task"
|
2017-04-07 09:26:46 +00:00
|
|
|
|
});
|
2017-04-07 01:13:36 +00:00
|
|
|
|
|
2017-04-07 09:26:46 +00:00
|
|
|
|
return false;
|
|
|
|
|
},
|
|
|
|
|
fields: {
|
|
|
|
|
name: {
|
|
|
|
|
identifier : 'name',
|
|
|
|
|
rules: [
|
|
|
|
|
{
|
|
|
|
|
type : 'empty',
|
|
|
|
|
prompt : '请输入任务名称'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
spec: {
|
|
|
|
|
identifier : 'spec',
|
|
|
|
|
rules: [
|
|
|
|
|
{
|
|
|
|
|
type : 'empty',
|
|
|
|
|
prompt : '请输入crontab格式表达式'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
command: {
|
|
|
|
|
identifier : 'command',
|
|
|
|
|
rules: [
|
|
|
|
|
{
|
|
|
|
|
type : 'empty',
|
|
|
|
|
prompt : '请输入任务命令'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}, hosts: {
|
|
|
|
|
identifier : 'hosts',
|
|
|
|
|
rules: [
|
|
|
|
|
{
|
|
|
|
|
type : 'checked',
|
|
|
|
|
prompt : '请选择主机'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
inline : true
|
|
|
|
|
});
|
2017-04-07 01:13:36 +00:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
{{{ template "common/footer" . }}}
|