Skip to content

Commit 17dffba

Browse files
committed
Fix links and job restart redirect, fixes #228
1 parent 25a8827 commit 17dffba

5 files changed

Lines changed: 31 additions & 11 deletions

File tree

src/dashboard-client/src/components/job/JobDetail.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,14 @@ export default {
257257
'ib-tab': Tab,
258258
'ib-archive': Archive
259259
},
260+
watch: {
261+
'$route' (to, from) {
262+
this.jobName = to.params.jobName
263+
this.project = null
264+
this.build = null
265+
this.job = null
266+
}
267+
},
260268
data () {
261269
return {
262270
build: null,

src/dashboard-client/src/components/test/TestDetail.vue

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,24 @@
44
<md-card-header class="main-card-header" style="padding-bottom: 10px">
55
<md-card-header-text>
66
<h3 class="md-title card-title">
7-
<router-link :to="{name: 'ProjectDetail', params: {
8-
projectName: encodeURIComponent(data.project.name)
9-
}}">
7+
<router-link :to="{name: 'ProjectDetailBuilds', params: {
8+
projectName: encodeURIComponent(data.project.name)}}">
109
<span v-if="data.project.isGit()"><i class="fa fa-github"></i></span>
1110
<span v-if="!data.project.isGit()"><i class="fa fa-home"></i></span>
1211
{{ data.project.name }}
1312
</router-link>
14-
/ <router-link :to="{name: 'BuildDetail', params: {
13+
/ <router-link :to="{name: 'BuildDetailGraph', params: {
1514
projectName: encodeURIComponent(data.project.name),
1615
buildNumber: data.build.number,
1716
buildRestartCounter: data.build.restartCounter
1817
}}">
1918
Build {{ data.build.number }}.{{ data.build.restartCounter }}
2019
</router-link>
2120
/ <router-link :to="{name: 'JobDetail', params: {
22-
projectName: encodeURIComponent(data.project.name),
23-
buildNumber: data.build.number,
24-
buildRestartCounter: data.build.restartCounter,
25-
jobId: data.job.name
21+
projectName: encodeURIComponent(data.project.name),
22+
buildNumber: data.build.number,
23+
buildRestartCounter: data.build.restartCounter,
24+
jobName: data.job.name
2625
}}">
2726
{{ data.job.name}}
2827
</router-link>

src/dashboard-client/src/models/Build.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export default class Build {
5454
return NewAPIService.get(`projects/${this.project.id}/builds/${this.id}/restart`)
5555
.then((message) => {
5656
NotificationService.$emit('NOTIFICATION', new Notification(message, 'done'))
57-
router.push(`/project/${this.project.name}/build/${this.number}/${message.data.build.restartCounter}/`)
57+
router.push(`/project/${encodeURIComponent(this.project.name)}/build/${this.number}/${message.data.build.restartCounter}/`)
5858
})
5959
.catch((err) => {
6060
NotificationService.$emit('NOTIFICATION', new Notification(err))

src/dashboard-client/src/models/Job.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,8 @@ export default class Job {
347347
return NewAPIService.get(`projects/${this.project.id}/jobs/${this.id}/restart`)
348348
.then((message) => {
349349
NotificationService.$emit('NOTIFICATION', new Notification(message, 'done'))
350+
return this.project._loadBuild(this.build.number, this.build.restartCounter)
351+
}).then((build) => {
350352
let a = this.name.split('.')
351353
let name = a[0] + '.'
352354

@@ -356,7 +358,15 @@ export default class Job {
356358
name += '1'
357359
}
358360

359-
router.push(`/project/${this.project.name}/build/${this.build.number}/${this.build.restartCounter}/job/${name}`)
361+
router.push({
362+
name: 'JobDetail',
363+
params: {
364+
projectName: encodeURIComponent(this.project.name),
365+
buildNumber: this.build.number,
366+
buildRestartCounter: this.build.restartCounter,
367+
jobName: encodeURIComponent(name)
368+
}
369+
})
360370
})
361371
.catch((err) => {
362372
NotificationService.$emit('NOTIFICATION', new Notification(err))

src/dashboard-client/src/models/Project.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ export default class Project {
3636
}
3737

3838
userHasDevRights () {
39-
console.log(this.userHasAdminRights() || this.userrole === 'Developer')
4039
return this.userHasAdminRights() || this.userrole === 'Developer'
4140
}
4241

@@ -58,6 +57,10 @@ export default class Project {
5857
return new Promise((resolve) => { resolve(b) })
5958
}
6059

60+
return this._loadBuild(number, restartCounter)
61+
}
62+
63+
_loadBuild (number, restartCounter) {
6164
return NewAPIService.get(`projects/${this.id}/builds/${number}/${restartCounter}`)
6265
.then((jobs) => {
6366
this._addJobs(jobs)

0 commit comments

Comments
 (0)