Merge pull request #120 from lbbniu/master_ui_optimize

optimize job edit user experience
pull/125/head
QLeelulu 2018-11-28 16:45:09 +08:00 committed by GitHub
commit 408311a38d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 3 deletions

View File

@ -48,7 +48,7 @@
<div class="ui icon dropdown" v-show="!batched">
<i class="content icon"></i>
<div class="menu">
<div class="item" v-on:click="$router.push('/job/edit/'+job.group+'/'+job.id)">{{$L('edit')}}</div>
<div class="item" v-on:click="editJob(job.group, job.id)">{{$L('edit')}}</div>
<div class="item" v-if="job.pause" v-on:click="changeStatus(job.group, job.id, index, !job.pause)">{{$L('open')}}</div>
<div class="item" v-if="!job.pause" v-on:click="changeStatus(job.group, job.id, index, !job.pause)">{{$L('pause')}}</div>
<div class="divider"></div>
@ -62,7 +62,7 @@
<td class="center aligned"><i class="icon" v-bind:class="{pause: job.pause, play: !job.pause, green: !job.pause}"></i></td>
<td>{{job.group}}</td>
<td>{{job.user && job.user.length > 0 ? job.user : '-'}}</td>
<td><router-link :to="'/job/edit/'+job.group+'/'+job.id">{{job.name}}</router-link></td>
<td><router-link :to="buildEditJobURL(job.group, job.id)">{{job.name}}</router-link></td>
<td>
<span v-if="!job.latestStatus">-</span>
<span v-else>{{formatLatest(job.latestStatus)}}</span>
@ -165,6 +165,19 @@ export default {
this.fetchList(this.buildQuery());
},
editJob: function(group, id){
this.$router.push( this.buildEditJobURL(group, id) );
},
buildEditJobURL: function(group, id){
var query = this.buildQuery();
if(query == ''){
return '/job/edit/'+group+'/'+id;
}else{
return '/job/edit/'+group+'/'+id+ '?'+query;
}
},
removeJob: function(group, id, index){
var vm = this;
this.$rest.DELETE('job/'+group+'-'+id).onsucceed(204, (resp)=>{

View File

@ -174,7 +174,7 @@ export default {
this.loading = true;
var vm = this;
this.$rest.PUT('job', this.job)
.onsucceed(exceptCode, ()=>{vm.$router.push('/job')})
.onsucceed(exceptCode, ()=>{vm.$router.push('/job',{query:vm.$route.query})})
.onfailed((resp)=>{vm.$bus.$emit('error', resp)})
.onend(()=>{vm.loading=false})
.do();