mirror of
https://github.com/grafana/grafana.git
synced 2025-02-12 16:45:43 -06:00
* Inline datasource actions into initialisation * Fix datasource change * Fix rich history * Fix test * Move rich history init to Wrapper * Remove console log * TS fixes Co-authored-by: Zoltán Bedi <zoltan.bedi@gmail.com>
62 lines
1.7 KiB
TypeScript
62 lines
1.7 KiB
TypeScript
import React, { Component } from 'react';
|
|
import { hot } from 'react-hot-loader';
|
|
import { connect } from 'react-redux';
|
|
|
|
import { StoreState } from 'app/types';
|
|
import { ExploreId } from 'app/types/explore';
|
|
|
|
import { CustomScrollbar, ErrorBoundaryAlert } from '@grafana/ui';
|
|
import { resetExploreAction, richHistoryUpdatedAction } from './state/main';
|
|
import Explore from './Explore';
|
|
import { getRichHistory } from '../../core/utils/richHistory';
|
|
|
|
interface WrapperProps {
|
|
split: boolean;
|
|
resetExploreAction: typeof resetExploreAction;
|
|
richHistoryUpdatedAction: typeof richHistoryUpdatedAction;
|
|
}
|
|
|
|
export class Wrapper extends Component<WrapperProps> {
|
|
componentWillUnmount() {
|
|
this.props.resetExploreAction({});
|
|
}
|
|
|
|
componentDidMount() {
|
|
const richHistory = getRichHistory();
|
|
this.props.richHistoryUpdatedAction({ richHistory });
|
|
}
|
|
|
|
render() {
|
|
const { split } = this.props;
|
|
|
|
return (
|
|
<div className="page-scrollbar-wrapper">
|
|
<CustomScrollbar autoHeightMin={'100%'} autoHeightMax={''} className="custom-scrollbar--page">
|
|
<div className="explore-wrapper">
|
|
<ErrorBoundaryAlert style="page">
|
|
<Explore exploreId={ExploreId.left} />
|
|
</ErrorBoundaryAlert>
|
|
{split && (
|
|
<ErrorBoundaryAlert style="page">
|
|
<Explore exploreId={ExploreId.right} />
|
|
</ErrorBoundaryAlert>
|
|
)}
|
|
</div>
|
|
</CustomScrollbar>
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
const mapStateToProps = (state: StoreState) => {
|
|
const { split } = state.explore;
|
|
return { split };
|
|
};
|
|
|
|
const mapDispatchToProps = {
|
|
resetExploreAction,
|
|
richHistoryUpdatedAction,
|
|
};
|
|
|
|
export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(Wrapper));
|