Skip to content

Commit

Permalink
added custom commonly used time ranges (opendistro-for-elasticsearch#239
Browse files Browse the repository at this point in the history
)
  • Loading branch information
davidcui1225 authored and zhongnansu committed Dec 7, 2020
1 parent 6629010 commit e0aea07
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,26 @@ export const REPORT_SOURCE_TYPES = {
visualization: 'Visualization',
savedSearch: 'Saved search',
};

export const commonTimeRanges = [
{
start: 'now/d',
end: 'now',
label: 'Today so far'
},
{
start: 'now/w',
end: 'now',
label: 'Week to date'
},
{
start: 'now/M',
end: 'now',
label: 'Month to date'
},
{
start: 'now/y',
end: 'now',
label: 'Year to date'
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
EuiGlobalToastList,
EuiSuperDatePicker,
} from '@elastic/eui';
import { commonTimeRanges } from './report_settings_constants';

export function TimeRangeSelect(props) {
const {
Expand Down Expand Up @@ -191,6 +192,7 @@ export function TimeRangeSelect(props) {
setIsLoading(false);
};


return (
<div>
<div>
Expand All @@ -207,6 +209,7 @@ export function TimeRangeSelect(props) {
end={end}
onTimeChange={onTimeChange}
showUpdateButton={false}
commonlyUsedRanges={commonTimeRanges}
/>
</EuiFormRow>
</div>
Expand Down

0 comments on commit e0aea07

Please sign in to comment.