Skip to content

Commit 0083801

Browse files
committed
Tested correlated job log view. Seems to work but the log chopping is still worse
1 parent b8a6922 commit 0083801

File tree

3 files changed

+40
-9
lines changed

3 files changed

+40
-9
lines changed

Diff for: frontend/client/views/pipeline/detail.vue

+7-1
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,13 @@ export default {
350350
},
351351
352352
jobLog () {
353-
this.$router.push({path: '/pipeline/log', query: { pipelineid: this.pipelineID, runid: this.runID, jobid: this.job.internalID }})
353+
var jobid = null
354+
if (this.job) {
355+
jobid = this.job.intervalID
356+
}
357+
358+
// Route
359+
this.$router.push({path: '/pipeline/log', query: { pipelineid: this.pipelineID, runid: this.runID, jobid: jobid }})
354360
},
355361
356362
startPipeline (pipelineid) {

Diff for: frontend/client/views/pipeline/log.vue

+23-8
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,29 @@ export default {
6767
})
6868
.then(response => {
6969
if (response.data) {
70-
// We add the received log
71-
this.logText += response.data.log
72-
73-
// LF does not work for HTML. Replace with <br />
74-
this.logText = this.logText.replace(/\n/g, '<br />')
75-
76-
// Set the new start position defined by return value
77-
this.startPos = response.data.start
70+
// Check if we got multiple objects
71+
var finished = true
72+
for (let i = 0, l = response.data.length; i < l; i++) {
73+
// We add the received log
74+
this.logText += response.data[i].log
75+
76+
// LF does not work for HTML. Replace with <br />
77+
this.logText = this.logText.replace(/\n/g, '<br />')
78+
79+
// Set the new start position defined by return value
80+
this.startPos = response.data[i].start
81+
82+
// Job not finished?
83+
if (!response.data[i].finished) {
84+
finished = false
85+
}
86+
}
87+
88+
// All jobs finished. Stop interval.
89+
if (finished) {
90+
this.jobRunning = false
91+
clearInterval(this.intervalID)
92+
}
7893
}
7994
})
8095
.catch((error) => {

Diff for: handlers/pipeline_run.go

+10
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ func GetJobLogs(c echo.Context) error {
126126
return c.String(http.StatusBadRequest, err.Error())
127127
}
128128

129+
// Check if job is finished
130+
if job.Status == gaia.JobSuccess || job.Status == gaia.JobFailed {
131+
jL.Finished = true
132+
}
133+
129134
return c.JSON(http.StatusOK, *jL)
130135
}
131136
}
@@ -148,6 +153,11 @@ func GetJobLogs(c echo.Context) error {
148153
return c.String(http.StatusBadRequest, err.Error())
149154
}
150155

156+
// Check if job is finished
157+
if job.Status == gaia.JobSuccess || job.Status == gaia.JobFailed {
158+
jL.Finished = true
159+
}
160+
151161
jobs = append(jobs, *jL)
152162
}
153163

0 commit comments

Comments
 (0)