Skip to content
This repository has been archived by the owner on Aug 9, 2022. It is now read-only.

Add Custom Common Time Ranges #239

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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