mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
ScrollContainer: use in Explore pages (#95830)
use ScrollContainer in explore pages
This commit is contained in:
parent
4a362d41a6
commit
2458329f4f
@ -32,7 +32,7 @@ describe('Trace view', () => {
|
|||||||
e2e.components.TraceViewer.spanBar()
|
e2e.components.TraceViewer.spanBar()
|
||||||
.its('length')
|
.its('length')
|
||||||
.then((oldLength) => {
|
.then((oldLength) => {
|
||||||
e2e.pages.Explore.General.scrollView().children('.scrollbar-view').scrollTo('center');
|
e2e.pages.Explore.General.scrollView().children().first().scrollTo('center');
|
||||||
|
|
||||||
// After scrolling we should load more spans
|
// After scrolling we should load more spans
|
||||||
e2e.components.TraceViewer.spanBar().should(($span) => {
|
e2e.components.TraceViewer.spanBar().should(($span) => {
|
||||||
|
@ -32,7 +32,7 @@ describe('Trace view', () => {
|
|||||||
e2e.components.TraceViewer.spanBar()
|
e2e.components.TraceViewer.spanBar()
|
||||||
.its('length')
|
.its('length')
|
||||||
.then((oldLength) => {
|
.then((oldLength) => {
|
||||||
e2e.pages.Explore.General.scrollView().children('.scrollbar-view').scrollTo('center');
|
e2e.pages.Explore.General.scrollView().children().first().scrollTo('center');
|
||||||
|
|
||||||
// After scrolling we should load more spans
|
// After scrolling we should load more spans
|
||||||
e2e.components.TraceViewer.spanBar().should(($span) => {
|
e2e.components.TraceViewer.spanBar().should(($span) => {
|
||||||
|
@ -4,7 +4,8 @@ import { useToggle, useScroll } from 'react-use';
|
|||||||
|
|
||||||
import { GrafanaTheme2, store } from '@grafana/data';
|
import { GrafanaTheme2, store } from '@grafana/data';
|
||||||
import { reportInteraction } from '@grafana/runtime';
|
import { reportInteraction } from '@grafana/runtime';
|
||||||
import { useStyles2, PanelContainer, CustomScrollbar } from '@grafana/ui';
|
import { useStyles2, PanelContainer } from '@grafana/ui';
|
||||||
|
import { ScrollContainer } from '@grafana/ui/src/unstable';
|
||||||
|
|
||||||
import { ContentOutlineItemContextProps, useContentOutlineContext } from './ContentOutlineContext';
|
import { ContentOutlineItemContextProps, useContentOutlineContext } from './ContentOutlineContext';
|
||||||
import { ContentOutlineItemButton } from './ContentOutlineItemButton';
|
import { ContentOutlineItemButton } from './ContentOutlineItemButton';
|
||||||
@ -154,7 +155,7 @@ export function ContentOutline({ scroller, panelId }: { scroller: HTMLElement |
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<PanelContainer className={styles.wrapper} id={panelId}>
|
<PanelContainer className={styles.wrapper} id={panelId}>
|
||||||
<CustomScrollbar>
|
<ScrollContainer>
|
||||||
<div className={styles.content}>
|
<div className={styles.content}>
|
||||||
<ContentOutlineItemButton
|
<ContentOutlineItemButton
|
||||||
icon={'arrow-from-right'}
|
icon={'arrow-from-right'}
|
||||||
@ -235,7 +236,7 @@ export function ContentOutline({ scroller, panelId }: { scroller: HTMLElement |
|
|||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
</CustomScrollbar>
|
</ScrollContainer>
|
||||||
</PanelContainer>
|
</PanelContainer>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -20,15 +20,9 @@ import {
|
|||||||
import { selectors } from '@grafana/e2e-selectors';
|
import { selectors } from '@grafana/e2e-selectors';
|
||||||
import { getDataSourceSrv, reportInteraction } from '@grafana/runtime';
|
import { getDataSourceSrv, reportInteraction } from '@grafana/runtime';
|
||||||
import { DataQuery } from '@grafana/schema';
|
import { DataQuery } from '@grafana/schema';
|
||||||
import {
|
import { AdHocFilterItem, ErrorBoundaryAlert, PanelContainer, Themeable2, withTheme2 } from '@grafana/ui';
|
||||||
AdHocFilterItem,
|
|
||||||
CustomScrollbar,
|
|
||||||
ErrorBoundaryAlert,
|
|
||||||
PanelContainer,
|
|
||||||
Themeable2,
|
|
||||||
withTheme2,
|
|
||||||
} from '@grafana/ui';
|
|
||||||
import { FILTER_FOR_OPERATOR, FILTER_OUT_OPERATOR } from '@grafana/ui/src/components/Table/types';
|
import { FILTER_FOR_OPERATOR, FILTER_OUT_OPERATOR } from '@grafana/ui/src/components/Table/types';
|
||||||
|
import { ScrollContainer } from '@grafana/ui/src/unstable';
|
||||||
import { supportedFeatures } from 'app/core/history/richHistoryStorageProvider';
|
import { supportedFeatures } from 'app/core/history/richHistoryStorageProvider';
|
||||||
import { MIXED_DATASOURCE_NAME } from 'app/plugins/datasource/mixed/MixedDataSource';
|
import { MIXED_DATASOURCE_NAME } from 'app/plugins/datasource/mixed/MixedDataSource';
|
||||||
import { StoreState } from 'app/types';
|
import { StoreState } from 'app/types';
|
||||||
@ -578,10 +572,9 @@ export class Explore extends PureComponent<Props, ExploreState> {
|
|||||||
{contentOutlineVisible && (
|
{contentOutlineVisible && (
|
||||||
<ContentOutline scroller={this.scrollElement} panelId={`content-outline-container-${exploreId}`} />
|
<ContentOutline scroller={this.scrollElement} panelId={`content-outline-container-${exploreId}`} />
|
||||||
)}
|
)}
|
||||||
<CustomScrollbar
|
<ScrollContainer
|
||||||
testId={selectors.pages.Explore.General.scrollView}
|
data-testid={selectors.pages.Explore.General.scrollView}
|
||||||
scrollRefCallback={(scrollElement) => (this.scrollElement = scrollElement || undefined)}
|
ref={(scrollElement) => (this.scrollElement = scrollElement || undefined)}
|
||||||
hideHorizontalTrack
|
|
||||||
>
|
>
|
||||||
<div className={styles.exploreContainer}>
|
<div className={styles.exploreContainer}>
|
||||||
{datasourceInstance ? (
|
{datasourceInstance ? (
|
||||||
@ -649,7 +642,7 @@ export class Explore extends PureComponent<Props, ExploreState> {
|
|||||||
this.renderEmptyState(styles.exploreContainer)
|
this.renderEmptyState(styles.exploreContainer)
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</CustomScrollbar>
|
</ScrollContainer>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ContentOutlineContextProvider>
|
</ContentOutlineContextProvider>
|
||||||
|
@ -4,7 +4,6 @@ import { connect } from 'react-redux';
|
|||||||
|
|
||||||
import { EventBusSrv, getTimeZone } from '@grafana/data';
|
import { EventBusSrv, getTimeZone } from '@grafana/data';
|
||||||
import { selectors } from '@grafana/e2e-selectors';
|
import { selectors } from '@grafana/e2e-selectors';
|
||||||
import { CustomScrollbar } from '@grafana/ui';
|
|
||||||
import { stopQueryState } from 'app/core/utils/explore';
|
import { stopQueryState } from 'app/core/utils/explore';
|
||||||
import { StoreState, useSelector } from 'app/types';
|
import { StoreState, useSelector } from 'app/types';
|
||||||
|
|
||||||
@ -45,7 +44,6 @@ function ExplorePaneContainerUnconnected({ exploreId }: Props) {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CustomScrollbar hideVerticalTrack>
|
|
||||||
<div className={containerStyles} ref={ref} data-testid={selectors.pages.Explore.General.container}>
|
<div className={containerStyles} ref={ref} data-testid={selectors.pages.Explore.General.container}>
|
||||||
<Explore
|
<Explore
|
||||||
exploreId={exploreId}
|
exploreId={exploreId}
|
||||||
@ -61,7 +59,6 @@ function ExplorePaneContainerUnconnected({ exploreId }: Props) {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</CustomScrollbar>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,8 @@ import { css, cx } from '@emotion/css';
|
|||||||
|
|
||||||
import { dateTimeFormat, systemDateFormats, GrafanaTheme2 } from '@grafana/data';
|
import { dateTimeFormat, systemDateFormats, GrafanaTheme2 } from '@grafana/data';
|
||||||
import { TimeZone } from '@grafana/schema';
|
import { TimeZone } from '@grafana/schema';
|
||||||
import { CustomScrollbar, Spinner, useTheme2, clearButtonStyles } from '@grafana/ui';
|
import { Spinner, useTheme2, clearButtonStyles } from '@grafana/ui';
|
||||||
|
import { ScrollContainer } from '@grafana/ui/src/unstable';
|
||||||
|
|
||||||
import { LogsPage } from './LogsNavigation';
|
import { LogsPage } from './LogsNavigation';
|
||||||
|
|
||||||
@ -36,7 +37,7 @@ export function LogsNavigationPages({ pages, currentPageIndex, oldestLogsFirst,
|
|||||||
const styles = getStyles(theme, loading);
|
const styles = getStyles(theme, loading);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CustomScrollbar autoHide>
|
<ScrollContainer>
|
||||||
<div className={styles.pagesWrapper} data-testid="logsNavigationPages">
|
<div className={styles.pagesWrapper} data-testid="logsNavigationPages">
|
||||||
<div className={styles.pagesContainer}>
|
<div className={styles.pagesContainer}>
|
||||||
{pages.map((page: LogsPage, index: number) => (
|
{pages.map((page: LogsPage, index: number) => (
|
||||||
@ -58,7 +59,7 @@ export function LogsNavigationPages({ pages, currentPageIndex, oldestLogsFirst,
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</CustomScrollbar>
|
</ScrollContainer>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +70,6 @@ const getStyles = (theme: GrafanaTheme2, loading: boolean) => {
|
|||||||
paddingLeft: theme.spacing(0.5),
|
paddingLeft: theme.spacing(0.5),
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexDirection: 'column',
|
flexDirection: 'column',
|
||||||
overflowY: 'scroll',
|
|
||||||
'&::after': {
|
'&::after': {
|
||||||
content: "''",
|
content: "''",
|
||||||
display: 'block',
|
display: 'block',
|
||||||
|
Loading…
Reference in New Issue
Block a user