diff --git a/web_src/js/components/RepoActionView.vue b/web_src/js/components/RepoActionView.vue index 8b39d0504b..47f281cbb8 100644 --- a/web_src/js/components/RepoActionView.vue +++ b/web_src/js/components/RepoActionView.vue @@ -191,11 +191,22 @@ const sfc = { }, appendLogs(stepIndex, logLines, startTime) { + // position of the client view relative to the website top + const clientHeight = document.documentElement.clientHeight + window.scrollY; + // height of the logs container relative to the website top + const logsContainerHeight = this.$refs.stepsContainer.getBoundingClientRect().bottom + window.scrollY; + for (const line of logLines) { // TODO: group support: ##[group]GroupTitle , ##[endgroup] const el = this.getLogsContainer(stepIndex); el.append(this.createLogLine(line, startTime, stepIndex)); } + + // scrolls to the bottom if job is running and the bottom of the logs container is visible + if (!this.run.done && logLines.length && clientHeight >= logsContainerHeight) { + const newLogsContainerHeight = this.$refs.stepsContainer.getBoundingClientRect().bottom + window.scrollY; + window.scrollTo({top: clientHeight + (newLogsContainerHeight - logsContainerHeight), behavior: 'smooth'}); + } }, async fetchArtifacts() { @@ -436,7 +447,7 @@ export function initRepositoryActionView() { -
+