Repository navigation
[InfraUI] Use EuiSuperDatePicker on the Metrics page - #34427
Conversation
…Picker. Remove redux-observable for metrics-time state, replace with hooks. Pass through refreshInterval and set it as part of the startMetricsAutoReload action Refactor metric time controls to use EuiSuperDatePicker Remove redux / redux-observable usage for MetricsTime, replace with hooks Add useInterval hook and hook up to auto reloading Add refresh interval support to the URL Use more concise syntax Add small styling Add tests for metric_time Add extra test Add correct typings Update time range immediately when auto reload is turned on (so we don't wait for the first interval to elapse) Use stricter typing Remove custom date range picker Amend translations after removing custom date range picker
|
Pinging @elastic/infrastructure-ui |
💔 Build Failed |
💔 Build Failed |
💚 Build Succeeded |
weltenwort
left a comment
There was a problem hiding this comment.
Very clean and readable 👍
Aside from a few questions I left inline, I was wondering if it was worth exposing a separate button just to toggle the isAutoReloading value besides the datepicker. I find the setting in the popover to be a bit too hard to find (considering its importance for this page). Or would that be too cluttered?
| @@ -0,0 +1,32 @@ | |||
| /* | |||
There was a problem hiding this comment.
I've put such generic hooks into public/utils before. I would be fine with having a separate dir for hooks too as long as we agree on one. 🎲 Not something we have to figure out as part of this PR though, we can clean it up separately. 😉
There was a problem hiding this comment.
Yeah, agreed. I probably should have just used your public/utils dir to start with really. I imagine Chris' Metrics Explorer work will also introduce some generic hooks. Once everything is merged we can just decide on a location and shift bits around. I have no real preference where that is, as long as we all agree 😄
💚 Build Succeeded |
|
@weltenwort Thanks for the review!
I'm torn on this. I agree it's quite hidden in the menu, but with the default options it would become cluttered in the UI. However, there is an option to set
But it would free up the space from the |
|
Maybe we can get @makwarth's opinion on this? |
|
@Kerry350 @weltenwort I agree it's more hidden than today, but I believe it's important that we keep the EUISuperDatePicker somewhat consistent across plugins. Users looking for this feature will quickly find it, if it's always located in the "quick select"-dropdown. The primary CTA for the date picker should consistently be "Refresh" across plugins, imo. |
* Remove custom date picker for Metrics page, replace with EuiSuperDatePicker. Remove redux-observable for metrics-time state, replace with hooks. Pass through refreshInterval and set it as part of the startMetricsAutoReload action Refactor metric time controls to use EuiSuperDatePicker Remove redux / redux-observable usage for MetricsTime, replace with hooks Add useInterval hook and hook up to auto reloading Add refresh interval support to the URL Use more concise syntax Add small styling Add tests for metric_time Add extra test Add correct typings Update time range immediately when auto reload is turned on (so we don't wait for the first interval to elapse) Use stricter typing Remove custom date range picker Amend translations after removing custom date range picker * Amend test for CI sensitivity * Amend test assertions * DRY up with useCallback
* Remove custom date picker for Metrics page, replace with EuiSuperDatePicker. Remove redux-observable for metrics-time state, replace with hooks. Pass through refreshInterval and set it as part of the startMetricsAutoReload action Refactor metric time controls to use EuiSuperDatePicker Remove redux / redux-observable usage for MetricsTime, replace with hooks Add useInterval hook and hook up to auto reloading Add refresh interval support to the URL Use more concise syntax Add small styling Add tests for metric_time Add extra test Add correct typings Update time range immediately when auto reload is turned on (so we don't wait for the first interval to elapse) Use stricter typing Remove custom date range picker Amend translations after removing custom date range picker * Amend test for CI sensitivity * Amend test assertions * DRY up with useCallback
| }; | ||
| private handleTimeChange = ({ start, end }: OnTimeChangeProps) => { | ||
| const parsedStart = dateMath.parse(start); | ||
| const parsedEnd = dateMath.parse(end); |
There was a problem hiding this comment.
This should be dateMath.parse(end, { roundUp: true })
… value (elastic#37896) * [Infra UI] Fixes elastic#34427 - Add round up to SuperDatePicker 'to' value * Adding test for Today only
… value (elastic#37896) * [Infra UI] Fixes elastic#34427 - Add round up to SuperDatePicker 'to' value * Adding test for Today only
* Remove custom date picker for Metrics page, replace with EuiSuperDatePicker. Remove redux-observable for metrics-time state, replace with hooks. Pass through refreshInterval and set it as part of the startMetricsAutoReload action Refactor metric time controls to use EuiSuperDatePicker Remove redux / redux-observable usage for MetricsTime, replace with hooks Add useInterval hook and hook up to auto reloading Add refresh interval support to the URL Use more concise syntax Add small styling Add tests for metric_time Add extra test Add correct typings Update time range immediately when auto reload is turned on (so we don't wait for the first interval to elapse) Use stricter typing Remove custom date range picker Amend translations after removing custom date range picker * Amend test for CI sensitivity * Amend test assertions * DRY up with useCallback
… value (elastic#37896) * [Infra UI] Fixes elastic#34427 - Add round up to SuperDatePicker 'to' value * Adding test for Today only
Summary
First and foremost this addresses #27736 (the only identified change being to use
EuiSuperDatePicker), this also addresses #27196. However, the full set of changes are:EuiSuperDatePicker.Notes
One thing to note is
EuiSuperDatePickerseems to be very sensitive to the slightestmschange, by this I mean it seems to format using a pretty format (i.e. "15 minutes ago") but then thestartmight change by 1 ms (say, the time between the interval elapse and code execution) and what was "15 minutes ago" will become, for example,Apr 3, 2019 @ 09:30:00.000. And then it might change back. This is controlled by theEuiSuperDatePickerand it's formatting. I suggest we keep an eye on it, see if it causes any reports / issues.This does not change the Snapshot page or the Logs page, as these use "point in time" pickers.
The auto reloading behaviour maintains the same implementation as before: i.e. if a
startandendare set and auto reloading is turned on, maintain therangebut shiftendtonow.Testing
Testing these changes is a case of navigating to the Metrics page and trying various options / changes with the date picker.
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.[] Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support[ ] Documentation was added for features that require explanation or tutorials