From 8ae6cf6b99e46c85647bfdbda0e1c3cc280851f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Fern=C3=A1ndez?= Date: Tue, 6 Sep 2022 12:11:00 +0200 Subject: [PATCH] Navigation: add breadcrumbs in Explore page (#54547) --- public/app/features/explore/Wrapper.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/public/app/features/explore/Wrapper.tsx b/public/app/features/explore/Wrapper.tsx index c824a3a558c..e787021d6e7 100644 --- a/public/app/features/explore/Wrapper.tsx +++ b/public/app/features/explore/Wrapper.tsx @@ -4,6 +4,7 @@ import { connect, ConnectedProps } from 'react-redux'; import { locationService } from '@grafana/runtime'; import { ErrorBoundaryAlert } from '@grafana/ui'; +import { GrafanaContext } from 'app/core/context/GrafanaContext'; import { GrafanaRouteComponentProps } from 'app/core/navigation/types'; import { StoreState } from 'app/types'; import { ExploreId, ExploreQueryParams } from 'app/types/explore'; @@ -46,11 +47,17 @@ const connector = connect(mapStateToProps, mapDispatchToProps); type Props = OwnProps & RouteProps & ConnectedProps; class WrapperUnconnected extends PureComponent { + static contextType = GrafanaContext; + componentWillUnmount() { this.props.resetExploreAction({}); } componentDidMount() { + //This is needed for breadcrumbs and topnav. + //We should probably abstract this out at some point + this.context.chrome.update({ sectionNav: this.props.navModel.node }); + lastSavedUrl.left = undefined; lastSavedUrl.right = undefined; @@ -69,7 +76,7 @@ class WrapperUnconnected extends PureComponent { } } - componentDidUpdate(prevProps: Props) { + componentDidUpdate() { const { left, right } = this.props.queryParams; const hasSplit = Boolean(left) && Boolean(right); const datasourceTitle = hasSplit