task: show setup step and logs

This commit is contained in:
Simone Gotti 2019-03-13 15:42:58 +01:00
parent b780e148cc
commit 604a0a2a1f
3 changed files with 25 additions and 21 deletions

View File

@ -22,6 +22,7 @@
<Log
v-bind:runid="runid"
v-bind:taskid="taskid"
v-bind:setup="setup"
v-bind:step="stepnum"
v-bind:stepphase="step.phase"
v-bind:show="active"
@ -53,6 +54,7 @@ export default {
props: {
runid: String,
taskid: String,
setup: Boolean,
stepnum: Number,
step: Object
},

View File

@ -18,6 +18,7 @@ export default {
show: Boolean,
runid: String,
taskid: String,
setup: Boolean,
step: Number,
stepphase: String
},
@ -49,17 +50,15 @@ export default {
}
},
streamLogs: function() {
this.es = new EventSource(
apiurlwithtoken(
"/logs?runID=" +
this.runid +
"&taskID=" +
this.taskid +
"&step=" +
this.step +
"&follow"
)
);
let path = "/logs?runID=" + this.runid + "&taskID=" + this.taskid;
if (this.setup) {
path += "&setup";
} else {
path += "&step=" + this.step;
}
path += "&follow&stream";
this.es = new EventSource(apiurlwithtoken(path));
this.es.onmessage = event => {
var data = event.data;
// TODO(sgotti) ansi_up doesn't handle carriage return (\r), find a way to also handle it
@ -71,16 +70,13 @@ export default {
};
},
getLogs: function() {
fetch(
apiurl(
"/logs?runID=" +
this.runid +
"&taskID=" +
this.taskid +
"&step=" +
this.step
)
)
let path = "/logs?runID=" + this.runid + "&taskID=" + this.taskid;
if (this.setup) {
path += "&setup";
} else {
path += "&step=" + this.step;
}
fetch(apiurl(path))
.then(r => {
if (r.status == 200) {
return r.text();

View File

@ -6,6 +6,12 @@
<span class="task-name" v-html="task.name"/>
<span class="tag" :class="taskClass(task)">{{ task.status | capitalize }}</span>
</div>
<Collapse
v-bind:runid="runid"
v-bind:taskid="taskid"
v-bind:setup="true"
v-bind:step="task.setup_step"
/>
<div v-for="(step, index) in task.steps" v-bind:key="index">
<Collapse
v-bind:runid="runid"