mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Schema: Add TimeZone to mudball (#61003)
This commit is contained in:
parent
245a589336
commit
da3f02d81b
@ -1,3 +1,10 @@
|
||||
import {
|
||||
TimeZone as SchemaTimeZone,
|
||||
TimeZoneBrowser as SchemaTimeZoneBrowser,
|
||||
TimeZoneUtc as SchemaTimeZoneUtc,
|
||||
defaultTimeZone,
|
||||
} from '@grafana/schema';
|
||||
|
||||
import { dateTime, DateTime } from '../datetime/moment_wrapper';
|
||||
|
||||
export interface RawTimeRange {
|
||||
@ -30,18 +37,24 @@ export interface IntervalValues {
|
||||
intervalMs: number;
|
||||
}
|
||||
|
||||
export type TimeZoneUtc = 'utc';
|
||||
export type TimeZoneBrowser = 'browser';
|
||||
export type TimeZone = TimeZoneBrowser | TimeZoneUtc | string;
|
||||
|
||||
export const DefaultTimeZone: TimeZone = 'browser';
|
||||
|
||||
export interface TimeOption {
|
||||
from: string;
|
||||
to: string;
|
||||
display: string;
|
||||
}
|
||||
|
||||
/** @deprecated use TimeZone from schema */
|
||||
export type TimeZone = SchemaTimeZone;
|
||||
|
||||
/** @deprecated use TimeZoneBrowser from schema */
|
||||
export type TimeZoneBrowser = SchemaTimeZoneBrowser;
|
||||
|
||||
/** @deprecated use TimeZoneUtc from schema */
|
||||
export type TimeZoneUtc = SchemaTimeZoneUtc;
|
||||
|
||||
/** @deprecated use defaultTimeZone from schema */
|
||||
export const DefaultTimeZone = defaultTimeZone;
|
||||
|
||||
export interface TimeOptions {
|
||||
[key: string]: TimeOption[];
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ OptionsWithLegend: {
|
||||
|
||||
// TODO docs
|
||||
OptionsWithTimezones: {
|
||||
timezone?: [...string]
|
||||
timezone?: [...TimeZone]
|
||||
} @cuetsy(kind="interface")
|
||||
|
||||
// TODO docs
|
||||
@ -300,3 +300,13 @@ VizTooltipOptions: {
|
||||
mode: TooltipDisplayMode
|
||||
sort: SortOrder
|
||||
} @cuetsy(kind="interface")
|
||||
|
||||
|
||||
// Use UTC/GMT timezone
|
||||
TimeZoneUtc: "utc" @cuetsy(kind="type")
|
||||
|
||||
// Use the timezone defined by end user web browser
|
||||
TimeZoneBrowser: "browser" @cuetsy(kind="type")
|
||||
|
||||
// A specific timezone from https://en.wikipedia.org/wiki/Tz_database
|
||||
TimeZone: TimeZoneUtc | TimeZoneBrowser | string | *"browser" @cuetsy(kind="type")
|
||||
|
@ -331,7 +331,7 @@ export interface OptionsWithLegend {
|
||||
* TODO docs
|
||||
*/
|
||||
export interface OptionsWithTimezones {
|
||||
timezone?: Array<string>;
|
||||
timezone?: Array<TimeZone>;
|
||||
}
|
||||
|
||||
export const defaultOptionsWithTimezones: Partial<OptionsWithTimezones> = {
|
||||
@ -547,3 +547,20 @@ export interface VizTooltipOptions {
|
||||
mode: TooltipDisplayMode;
|
||||
sort: SortOrder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use UTC/GMT timezone
|
||||
*/
|
||||
export type TimeZoneUtc = 'utc';
|
||||
|
||||
/**
|
||||
* Use the timezone defined by end user web browser
|
||||
*/
|
||||
export type TimeZoneBrowser = 'browser';
|
||||
|
||||
/**
|
||||
* A specific timezone from https://en.wikipedia.org/wiki/Tz_database
|
||||
*/
|
||||
export type TimeZone = (TimeZoneUtc | TimeZoneBrowser | string);
|
||||
|
||||
export const defaultTimeZone: TimeZone = 'browser';
|
||||
|
Loading…
Reference in New Issue
Block a user