diff --git a/public/app/features/logs/components/panel/LogLineDetails.test.tsx b/public/app/features/logs/components/panel/LogLineDetails.test.tsx index d2938119d0e..0333a5cede3 100644 --- a/public/app/features/logs/components/panel/LogLineDetails.test.tsx +++ b/public/app/features/logs/components/panel/LogLineDetails.test.tsx @@ -67,6 +67,7 @@ const setup = ( onResize: jest.fn(), timeRange: getDefaultTimeRange(), timeZone: 'browser', + showControls: true, ...(propOverrides || {}), }; @@ -581,6 +582,7 @@ describe('LogLineDetails', () => { logs: [logs[0]], timeRange: getDefaultTimeRange(), timeZone: 'browser', + showControls: true, onResize: jest.fn(), }; diff --git a/public/app/features/logs/components/panel/LogLineDetails.tsx b/public/app/features/logs/components/panel/LogLineDetails.tsx index 3a3b1e16f79..83de6d37c39 100644 --- a/public/app/features/logs/components/panel/LogLineDetails.tsx +++ b/public/app/features/logs/components/panel/LogLineDetails.tsx @@ -20,50 +20,53 @@ export interface Props { timeRange: TimeRange; timeZone: string; onResize(): void; + showControls: boolean; } export type LogLineDetailsMode = 'inline' | 'sidebar'; -export const LogLineDetails = memo(({ containerElement, focusLogLine, logs, timeRange, timeZone, onResize }: Props) => { - const { detailsWidth, noInteractions, setDetailsWidth } = useLogListContext(); - const styles = useStyles2(getStyles, 'sidebar'); - const dragStyles = useStyles2(getDragStyles); - const containerRef = useRef(null); +export const LogLineDetails = memo( + ({ containerElement, focusLogLine, logs, timeRange, timeZone, onResize, showControls }: Props) => { + const { detailsWidth, noInteractions, setDetailsWidth } = useLogListContext(); + const styles = useStyles2(getStyles, 'sidebar', showControls); + const dragStyles = useStyles2(getDragStyles); + const containerRef = useRef(null); - const handleResize = useCallback(() => { - if (containerRef.current) { - setDetailsWidth(containerRef.current.clientWidth); - } - onResize(); - }, [onResize, setDetailsWidth]); + const handleResize = useCallback(() => { + if (containerRef.current) { + setDetailsWidth(containerRef.current.clientWidth); + } + onResize(); + }, [onResize, setDetailsWidth]); - const reportResize = useCallback(() => { - if (containerRef.current && !noInteractions) { - reportInteraction('logs_log_line_details_sidebar_resized', { - width: Math.round(containerRef.current.clientWidth), - }); - } - }, [noInteractions]); + const reportResize = useCallback(() => { + if (containerRef.current && !noInteractions) { + reportInteraction('logs_log_line_details_sidebar_resized', { + width: Math.round(containerRef.current.clientWidth), + }); + } + }, [noInteractions]); - const maxWidth = containerElement.clientWidth - LOG_LIST_MIN_WIDTH; + const maxWidth = containerElement.clientWidth - LOG_LIST_MIN_WIDTH; - return ( - -
- -
-
- ); -}); + return ( + +
+ +
+
+ ); + } +); LogLineDetails.displayName = 'LogLineDetails'; const LogLineDetailsTabs = memo( @@ -181,7 +184,7 @@ export const InlineLogLineDetails = memo(({ logs, log, onResize, timeRange, time return (
-
+
@@ -193,19 +196,29 @@ InlineLogLineDetails.displayName = 'InlineLogLineDetails'; export const LOG_LINE_DETAILS_HEIGHT = 35; -const getStyles = (theme: GrafanaTheme2, mode: LogLineDetailsMode) => ({ +const getStyles = (theme: GrafanaTheme2, mode: LogLineDetailsMode, showControls?: boolean) => ({ inlineWrapper: css({ gridColumn: '1 / -1', height: `${LOG_LINE_DETAILS_HEIGHT}vh`, padding: theme.spacing(1, 2, 1.5, 2), marginRight: 1, }), - container: css({ - overflow: 'auto', + inlineContainer: css({ + backgroundColor: theme.colors.background.secondary, + border: `1px solid ${theme.colors.border.weak}`, + borderRadius: theme.shape.radius.default, height: '100%', - boxShadow: theme.shadows.z1, - border: `1px solid ${theme.colors.border.medium}`, - borderRight: mode === 'sidebar' ? 'none' : undefined, + overflow: 'auto', + }), + container: css({ + backgroundColor: theme.colors.background.elevated, + border: `1px solid ${theme.colors.border.weak}`, + borderBottomRightRadius: showControls ? undefined : theme.shape.radius.default, + borderRight: mode === 'sidebar' && showControls ? 'none' : undefined, + borderTopRightRadius: showControls ? undefined : theme.shape.radius.default, + boxShadow: theme.shadows.z3, + height: '100%', + overflow: 'auto', }), scrollContainer: css({ overflow: 'auto', diff --git a/public/app/features/logs/components/panel/LogLineDetailsHeader.tsx b/public/app/features/logs/components/panel/LogLineDetailsHeader.tsx index eab3ac4d6a2..8b22f72d828 100644 --- a/public/app/features/logs/components/panel/LogLineDetailsHeader.tsx +++ b/public/app/features/logs/components/panel/LogLineDetailsHeader.tsx @@ -247,7 +247,7 @@ export const LogLineDetailsHeader = ({ focusLogLine, log, search, onSearch }: Pr />
diff --git a/public/app/features/logs/components/panel/LogList.tsx b/public/app/features/logs/components/panel/LogList.tsx index b98d4a3d86d..0cb9f310efc 100644 --- a/public/app/features/logs/components/panel/LogList.tsx +++ b/public/app/features/logs/components/panel/LogList.tsx @@ -423,6 +423,7 @@ const LogListComponent = ({ timeRange={timeRange} timeZone={timeZone} onResize={handleLogDetailsResize} + showControls={showControls} /> )}