Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add rerun single (failed) job button in UI #470

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/dashboard-client/src/components/job/JobDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@
<md-icon>replay</md-icon><span class="m-l-xs">Restart Job</span>
<md-tooltip md-direction="bottom">Restart Job</md-tooltip>
</md-button>
<md-button class="md-raised md-primary md-dense" v-on:click="job.rerun()">
<md-icon>replay</md-icon><span class="m-l-xs">Rerun Single Job</span>
<md-tooltip md-direction="bottom">Rerun Single Job</md-tooltip>
</md-button>
<md-button class="md-raised md-primary md-dense" v-on:click="job.clearCache()">
<md-icon>delete_sweep</md-icon><span class="m-l-xs">Clear Cache</span>
<md-tooltip md-direction="bottom">Clear Job</md-tooltip>
Expand Down Expand Up @@ -115,6 +119,12 @@
<md-tooltip md-direction="bottom">Restart Job</md-tooltip>
</md-button>
</div>
<div class="m-r-xl">
<md-button class="md-icon-button md-primary md-raised md-dense" v-on:click="job.rerun()">
<md-icon style="color: white">replay</md-icon>
<md-tooltip md-direction="bottom">Rerun Single Job</md-tooltip>
</md-button>
</div>
<div class="m-r-xl">
<md-button class="md-icon-button md-primary md-raised md-dense" v-on:click="job.clearCache()">
<md-icon style="color: white">delete_sweep</md-icon>
Expand Down
29 changes: 29 additions & 0 deletions src/dashboard-client/src/models/Job.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,35 @@ export default class Job {
})
}

rerun () {
return NewAPIService.get(`projects/${this.project.id}/jobs/${this.id}/rerun`)
.then((message) => {
NotificationService.$emit('NOTIFICATION', new Notification(message, 'done'))
return this.project._loadBuild(this.build.number, this.build.restartCounter)
}).then((build) => {
let a = this.name.split('.')
let name = a[0] + '.'

if (a.length > 1) {
name += (parseInt(a[1]) + 1).toString()
} else {
name += '1'
}
router.push({
name: 'JobDetail',
params: {
projectName: encodeURIComponent(this.project.name),
buildNumber: this.build.number,
buildRestartCounter: this.build.restartCounter,
jobName: name
}
})
})
.catch((err) => {
NotificationService.$emit('NOTIFICATION', new Notification(err))
})
}

clearCache () {
return NewAPIService.get(`projects/${this.project.id}/jobs/${this.id}/cache/clear`)
.then((message) => {
Expand Down