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

View File

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

View File

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