diff --git a/src/resources/js/app.js b/src/resources/js/app.js index 99e07f7..f5eb3b8 100644 --- a/src/resources/js/app.js +++ b/src/resources/js/app.js @@ -658,6 +658,7 @@ var Job = function() { }(); const Run = function() { + const utf8decoder = new TextDecoder('utf-8'); var state = { job: { artifacts: [], upstream: {} }, latestNum: null, @@ -668,10 +669,13 @@ const Run = function() { const logFetcher = (vm, name, num) => { const abort = new AbortController(); fetch('/log/'+name+'/'+num, {signal:abort.signal}).then(res => { - const reader = res.body.pipeThrough(new TextDecoderStream).getReader(); + // ATOW pipeThrough not supported in Firefox + //const reader = res.body.pipeThrough(new TextDecoderStream).getReader(); + const reader = res.body.getReader(); let total = 0; return function pump() { return reader.read().then(({done, value}) => { + value = utf8decoder.decode(value); if (done) return; state.log += ansi_up.ansi_to_html(value.replace(//g,'>').replace(/\033\[\{([^:]+):(\d+)\033\\/g, (m,$1,$2)=>{return ''+$1+':#'+$2+'';})); @@ -683,12 +687,11 @@ const Run = function() { } return pump(); }); - } + }(); }).catch(e => {}); return abort; } - return { template: '#run', mixins: [WebsocketHandler, Utils, ProgressUpdater], @@ -729,7 +732,7 @@ const Run = function() { next(); }, beforeRouteLeave(to, from, next) { - this.logstream.close(); + this.logstream.abort(); next(); } };