mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Dashboard: keep live timeseries moving left (v2) (#37769)
This commit is contained in:
@@ -53,6 +53,11 @@ export function GeneralSettingsUnconnected({ dashboard, updateTimeZone }: Props)
|
||||
setRenderCounter(renderCounter + 1);
|
||||
};
|
||||
|
||||
const onLiveNowChange = (v: boolean) => {
|
||||
dashboard.liveNow = v;
|
||||
setRenderCounter(renderCounter + 1);
|
||||
};
|
||||
|
||||
const onTimeZoneChange = (timeZone: TimeZone) => {
|
||||
dashboard.timezone = timeZone;
|
||||
setRenderCounter(renderCounter + 1);
|
||||
@@ -113,10 +118,12 @@ export function GeneralSettingsUnconnected({ dashboard, updateTimeZone }: Props)
|
||||
onRefreshIntervalChange={onRefreshIntervalChange}
|
||||
onNowDelayChange={onNowDelayChange}
|
||||
onHideTimePickerChange={onHideTimePickerChange}
|
||||
onLiveNowChange={onLiveNowChange}
|
||||
refreshIntervals={dashboard.timepicker.refresh_intervals}
|
||||
timePickerHidden={dashboard.timepicker.hidden}
|
||||
nowDelay={dashboard.timepicker.nowDelay}
|
||||
timezone={dashboard.timezone}
|
||||
liveNow={dashboard.liveNow}
|
||||
/>
|
||||
|
||||
<CollapsableSection label="Panel options" isOpen={true}>
|
||||
|
||||
@@ -10,10 +10,12 @@ interface Props {
|
||||
onRefreshIntervalChange: (interval: string[]) => void;
|
||||
onNowDelayChange: (nowDelay: string) => void;
|
||||
onHideTimePickerChange: (hide: boolean) => void;
|
||||
onLiveNowChange: (liveNow: boolean) => void;
|
||||
refreshIntervals: string[];
|
||||
timePickerHidden: boolean;
|
||||
nowDelay: string;
|
||||
timezone: TimeZone;
|
||||
liveNow: boolean;
|
||||
}
|
||||
|
||||
interface State {
|
||||
@@ -43,6 +45,10 @@ export class TimePickerSettings extends PureComponent<Props, State> {
|
||||
this.props.onHideTimePickerChange(!this.props.timePickerHidden);
|
||||
};
|
||||
|
||||
onLiveNowChange = () => {
|
||||
this.props.onLiveNowChange(!this.props.liveNow);
|
||||
};
|
||||
|
||||
onTimeZoneChange = (timeZone?: string) => {
|
||||
if (typeof timeZone !== 'string') {
|
||||
return;
|
||||
@@ -79,6 +85,12 @@ export class TimePickerSettings extends PureComponent<Props, State> {
|
||||
<Field label="Hide time picker">
|
||||
<Switch value={!!this.props.timePickerHidden} onChange={this.onHideTimePickerChange} />
|
||||
</Field>
|
||||
<Field
|
||||
label="Refresh live dashboards"
|
||||
description="Continuously re-draw panels where the time range references 'now'"
|
||||
>
|
||||
<Switch value={!!this.props.liveNow} onChange={this.onLiveNowChange} />
|
||||
</Field>
|
||||
</CollapsableSection>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user