[Infra UI] Let drag-selecting a timerange disable autorefresh (#29947)

* Let drag-selecting a timerange disable autorefresh

* Send action to stop livestreaming at better time.
This commit is contained in:
Sonja Krause-Harder 2019-02-05 08:03:50 +01:00 committed by GitHub
parent d166001a88
commit 70d9f45757
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 2 deletions

View file

@ -23,6 +23,8 @@ interface Props {
nodeId: string;
label: string;
onChangeRangeTime?: (time: metricTimeActions.MetricRangeTimeState) => void;
isLiveStreaming?: boolean;
stopLiveStreaming?: () => void;
intl: InjectedIntl;
}
@ -103,9 +105,11 @@ export const Metrics = injectI18n(
private renderSection = (layout: InfraMetricLayout) => (section: InfraMetricLayoutSection) => {
let sectionProps = {};
if (section.type === 'chart') {
const { onChangeRangeTime } = this.props;
const { onChangeRangeTime, isLiveStreaming, stopLiveStreaming } = this.props;
sectionProps = {
onChangeRangeTime,
isLiveStreaming,
stopLiveStreaming,
crosshairValue: this.state.crosshairValue,
onCrosshairUpdate: this.onCrosshairUpdate,
};

View file

@ -16,6 +16,8 @@ interface Props {
onChangeRangeTime?: (time: metricTimeActions.MetricRangeTimeState) => void;
crosshairValue?: number;
onCrosshairUpdate?: (crosshairValue: number) => void;
isLiveStreaming?: boolean;
stopLiveStreaming?: () => void;
}
export class Section extends React.PureComponent<Props> {
@ -30,6 +32,8 @@ export class Section extends React.PureComponent<Props> {
onChangeRangeTime: this.props.onChangeRangeTime,
crosshairValue: this.props.crosshairValue,
onCrosshairUpdate: this.props.onCrosshairUpdate,
isLiveStreaming: this.props.isLiveStreaming,
stopLiveStreaming: this.props.stopLiveStreaming,
};
}
const Component = sections[this.props.section.type];

View file

@ -43,6 +43,8 @@ interface Props {
onChangeRangeTime?: (time: metricTimeActions.MetricRangeTimeState) => void;
crosshairValue?: number;
onCrosshairUpdate?: (crosshairValue: number) => void;
isLiveStreaming?: boolean;
stopLiveStreaming?: () => void;
intl: InjectedIntl;
}
@ -214,9 +216,12 @@ export const ChartSection = injectI18n(
}
private handleSelectionBrushEnd = (area: Area) => {
const { onChangeRangeTime } = this.props;
const { onChangeRangeTime, isLiveStreaming, stopLiveStreaming } = this.props;
const { startX, endX } = area.domainArea;
if (onChangeRangeTime) {
if (isLiveStreaming && stopLiveStreaming) {
stopLiveStreaming();
}
onChangeRangeTime({
to: endX.valueOf(),
from: startX.valueOf(),

View file

@ -166,6 +166,8 @@ export const MetricDetail = withTheme(
}
refetch={refetch}
onChangeRangeTime={setRangeTime}
isLiveStreaming={isAutoReloading}
stopLiveStreaming={stopMetricsAutoReload}
/>
</EuiPageContentWithRelative>
</EuiPageBody>