From 83f62c191263dfb52eabb65fe7e7aa3027d8bbc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 18 Jun 2021 14:21:54 +0200 Subject: [PATCH] Explore: Remove nested auto sizer and pass width from main Explore component (#35919) --- public/app/features/explore/Explore.tsx | 15 +++-- .../features/explore/ExploreGraphNGPanel.tsx | 66 ++++++++----------- public/app/features/explore/Logs.tsx | 3 + public/app/features/explore/LogsContainer.tsx | 3 + 4 files changed, 44 insertions(+), 43 deletions(-) diff --git a/public/app/features/explore/Explore.tsx b/public/app/features/explore/Explore.tsx index d4ffa064a5d..c735432d51e 100644 --- a/public/app/features/explore/Explore.tsx +++ b/public/app/features/explore/Explore.tsx @@ -229,13 +229,14 @@ export class Explore extends React.PureComponent { ); } - renderGraphPanel() { - const { graphResult, absoluteRange, timeZone, splitOpen, queryResponse, loading } = this.props; + renderGraphPanel(width: number) { + const { graphResult, absoluteRange, timeZone, splitOpen, queryResponse, loading, theme } = this.props; return ( { ); } - renderLogsPanel() { - const { exploreId, syncedTimes } = this.props; + renderLogsPanel(width: number) { + const { exploreId, syncedTimes, theme } = this.props; + return ( { {showPanels && ( <> {showMetrics && graphResult && ( - {this.renderGraphPanel()} + {this.renderGraphPanel(width)} )} {showTable && {this.renderTablePanel(width)}} - {showLogs && {this.renderLogsPanel()}} + {showLogs && {this.renderLogsPanel(width)}} {showNodeGraph && {this.renderNodeGraphPanel()}} {showTrace && {this.renderTraceViewPanel()}} diff --git a/public/app/features/explore/ExploreGraphNGPanel.tsx b/public/app/features/explore/ExploreGraphNGPanel.tsx index 4350f629fb6..b5397e7923c 100644 --- a/public/app/features/explore/ExploreGraphNGPanel.tsx +++ b/public/app/features/explore/ExploreGraphNGPanel.tsx @@ -35,7 +35,6 @@ import React, { useEffect, useMemo, useRef, useState } from 'react'; import { splitOpen } from './state/main'; import { getFieldLinksForExplore } from './utils/links'; import { usePrevious } from 'react-use'; -import AutoSizer from 'react-virtualized-auto-sizer'; import appEvents from 'app/core/app_events'; import { seriesVisibilityConfigFactory } from '../dashboard/dashgrid/SeriesVisibilityConfigFactory'; import { identity } from 'lodash'; @@ -45,6 +44,7 @@ const MAX_NUMBER_OF_TIME_SERIES = 20; interface Props { data: DataFrame[]; height: number; + width: number; annotations?: DataFrame[]; absoluteRange: AbsoluteTimeRange; timeZone: TimeZone; @@ -57,6 +57,7 @@ interface Props { export function ExploreGraphNGPanel({ data, height, + width, timeZone, absoluteRange, onUpdateTimeRange, @@ -156,42 +157,33 @@ export function ExploreGraphNGPanel({ >{`Show all ${dataWithConfig.length}`} )} - - {({ width }) => ( - - {(config, alignedDataFrame) => { - return ( - <> - - - - {annotations && ( - - )} - - ); - }} - - )} - + + {(config, alignedDataFrame) => { + return ( + <> + + + + {annotations && ( + + )} + + ); + }} + ); } diff --git a/public/app/features/explore/Logs.tsx b/public/app/features/explore/Logs.tsx index 0e254fe65c8..f766a8c0c24 100644 --- a/public/app/features/explore/Logs.tsx +++ b/public/app/features/explore/Logs.tsx @@ -45,6 +45,7 @@ const SETTINGS_KEYS = { }; interface Props { + width: number; logRows: LogRowModel[]; logsMeta?: LogsMetaItem[]; logsSeries?: DataFrame[]; @@ -233,6 +234,7 @@ export class UnthemedLogs extends PureComponent { render() { const { + width, logRows, logsMeta, logsSeries, @@ -284,6 +286,7 @@ export class UnthemedLogs extends PureComponent { { visibleRange, scanning, range, + width, isLive, exploreId, addResultsToCache, @@ -119,6 +121,7 @@ export class LogsContainer extends PureComponent { logsMeta={logsMeta} logsSeries={logsSeries} logsQueries={logsQueries} + width={width} highlighterExpressions={logsHighlighterExpressions} loading={loading} onChangeTime={this.onChangeTime}