import React, { Component } from 'react'; import { connect } from 'react-redux'; import { ExploreId, ExploreQueryParams } from 'app/types/explore'; import { CustomScrollbar, ErrorBoundaryAlert } from '@grafana/ui'; import { lastSavedUrl, resetExploreAction, richHistoryUpdatedAction } from './state/main'; import { getRichHistory } from '../../core/utils/richHistory'; import { ExplorePaneContainer } from './ExplorePaneContainer'; import { GrafanaRouteComponentProps } from 'app/core/navigation/types'; interface WrapperProps extends GrafanaRouteComponentProps<{}, ExploreQueryParams> { resetExploreAction: typeof resetExploreAction; richHistoryUpdatedAction: typeof richHistoryUpdatedAction; } export class Wrapper extends Component { componentWillUnmount() { this.props.resetExploreAction({}); } componentDidMount() { lastSavedUrl.left = undefined; lastSavedUrl.right = undefined; const richHistory = getRichHistory(); this.props.richHistoryUpdatedAction({ richHistory }); } render() { const { left, right } = this.props.queryParams; const hasSplit = Boolean(left) && Boolean(right); return (
{hasSplit && ( )}
); } } const mapDispatchToProps = { resetExploreAction, richHistoryUpdatedAction, }; export default connect(null, mapDispatchToProps)(Wrapper);