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