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