Explore: Support user timezone (#16469)

Explore now uses the timezone of the user to decide if local browser 
time or UTC should be used. 
- Now uses TimeRange instead of RawTimeRange in explore item
state tree and only parsing actual time in a few action
handlers.
- Time picker should now properly handle moving back/forward and
apply time range when both utc and non utc time zone.
- URL range representation is changed from YYYY-MM-DD HH:mm:ss
to epoch ms.
- Now uses AbsoluteTimeRange in graph component instead of moment.
- Makes a copy of the time range passed to timeSrv to make sure immutability
of explore time range when for example elasticsearch test datasources uses
timeSrv and sets a time range of last 1 min.
- Various refactorings and cleanup.

Closes #12812
This commit is contained in:
Marcus Efraimsson
2019-04-29 18:28:41 +02:00
committed by GitHub
parent 7dbe719fda
commit 02cb7ff436
21 changed files with 560 additions and 256 deletions

View File

@@ -11,11 +11,30 @@ export interface TimeRange {
raw: RawTimeRange;
}
export interface AbsoluteTimeRange {
from: number;
to: number;
}
export interface IntervalValues {
interval: string; // 10s,5m
intervalMs: number;
}
export interface TimeZone {
raw: string;
isUtc: boolean;
}
export const parseTimeZone = (raw: string): TimeZone => {
return {
raw,
isUtc: raw === 'utc',
};
};
export const DefaultTimeZone = parseTimeZone('browser');
export interface TimeOption {
from: string;
to: string;