mirror of
https://github.com/grafana/grafana.git
synced 2024-11-22 08:56:43 -06:00
GeneralSettings: Enable support for nowDelay (#79703)
This commit is contained in:
parent
d3ff4715a0
commit
eb64209301
@ -195,11 +195,12 @@ Sensitive information stripped: queries (metric, template,annotation) and panel
|
||||
Time picker configuration
|
||||
It defines the default config for the time picker and the refresh picker for the specific dashboard.
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|---------------------|----------|----------|---------------------------------------|---------------------------------------------------------------------------------------------------|
|
||||
| `hidden` | boolean | **Yes** | `false` | Whether timepicker is visible or not. |
|
||||
| `refresh_intervals` | string[] | **Yes** | `[5s 10s 30s 1m 5m 15m 30m 1h 2h 1d]` | Interval options available in the refresh picker dropdown. |
|
||||
| `time_options` | string[] | **Yes** | `[5m 15m 1h 6h 12h 24h 2d 7d 30d]` | Selectable options available in the time picker dropdown. Has no effect on provisioned dashboard. |
|
||||
| Property | Type | Required | Default | Description |
|
||||
|---------------------|----------|----------|---------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `hidden` | boolean | **Yes** | `false` | Whether timepicker is visible or not. |
|
||||
| `refresh_intervals` | string[] | **Yes** | `[5s 10s 30s 1m 5m 15m 30m 1h 2h 1d]` | Interval options available in the refresh picker dropdown. |
|
||||
| `time_options` | string[] | **Yes** | `[5m 15m 1h 6h 12h 24h 2d 7d 30d]` | Selectable options available in the time picker dropdown. Has no effect on provisioned dashboard. |
|
||||
| `nowDelay` | string | No | | Override the now time by entering a time delay. Use this option to accommodate known delays in data aggregation to avoid null values. |
|
||||
|
||||
### Panels
|
||||
|
||||
|
@ -454,6 +454,8 @@ lineage: schemas: [{
|
||||
refresh_intervals: [...string] | *["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
|
||||
// Selectable options available in the time picker dropdown. Has no effect on provisioned dashboard.
|
||||
time_options: [...string] | *["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
|
||||
// Override the now time by entering a time delay. Use this option to accommodate known delays in data aggregation to avoid null values.
|
||||
nowDelay?: string
|
||||
} @cuetsy(kind="interface") @grafana(TSVeneer="type")
|
||||
|
||||
// 0 for no shared crosshair or tooltip (default).
|
||||
|
@ -638,6 +638,10 @@ export interface TimePickerConfig {
|
||||
* Whether timepicker is visible or not.
|
||||
*/
|
||||
hidden: boolean;
|
||||
/**
|
||||
* Override the now time by entering a time delay. Use this option to accommodate known delays in data aggregation to avoid null values.
|
||||
*/
|
||||
nowDelay?: string;
|
||||
/**
|
||||
* Interval options available in the refresh picker dropdown.
|
||||
*/
|
||||
|
@ -858,6 +858,9 @@ type TimePickerConfig struct {
|
||||
// Whether timepicker is visible or not.
|
||||
Hidden bool `json:"hidden"`
|
||||
|
||||
// Override the now time by entering a time delay. Use this option to accommodate known delays in data aggregation to avoid null values.
|
||||
NowDelay *string `json:"nowDelay,omitempty"`
|
||||
|
||||
// Interval options available in the refresh picker dropdown.
|
||||
RefreshIntervals []string `json:"refresh_intervals"`
|
||||
|
||||
|
@ -251,6 +251,7 @@ export function createDashboardSceneFromDashboardModel(oldModel: DashboardModel)
|
||||
fiscalYearStartMonth: oldModel.fiscalYearStartMonth,
|
||||
timeZone: oldModel.timezone,
|
||||
weekStart: oldModel.weekStart,
|
||||
UNSAFE_nowDelay: oldModel.timepicker?.nowDelay,
|
||||
}),
|
||||
$variables: variables,
|
||||
$behaviors: [
|
||||
|
@ -127,6 +127,7 @@ export function transformSceneToSaveModel(scene: DashboardScene, isSnapshot = fa
|
||||
...defaultTimePickerConfig,
|
||||
refresh_intervals,
|
||||
hidden: hideTimePicker,
|
||||
nowDelay: timeRange.UNSAFE_nowDelay,
|
||||
},
|
||||
panels,
|
||||
annotations: {
|
||||
|
@ -125,7 +125,11 @@ export class GeneralSettingsEditView
|
||||
};
|
||||
|
||||
public onNowDelayChange = (value: string) => {
|
||||
// TODO: Figure out how to store nowDelay in Dashboard Scene
|
||||
const timeRange = this.getTimeRange();
|
||||
|
||||
timeRange?.setState({
|
||||
UNSAFE_nowDelay: value,
|
||||
});
|
||||
};
|
||||
|
||||
public onHideTimePickerChange = (value: boolean) => {
|
||||
@ -146,7 +150,7 @@ export class GeneralSettingsEditView
|
||||
const { navModel, pageNav } = useDashboardEditPageNav(model.getDashboard(), model.getUrlKey());
|
||||
const { title, description, tags, meta, editable, overlay } = model.getDashboard().useState();
|
||||
const { sync: graphTooltip } = model.getCursorSync()?.useState() || {};
|
||||
const { timeZone, weekStart } = model.getTimeRange().useState();
|
||||
const { timeZone, weekStart, UNSAFE_nowDelay: nowDelay } = model.getTimeRange().useState();
|
||||
const { intervals } = model.getRefreshPicker()?.useState() || {};
|
||||
const { hideTimeControls } = model.getDashboardControls()?.useState() || {};
|
||||
|
||||
@ -230,8 +234,7 @@ export class GeneralSettingsEditView
|
||||
onLiveNowChange={model.onLiveNowChange}
|
||||
refreshIntervals={intervals}
|
||||
timePickerHidden={hideTimeControls}
|
||||
// TODO: Implement this in dashboard scene
|
||||
// nowDelay={timepicker.nowDelay || ''}
|
||||
nowDelay={nowDelay || ''}
|
||||
// TODO: Implement this in dashboard scene
|
||||
// liveNow={liveNow}
|
||||
liveNow={false}
|
||||
|
Loading…
Reference in New Issue
Block a user