-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Uptime] Update relative time handling #55693
[Uptime] Update relative time handling #55693
Conversation
Pinging @elastic/uptime (Team:uptime) |
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
x-pack/legacy/plugins/uptime/server/lib/adapters/monitor_states/search/query_context.ts
Outdated
Show resolved
Hide resolved
x-pack/legacy/plugins/uptime/server/lib/adapters/monitor_states/search/query_context.ts
Outdated
Show resolved
Hide resolved
…m/shahzad31/kibana into fix/monitor-list-time-range-error
@justinkambic in UI it's fine to show and select future date, but i have made sure, ES queries doesn't cause error if that happens. |
@justinkambic In the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to work right in manual testing, but code could use some improvements
...gins/uptime/server/lib/adapters/monitor_states/search/__tests__/parse_relative_dates.test.ts
Outdated
Show resolved
Hide resolved
...gins/uptime/server/lib/adapters/monitor_states/search/__tests__/parse_relative_dates.test.ts
Outdated
Show resolved
Hide resolved
...gins/uptime/server/lib/adapters/monitor_states/search/__tests__/parse_relative_dates.test.ts
Outdated
Show resolved
Hide resolved
x-pack/legacy/plugins/uptime/server/lib/adapters/monitor_states/search/query_context.ts
Outdated
Show resolved
Hide resolved
x-pack/legacy/plugins/uptime/server/lib/adapters/monitor_states/search/query_context.ts
Show resolved
Hide resolved
x-pack/legacy/plugins/uptime/server/lib/helper/get_histogram_interval.ts
Show resolved
Hide resolved
x-pack/legacy/plugins/uptime/server/lib/helper/get_histogram_interval.ts
Outdated
Show resolved
Hide resolved
x-pack/legacy/plugins/uptime/server/lib/helper/get_histogram_interval.ts
Outdated
Show resolved
Hide resolved
@andrewvc have improved the code and have revised unnecessary changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking much better, but could still use some minor tweaks.
x-pack/legacy/plugins/uptime/server/lib/adapters/monitor_states/search/query_context.ts
Outdated
Show resolved
Hide resolved
x-pack/legacy/plugins/uptime/server/lib/adapters/monitor_states/search/query_context.ts
Show resolved
Hide resolved
x-pack/legacy/plugins/uptime/server/lib/helper/get_histogram_interval.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM WFG
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
* update relative time handling * fix type * update logic to handle end date * fix test * PR feedback * refactor code * refactor interval time * fix tests Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* update relative time handling * fix type * update logic to handle end date * fix test * PR feedback * refactor code * refactor interval time * fix tests Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* update relative time handling * fix type * update logic to handle end date * fix test * PR feedback * refactor code * refactor interval time * fix tests Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Summary
Fixes part of #53991
When use selected this week, it translate to to="now/w" and from = "now/w" in relative time.
This PR will handle relative time handling in Server for MonitorList API.
When end date is set in future, it will reset it to now for es queries.
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.For maintainers