mirror of
https://github.com/grafana/grafana.git
synced 2025-02-13 00:55:47 -06:00
* Change default prometheus to latest and prometheus v1 to prometheus1 * Update README * Remove prometheus1 block as not used * Explore: Separatae scrolling in split view * Update snapshot
55 lines
1.8 KiB
TypeScript
55 lines
1.8 KiB
TypeScript
import React, { Component } from 'react';
|
|
import { connect } from 'react-redux';
|
|
import { ExploreId, ExploreQueryParams } from 'app/types/explore';
|
|
import { 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<WrapperProps> {
|
|
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 (
|
|
<div className="page-scrollbar-wrapper">
|
|
<div className="explore-wrapper">
|
|
<ErrorBoundaryAlert style="page">
|
|
<ExplorePaneContainer split={hasSplit} exploreId={ExploreId.left} urlQuery={left} />
|
|
</ErrorBoundaryAlert>
|
|
{hasSplit && (
|
|
<ErrorBoundaryAlert style="page">
|
|
<ExplorePaneContainer split={hasSplit} exploreId={ExploreId.right} urlQuery={right} />
|
|
</ErrorBoundaryAlert>
|
|
)}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
const mapDispatchToProps = {
|
|
resetExploreAction,
|
|
richHistoryUpdatedAction,
|
|
};
|
|
|
|
export default connect(null, mapDispatchToProps)(Wrapper);
|