aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2024-12-27 02:21:37 +0100
committerPřemysl Eric Janouch <p@janouch.name>2024-12-28 00:27:46 +0100
commita492b3b668c1c9be410a7b126550129fba67025a (patch)
tree66d1ad7502e7e01028a533a24a038d38f5737d8b
parent280114a5d3a756b820ce74426aa628cf938ccbf4 (diff)
downloadacid-a492b3b668c1c9be410a7b126550129fba67025a.tar.gz
acid-a492b3b668c1c9be410a7b126550129fba67025a.tar.xz
acid-a492b3b668c1c9be410a7b126550129fba67025a.zip
Clean up
-rw-r--r--acid.go9
1 files changed, 3 insertions, 6 deletions
diff --git a/acid.go b/acid.go
index cf5acaa..fd6ce76 100644
--- a/acid.go
+++ b/acid.go
@@ -314,9 +314,7 @@ function get(id) {
return document.getElementById(id)
}
function getLog(id) {
- const header = document.getElementById(id)
- const log = document.getElementById(id + 'log')
- const text = log.textContent
+ const header = get(id), log = get(id + 'log'), text = log.textContent
// lines[-1] is an implementation detail of terminalWriter.Serialize,
// lines[-2] is the actual last line.
const last = Math.max(0, text.split('\n').length - 2)
@@ -334,8 +332,7 @@ function refreshLog(log, top, changed) {
log.log.hidden = empty
}
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)
url.search = ''
url.searchParams.set('json', '')
@@ -374,8 +371,8 @@ let refresher = setInterval(() => {
if (!data.IsRunning)
clearInterval(refresher)
}).catch(error => {
- alert(error)
clearInterval(refresher)
+ alert(error)
})
}, 1000 /* For faster updates than this, we should use WebSockets. */)
</script>