添加执行用户

pull/1/head
Doflatango 8 years ago committed by miraclesu
parent 5661cce065
commit 24e3a46d75

@ -221,6 +221,8 @@ func (j *Job) Check() error {
return ErrIllegalJobGroupName return ErrIllegalJobGroupName
} }
j.User = strings.TrimSpace(j.User)
// 不修改 Command 的内容,简单判断是否为空 // 不修改 Command 的内容,简单判断是否为空
if len(strings.TrimSpace(j.Command)) == 0 { if len(strings.TrimSpace(j.Command)) == 0 {
return ErrEmptyJobCommand return ErrEmptyJobCommand

@ -20,9 +20,15 @@
<Dropdown title="选择分组" allowAdditions=true v-bind:items="groups" v-bind:selected="job.group" v-on:change="changeGroup"/> <Dropdown title="选择分组" allowAdditions=true v-bind:items="groups" v-bind:selected="job.group" v-on:change="changeGroup"/>
</div> </div>
</div> </div>
<div class="field"> <div class="fields">
<label>任务脚本</label> <div class="twelve wide field">
<input type="text" v-model="job.cmd" placeholder="任务脚本"> <label>任务脚本</label>
<input type="text" v-model="job.cmd" placeholder="任务脚本">
</div>
<div class="four wide field">
<label>用户(可选)</label>
<input type="text" v-model="job.user" placeholder="指定执行脚本的用户">
</div>
</div> </div>
<div class="field"> <div class="field">
<span v-if="!job.rules || job.rules.length == 0"><i class="warning circle icon"></i></span> <span v-if="!job.rules || job.rules.length == 0"><i class="warning circle icon"></i></span>
@ -54,6 +60,7 @@ export default {
id: '', id: '',
name: '', name: '',
group: 'default', group: 'default',
user: '',
cmd: '', cmd: '',
pause: false, pause: false,
rules: [] rules: []

@ -135,7 +135,13 @@ export default {
}, },
submit: function(){ submit: function(){
this.$router.push('/log?'+this.buildQuery()); var query = this.buildQuery()
var url = '/log?'+query;
if (this.$router.fullPath == url) {
this.fetchList(query);
return;
}
this.$router.push(url);
}, },
durationAttention: function(beginTime, endTime){ durationAttention: function(beginTime, endTime){

Loading…
Cancel
Save