Skip to content

Commit

Permalink
Merge pull request #1149 from dtaylor113/log-pause
Browse files Browse the repository at this point in the history
Logs: Fixed 'horizontally scrolling resumes paused streaming'
  • Loading branch information
openshift-merge-robot authored Feb 6, 2019
2 parents 6165533 + a300be6 commit 941b569
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions frontend/public/components/utils/log-window.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export class LogWindow extends React.PureComponent {
content: '',
height: '',
};
this.prevScrollLeft = null;
}

static getDerivedStateFromProps(nextProps) {
Expand Down Expand Up @@ -50,11 +51,19 @@ export class LogWindow extends React.PureComponent {
}

_handleScroll() {
const scrollLeftChanged = this.prevScrollLeft !== this.scrollPane.scrollLeft;

// Stream is finished, take no action on scroll
if (this.props.status === STREAM_EOF) {
return;
}

// If horizontal scrolling, take no action
if (scrollLeftChanged) {
this.prevScrollLeft = this.scrollPane.scrollLeft;
return;
}

// 1px fudge for fractional heights
const scrollTarget = this.scrollPane.scrollHeight - (this.scrollPane.clientHeight + 1);
if (this.scrollPane.scrollTop < scrollTarget) {
Expand All @@ -73,6 +82,7 @@ export class LogWindow extends React.PureComponent {

const targetHeight = Math.floor(window.innerHeight - this.scrollPane.getBoundingClientRect().top -
(this.props.isFullscreen ? FULLSCREEN_FUDGE_FACTOR : FUDGE_FACTOR));
this.prevScrollLeft = this.scrollPane.scrollLeft;
this.setState({
height: targetHeight,
});
Expand Down

0 comments on commit 941b569

Please sign in to comment.