Skip to content

Commit

Permalink
Tested correlated job log view. Seems to work but the log chopping is…
Browse files Browse the repository at this point in the history
… still worse
  • Loading branch information
michelvocks committed May 30, 2018
1 parent b8a6922 commit 0083801
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 9 deletions.
8 changes: 7 additions & 1 deletion frontend/client/views/pipeline/detail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,13 @@ export default {
},
jobLog () {
this.$router.push({path: '/pipeline/log', query: { pipelineid: this.pipelineID, runid: this.runID, jobid: this.job.internalID }})
var jobid = null
if (this.job) {
jobid = this.job.intervalID
}
// Route
this.$router.push({path: '/pipeline/log', query: { pipelineid: this.pipelineID, runid: this.runID, jobid: jobid }})
},
startPipeline (pipelineid) {
Expand Down
31 changes: 23 additions & 8 deletions frontend/client/views/pipeline/log.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,29 @@ export default {
})
.then(response => {
if (response.data) {
// We add the received log
this.logText += response.data.log
// LF does not work for HTML. Replace with <br />
this.logText = this.logText.replace(/\n/g, '<br />')
// Set the new start position defined by return value
this.startPos = response.data.start
// Check if we got multiple objects
var finished = true
for (let i = 0, l = response.data.length; i < l; i++) {
// We add the received log
this.logText += response.data[i].log
// LF does not work for HTML. Replace with <br />
this.logText = this.logText.replace(/\n/g, '<br />')
// Set the new start position defined by return value
this.startPos = response.data[i].start
// Job not finished?
if (!response.data[i].finished) {
finished = false
}
}
// All jobs finished. Stop interval.
if (finished) {
this.jobRunning = false
clearInterval(this.intervalID)
}
}
})
.catch((error) => {
Expand Down
10 changes: 10 additions & 0 deletions handlers/pipeline_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ func GetJobLogs(c echo.Context) error {
return c.String(http.StatusBadRequest, err.Error())
}

// Check if job is finished
if job.Status == gaia.JobSuccess || job.Status == gaia.JobFailed {
jL.Finished = true
}

return c.JSON(http.StatusOK, *jL)
}
}
Expand All @@ -148,6 +153,11 @@ func GetJobLogs(c echo.Context) error {
return c.String(http.StatusBadRequest, err.Error())
}

// Check if job is finished
if job.Status == gaia.JobSuccess || job.Status == gaia.JobFailed {
jL.Finished = true
}

jobs = append(jobs, *jL)
}

Expand Down

0 comments on commit 0083801

Please sign in to comment.