From 2cf4f641f2dfb3e4b3c1f7dd96ddb77abd20ebbb Mon Sep 17 00:00:00 2001 From: Haris Rozajac <58232930+harisrozajac@users.noreply.github.com> Date: Wed, 30 Aug 2023 12:20:43 +0200 Subject: [PATCH] Explore: Unified Logs Volume and Logs panels (#73825) Wrap Logs Volume and Logs panels with PanelChrome instead of Collapse --- public/app/features/explore/Logs/Logs.tsx | 230 +++++++++++----------- 1 file changed, 117 insertions(+), 113 deletions(-) diff --git a/public/app/features/explore/Logs/Logs.tsx b/public/app/features/explore/Logs/Logs.tsx index 9dc24957a81..7c31c85270f 100644 --- a/public/app/features/explore/Logs/Logs.tsx +++ b/public/app/features/explore/Logs/Logs.tsx @@ -41,7 +41,7 @@ import { InlineSwitch, withTheme2, Themeable2, - Collapse, + PanelChrome, } from '@grafana/ui'; import store from 'app/core/store'; import { createAndCopyShortLink } from 'app/core/utils/shortLinks'; @@ -121,16 +121,6 @@ interface State { } const scrollableLogsContainer = config.featureToggles.exploreScrollableLogsContainer; -// We need to override css overflow of divs in Collapse element to enable sticky Logs navigation -const styleOverridesForStickyNavigation = css` - ${scrollableLogsContainer && 'margin-bottom: 0px'}; - & > div { - overflow: visible; - & > div { - overflow: visible; - } - } -`; // we need to define the order of these explicitly const DEDUP_OPTIONS = [ @@ -292,11 +282,11 @@ class UnthemedLogs extends PureComponent { this.setState({ hiddenLogLevels }); }; - onToggleLogsVolumeCollapse = (isOpen: boolean) => { - this.props.onSetLogsVolumeEnabled(isOpen); + onToggleLogsVolumeCollapse = (collapsed: boolean) => { + this.props.onSetLogsVolumeEnabled(!collapsed); reportInteraction('grafana_explore_logs_histogram_toggle_clicked', { datasourceType: this.props.datasourceType, - type: isOpen ? 'open' : 'close', + type: !collapsed ? 'open' : 'close', }); }; @@ -540,7 +530,12 @@ class UnthemedLogs extends PureComponent { timeZone={timeZone} /> )} - + {logsVolumeEnabled && ( { onLoadLogsVolume={loadLogsVolumeData} onHiddenSeriesChanged={this.onToggleLogLevel} eventBus={this.logsVolumeEventBus} - onClose={() => this.onToggleLogsVolumeCollapse(false)} + onClose={() => this.onToggleLogsVolumeCollapse(true)} /> )} - - + {config.featureToggles.logsExploreTableVisualisation && (
- {this.state.visualisationType === 'logs' ? 'Logs' : 'Table'} { />
)} - {!config.featureToggles.logsExploreTableVisualisation && 'Logs'} } - loading={loading} - isOpen - className={styleOverridesForStickyNavigation} + loadingState={loading ? LoadingState.Loading : LoadingState.Done} > - {this.state.visualisationType !== 'table' && ( -
- - - - - - - - - - - - - - - ({ - label: capitalize(dedupType), - value: dedupType, - description: LogsDedupDescription[dedupType], - }))} - value={dedupStrategy} - onChange={this.onChangeDedup} - className={styles.radioButtons} - /> - - - -
- - - +
+ {this.state.visualisationType !== 'table' && ( +
+ + + + + + + + + + + + + + + ({ + label: capitalize(dedupType), + value: dedupType, + description: LogsDedupDescription[dedupType], + }))} + value={dedupStrategy} + onChange={this.onChangeDedup} + className={styles.radioButtons} + /> + + + +
+ + + +
-
- )} -
- + )} +
+ +
{this.state.visualisationType === 'table' && hasData && (
@@ -757,7 +757,7 @@ class UnthemedLogs extends PureComponent { clearCache={clearCache} />
- + ); } @@ -816,5 +816,9 @@ const getStyles = (theme: GrafanaTheme2, wrapLogMessage: boolean) => { visualisationTypeRadio: css` margin: 0 0 0 ${theme.spacing(1)}; `, + stickyNavigation: css` + ${scrollableLogsContainer && 'margin-bottom: 0px'} + overflow: visible; + `, }; };