[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:
parent
d166001a88
commit
70d9f45757
|
@ -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,
|
||||
};
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -166,6 +166,8 @@ export const MetricDetail = withTheme(
|
|||
}
|
||||
refetch={refetch}
|
||||
onChangeRangeTime={setRangeTime}
|
||||
isLiveStreaming={isAutoReloading}
|
||||
stopLiveStreaming={stopMetricsAutoReload}
|
||||
/>
|
||||
</EuiPageContentWithRelative>
|
||||
</EuiPageBody>
|
||||
|
|
Loading…
Reference in a new issue