Skip to content

Commit

Permalink
Add action auto-scrolling
Browse files Browse the repository at this point in the history
  • Loading branch information
bytedream committed Mar 25, 2024
1 parent 3f26fe2 commit 1bf3cd3
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion web_src/js/components/RepoActionView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,24 @@ 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 > 0) {
if (clientHeight >= logsContainerHeight) {
const newLogsContainerHeight = this.$refs.stepsContainer.getBoundingClientRect().bottom + window.scrollY;
window.scrollTo({top: clientHeight + (newLogsContainerHeight - logsContainerHeight), behavior: 'smooth'});
}
}
},
async fetchArtifacts() {
Expand Down Expand Up @@ -424,7 +437,7 @@ export function initRepositoryActionView() {
</div>
</div>
<div class="action-view-right">
<div class="action-view-right" ref="stepsContainer">
<div class="job-info-header">
<div class="job-info-header-left">
<h3 class="job-info-header-title">
Expand Down

0 comments on commit 1bf3cd3

Please sign in to comment.