This commit is contained in:
Přemysl Eric Janouch 2024-12-27 02:21:37 +01:00
parent 280114a5d3
commit a492b3b668
Signed by: p
GPG Key ID: A0420B94F92B9493

View File

@ -314,9 +314,7 @@ function get(id) {
return document.getElementById(id) return document.getElementById(id)
} }
function getLog(id) { function getLog(id) {
const header = document.getElementById(id) const header = get(id), log = get(id + 'log'), text = log.textContent
const log = document.getElementById(id + 'log')
const text = log.textContent
// lines[-1] is an implementation detail of terminalWriter.Serialize, // lines[-1] is an implementation detail of terminalWriter.Serialize,
// lines[-2] is the actual last line. // lines[-2] is the actual last line.
const last = Math.max(0, text.split('\n').length - 2) const last = Math.max(0, text.split('\n').length - 2)
@ -334,8 +332,7 @@ function refreshLog(log, top, changed) {
log.log.hidden = empty log.log.hidden = empty
} }
let refresher = setInterval(() => { let refresher = setInterval(() => {
let run = getLog('run'), task = getLog('task'), deploy = getLog('deploy') const run = getLog('run'), task = getLog('task'), deploy = getLog('deploy')
const url = new URL(window.location.href) const url = new URL(window.location.href)
url.search = '' url.search = ''
url.searchParams.set('json', '') url.searchParams.set('json', '')
@ -374,8 +371,8 @@ let refresher = setInterval(() => {
if (!data.IsRunning) if (!data.IsRunning)
clearInterval(refresher) clearInterval(refresher)
}).catch(error => { }).catch(error => {
alert(error)
clearInterval(refresher) clearInterval(refresher)
alert(error)
}) })
}, 1000 /* For faster updates than this, we should use WebSockets. */) }, 1000 /* For faster updates than this, we should use WebSockets. */)
</script> </script>