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
|
|
|
|
2018-10-01 12:56:26 +02:00
|
|
|
import Explore from './Explore';
|
2019-09-04 13:59:30 +02:00
|
|
|
import { CustomScrollbar, ErrorBoundaryAlert } from '@grafana/ui';
|
2019-03-22 15:24:30 +01:00
|
|
|
import { resetExploreAction } from './state/actionTypes';
|
2018-09-28 16:44:07 +02:00
|
|
|
|
|
|
|
|
interface WrapperProps {
|
|
|
|
|
split: boolean;
|
2019-02-04 07:47:10 +01:00
|
|
|
resetExploreAction: typeof resetExploreAction;
|
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-02-04 07:47:10 +01:00
|
|
|
this.props.resetExploreAction();
|
2019-01-28 13:27:56 +01:00
|
|
|
}
|
|
|
|
|
|
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">
|
2019-01-23 12:00:24 +01: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,
|
2018-09-28 16:44:07 +02:00
|
|
|
};
|
|
|
|
|
|
2019-02-19 15:41:35 +01:00
|
|
|
export default hot(module)(
|
|
|
|
|
connect(
|
|
|
|
|
mapStateToProps,
|
|
|
|
|
mapDispatchToProps
|
|
|
|
|
)(Wrapper)
|
|
|
|
|
);
|