Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add action auto-scroll #30057

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion web_src/js/components/RepoActionView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,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 > 0 && clientHeight >= logsContainerHeight) {
bytedream marked this conversation as resolved.
Show resolved Hide resolved
const newLogsContainerHeight = this.$refs.stepsContainer.getBoundingClientRect().bottom + window.scrollY;
window.scrollTo({top: clientHeight + (newLogsContainerHeight - logsContainerHeight), behavior: 'smooth'});
silverwind marked this conversation as resolved.
Show resolved Hide resolved
}
},

async fetchArtifacts() {
Expand Down Expand Up @@ -424,7 +435,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