Commit 66a4d1a5 by Ryan McKinley Committed by GitHub

Refactor: fix range util imports (#17988)

parent ccc3d88c
import { TimeRange, TIME_FORMAT, RawTimeRange, TimeZone } from '@grafana/data';
import { describeTimeRange } from '@grafana/data/src/utils/rangeutil';
import { dateMath } from '@grafana/data';
import { isDateTime, dateTime, DateTime, toUtc } from '@grafana/data';
import {
TimeRange,
TIME_FORMAT,
RawTimeRange,
TimeZone,
rangeUtil,
dateMath,
isDateTime,
dateTime,
DateTime,
toUtc,
} from '@grafana/data';
export const rawToTimeRange = (raw: RawTimeRange, timeZone?: TimeZone): TimeRange => {
const from = stringToDateTimeType(raw.from, false, timeZone);
......@@ -32,7 +40,7 @@ export const stringToDateTimeType = (value: string | DateTime, roundUp?: boolean
};
export const mapTimeRangeToRangeString = (timeRange: RawTimeRange): string => {
return describeTimeRange(timeRange);
return rangeUtil.describeTimeRange(timeRange);
};
export const isValidTimeString = (text: string) => dateMath.isValid(text);
......@@ -2,12 +2,19 @@
import React, { PureComponent, ChangeEvent, FocusEvent } from 'react';
// Utils
import { isValidTimeSpan } from '@grafana/data/src/utils/rangeutil';
import { rangeUtil } from '@grafana/data';
// Components
import { DataSourceSelectItem, EventsWithValidation, Input, InputStatus, Switch, ValidationEvents } from '@grafana/ui';
import {
DataSourceSelectItem,
EventsWithValidation,
Input,
InputStatus,
Switch,
ValidationEvents,
FormLabel,
} from '@grafana/ui';
import { DataSourceOption } from './DataSourceOption';
import { FormLabel } from '@grafana/ui';
// Types
import { PanelModel } from '../state';
......@@ -19,7 +26,7 @@ const timeRangeValidationEvents: ValidationEvents = {
if (!value) {
return true;
}
return isValidTimeSpan(value);
return rangeUtil.isValidTimeSpan(value);
},
errorMessage: 'Not a valid timespan',
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment