Commit d4516439 by Ryan McKinley Committed by GitHub

Chore: rename TimePicker to TimeRangePicker (#23524)

* rename TimePicker to TimeRangePicker

* more updates

* rename snapshot
parent 1c58202b
......@@ -2,16 +2,16 @@ import React from 'react';
import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import { TimePicker } from './TimePicker';
import { TimeRangePicker } from './TimeRangePicker';
import { UseState } from '../../utils/storybook/UseState';
import { withCenteredStory } from '../../utils/storybook/withCenteredStory';
import { TimeFragment, dateTime } from '@grafana/data';
const TimePickerStories = storiesOf('General/TimePicker', module);
const TimeRangePickerStories = storiesOf('General/TimeRangePicker', module);
TimePickerStories.addDecorator(withCenteredStory);
TimeRangePickerStories.addDecorator(withCenteredStory);
TimePickerStories.add('default', () => {
TimeRangePickerStories.add('default', () => {
return (
<UseState
initialState={{
......@@ -22,7 +22,7 @@ TimePickerStories.add('default', () => {
>
{(value, updateValue) => {
return (
<TimePicker
<TimeRangePicker
timeZone="browser"
value={value}
onChange={timeRange => {
......
import React from 'react';
import { shallow } from 'enzyme';
import { UnthemedTimePicker } from './TimePicker';
import { UnthemedTimeRangePicker } from './TimeRangePicker';
import { dateTime, TimeRange } from '@grafana/data';
import dark from './../../themes/dark';
import dark from '../../themes/dark';
const from = '2019-12-17T07:48:27.433Z';
const to = '2019-12-18T07:48:27.433Z';
......@@ -16,7 +16,7 @@ const value: TimeRange = {
describe('TimePicker', () => {
it('renders buttons correctly', () => {
const wrapper = shallow(
<UnthemedTimePicker
<UnthemedTimeRangePicker
onChange={value => {}}
value={value}
onMoveBackward={() => {}}
......@@ -30,7 +30,7 @@ describe('TimePicker', () => {
it('renders content correctly after beeing open', () => {
const wrapper = shallow(
<UnthemedTimePicker
<UnthemedTimeRangePicker
onChange={value => {}}
value={value}
onMoveBackward={() => {}}
......
......@@ -107,7 +107,7 @@ export interface State {
isOpen: boolean;
}
export class UnthemedTimePicker extends PureComponent<Props, State> {
export class UnthemedTimeRangePicker extends PureComponent<Props, State> {
state: State = {
isOpen: false,
};
......@@ -245,4 +245,4 @@ const adjustedTime = (time: DateTime, isUTC: boolean) => {
return time.local() || null;
};
export const TimePicker = withTheme(UnthemedTimePicker);
export const TimeRangePicker = withTheme(UnthemedTimeRangePicker);
......@@ -27,7 +27,7 @@ export { PieChart, PieChartType } from './PieChart/PieChart';
export { UnitPicker } from './UnitPicker/UnitPicker';
export { StatsPicker } from './StatsPicker/StatsPicker';
export { RefreshPicker } from './RefreshPicker/RefreshPicker';
export { TimePicker } from './TimePicker/TimePicker';
export { TimeRangePicker } from './TimePicker/TimeRangePicker';
export { TimeOfDayPicker } from './TimePicker/TimeOfDayPicker';
export { List } from './List/List';
export { TagsInput } from './TagsInput/TagsInput';
......
import React from 'react';
import { LocalStorageValueProvider } from '../LocalStorageValueProvider';
import { TimeRange, isDateTime, dateTime } from '@grafana/data';
import { Props as TimePickerProps, TimePicker } from '@grafana/ui/src/components/TimePicker/TimePicker';
import { Props as TimePickerProps, TimeRangePicker } from '@grafana/ui/src/components/TimePicker/TimeRangePicker';
const LOCAL_STORAGE_KEY = 'grafana.dashboard.timepicker.history';
......@@ -12,7 +12,7 @@ export const TimePickerWithHistory: React.FC<Props> = props => {
<LocalStorageValueProvider<TimeRange[]> storageKey={LOCAL_STORAGE_KEY} defaultValue={[]}>
{(values, onSaveToStore) => {
return (
<TimePicker
<TimeRangePicker
{...props}
history={convertIfJson(values)}
onChange={value => {
......
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