mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Logs: Fix scrolling with exploreScrollableLogsContainer
feature flag (#70164)
correct scrolling with `exploreScrollableLogsContainer`
This commit is contained in:
parent
271cdb4baa
commit
1a985c488c
@ -136,6 +136,7 @@ class UnthemedLogs extends PureComponent<Props, State> {
|
|||||||
cancelFlippingTimer?: number;
|
cancelFlippingTimer?: number;
|
||||||
topLogsRef = createRef<HTMLDivElement>();
|
topLogsRef = createRef<HTMLDivElement>();
|
||||||
logsVolumeEventBus: EventBus;
|
logsVolumeEventBus: EventBus;
|
||||||
|
logsContainer = createRef<HTMLDivElement>();
|
||||||
|
|
||||||
state: State = {
|
state: State = {
|
||||||
showLabels: store.getBool(SETTINGS_KEYS.showLabels, false),
|
showLabels: store.getBool(SETTINGS_KEYS.showLabels, false),
|
||||||
@ -370,6 +371,17 @@ class UnthemedLogs extends PureComponent<Props, State> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
scrollIntoView = (element: HTMLElement) => {
|
scrollIntoView = (element: HTMLElement) => {
|
||||||
|
if (config.featureToggles.exploreScrollableLogsContainer) {
|
||||||
|
this.scrollToTopLogs();
|
||||||
|
if (this.logsContainer.current) {
|
||||||
|
this.logsContainer.current.scroll({
|
||||||
|
behavior: 'smooth',
|
||||||
|
top: this.logsContainer.current.scrollTop + element.getBoundingClientRect().top - window.innerHeight / 2,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
const { scrollElement } = this.props;
|
const { scrollElement } = this.props;
|
||||||
|
|
||||||
if (scrollElement) {
|
if (scrollElement) {
|
||||||
@ -582,7 +594,7 @@ class UnthemedLogs extends PureComponent<Props, State> {
|
|||||||
clearDetectedFields={this.clearDetectedFields}
|
clearDetectedFields={this.clearDetectedFields}
|
||||||
/>
|
/>
|
||||||
<div className={styles.logsSection}>
|
<div className={styles.logsSection}>
|
||||||
<div className={styles.logRows} data-testid="logRows">
|
<div className={styles.logRows} data-testid="logRows" ref={this.logsContainer}>
|
||||||
<LogRows
|
<LogRows
|
||||||
logRows={logRows}
|
logRows={logRows}
|
||||||
deduplicatedRows={dedupedRows}
|
deduplicatedRows={dedupedRows}
|
||||||
|
Loading…
Reference in New Issue
Block a user