2018-09-28 10:38:50 -05:00
|
|
|
import React, { Component } from 'react';
|
2018-09-28 09:44:07 -05:00
|
|
|
import { hot } from 'react-hot-loader';
|
|
|
|
import { connect } from 'react-redux';
|
2018-05-15 10:07:38 -05:00
|
|
|
|
2018-09-28 09:44:07 -05:00
|
|
|
import { StoreState } from 'app/types';
|
2019-03-22 09:24:30 -05:00
|
|
|
import { ExploreId } from 'app/types/explore';
|
2018-05-15 10:07:38 -05:00
|
|
|
|
2019-09-04 06:59:30 -05:00
|
|
|
import { CustomScrollbar, ErrorBoundaryAlert } from '@grafana/ui';
|
2020-11-19 04:33:52 -06:00
|
|
|
import { resetExploreAction, richHistoryUpdatedAction } from './state/main';
|
2020-03-25 06:25:39 -05:00
|
|
|
import Explore from './Explore';
|
2020-11-19 04:33:52 -06:00
|
|
|
import { getRichHistory } from '../../core/utils/richHistory';
|
2018-09-28 09:44:07 -05:00
|
|
|
|
|
|
|
interface WrapperProps {
|
|
|
|
split: boolean;
|
2019-02-04 00:47:10 -06:00
|
|
|
resetExploreAction: typeof resetExploreAction;
|
2020-11-19 04:33:52 -06:00
|
|
|
richHistoryUpdatedAction: typeof richHistoryUpdatedAction;
|
2018-09-28 09:44:07 -05:00
|
|
|
}
|
|
|
|
|
2019-01-11 11:26:56 -06:00
|
|
|
export class Wrapper extends Component<WrapperProps> {
|
2019-01-28 06:27:56 -06:00
|
|
|
componentWillUnmount() {
|
2019-09-05 07:44:37 -05:00
|
|
|
this.props.resetExploreAction({});
|
2019-01-28 06:27:56 -06:00
|
|
|
}
|
|
|
|
|
2020-11-19 04:33:52 -06:00
|
|
|
componentDidMount() {
|
|
|
|
const richHistory = getRichHistory();
|
|
|
|
this.props.richHistoryUpdatedAction({ richHistory });
|
|
|
|
}
|
|
|
|
|
2018-05-15 10:07:38 -05:00
|
|
|
render() {
|
2019-01-11 11:26:56 -06:00
|
|
|
const { split } = this.props;
|
2018-10-26 11:16:00 -05:00
|
|
|
|
2018-05-15 10:07:38 -05:00
|
|
|
return (
|
2019-01-23 05:00:24 -06:00
|
|
|
<div className="page-scrollbar-wrapper">
|
2019-08-21 03:31:37 -05:00
|
|
|
<CustomScrollbar autoHeightMin={'100%'} autoHeightMax={''} className="custom-scrollbar--page">
|
2020-04-08 10:16:22 -05:00
|
|
|
<div className="explore-wrapper">
|
2019-09-04 06:59:30 -05:00
|
|
|
<ErrorBoundaryAlert style="page">
|
2019-03-22 09:24:30 -05:00
|
|
|
<Explore exploreId={ExploreId.left} />
|
2019-09-04 06:59:30 -05:00
|
|
|
</ErrorBoundaryAlert>
|
2019-01-23 05:00:24 -06:00
|
|
|
{split && (
|
2019-09-04 06:59:30 -05:00
|
|
|
<ErrorBoundaryAlert style="page">
|
2019-03-22 09:24:30 -05:00
|
|
|
<Explore exploreId={ExploreId.right} />
|
2019-09-04 06:59:30 -05:00
|
|
|
</ErrorBoundaryAlert>
|
2019-01-23 05:00:24 -06:00
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
</CustomScrollbar>
|
2018-05-15 10:07:38 -05:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2018-09-28 09:44:07 -05:00
|
|
|
|
2019-01-11 11:26:56 -06:00
|
|
|
const mapStateToProps = (state: StoreState) => {
|
|
|
|
const { split } = state.explore;
|
2019-03-22 09:24:30 -05:00
|
|
|
return { split };
|
2019-01-11 11:26:56 -06:00
|
|
|
};
|
2018-09-28 09:44:07 -05:00
|
|
|
|
|
|
|
const mapDispatchToProps = {
|
2019-02-04 00:47:10 -06:00
|
|
|
resetExploreAction,
|
2020-11-19 04:33:52 -06:00
|
|
|
richHistoryUpdatedAction,
|
2018-09-28 09:44:07 -05:00
|
|
|
};
|
|
|
|
|
2019-11-19 07:59:39 -06:00
|
|
|
export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(Wrapper));
|