-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Metrics UI] Setup commonly used time ranges in timepicker (#56701)
* [Metrics UI] Setup commonly used time ranges in timepicker * Fixing tests by mocking out useKibanaUISetting * add definition override to useKibanaUISetting for timepicker:quickRanges; reduce duplicate code for mapping quick ranges * Fixing types Co-authored-by: Elastic Machine <[email protected]>
- Loading branch information
1 parent
212f1b1
commit ae78211
Showing
5 changed files
with
113 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
x-pack/legacy/plugins/infra/public/utils/map_timepicker_quickranges_to_datepicker_ranges.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { EuiSuperDatePickerCommonRange } from '@elastic/eui'; | ||
import { TimePickerQuickRange } from './use_kibana_ui_setting'; | ||
|
||
export const mapKibanaQuickRangesToDatePickerRanges = ( | ||
timepickerQuickRanges: TimePickerQuickRange[] | undefined | ||
): EuiSuperDatePickerCommonRange[] => | ||
timepickerQuickRanges | ||
? timepickerQuickRanges.map(r => ({ | ||
start: r.from, | ||
end: r.to, | ||
label: r.display, | ||
})) | ||
: []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters