-
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
[Infra UI] Propagate flyout state to node details page and some fixes #165956
[Infra UI] Propagate flyout state to node details page and some fixes #165956
Conversation
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
269b390
to
dcc553e
Compare
dcc553e
to
0ccb795
Compare
…e-flyout-state-to-node-details-page
2a57869
to
e7b38cf
Compare
e7b38cf
to
7d2d046
Compare
@@ -77,7 +78,7 @@ export const useLinkProps = ( | |||
const navigate = () => { | |||
if (navigateToApp) { | |||
const navigationPath = mergedHash ? `#${mergedHash}` : mergedPathname; | |||
navigateToApp(app, { path: navigationPath ? navigationPath : undefined }); | |||
navigateToApp(app, { path: navigationPath ? navigationPath : undefined, state }); |
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.
Cleaner way of propagating state between routes
state: { | ||
...(location.pathname | ||
? ({ | ||
originAppId: appId, | ||
originSearch: location.search, | ||
originPathname: location.pathname, | ||
} as RouteState) |
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.
This won't go in the querystring anymore, creating a shorter and less polluted query param.
73e6404
to
31bf214
Compare
Pinging @elastic/infra-monitoring-ui (Team:Infra Monitoring UI) |
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.
Obs Shared LGTM !!
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.
Well done! The navigation to the node details works as expected when using absolute dates - I found an issue if you go to the Logs tab and change the dates to relative dates (Last 1 hour for example) then enter a search term the navigation is not correct (it is back to the Overview tab):
logs_and_back_issue.mov
I have a question regarding the Back
button - if there are changes inside the node details view to the state should we persist those in case the user goes back to the host flyout?
hi @jennypavlova , thanks for reviewing this. I will look into the issue you've found.
I thought about that too. It could, and it's a matter of what the expectations are. I would say that changes made in the node details view shouldn't persist when the user goes back to the flyout. It appears that a new flow starts when you open it as a page. But we can check with @roshan-elastic what he thinks. A context provider could be a solution for sharing this state between these 2 flows, but I'm not sure if that would work when the flyout starts being used across Kibana as embeddable. I'm afraid this solution will break. |
@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.
@crespocarlos Thanks for the fix, LGTM 💯
Regarding the state - you are right maybe it's better to not persist the state when coming back to the flyout so it's also easier when the flyout is used in different places.
It's a good use case, to be honest. Let's consider this in future discussions. |
💚 Build Succeeded
Metrics [docs]Public APIs missing comments
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |
closes #164300
Summary
This PR enables state propagation between asset details flyout and full page view.
navigate_to_full_page.mov
There are other places in Kibana that redirect to node details outside the infra plugin such as APM and Observability/Overview. They use the
link-to/${assetType}-detail
path, so It's best, for now, to keep retro-compatibility with this route and propagate the state via query string.I've also refactored how we were persisting state via route navigation, to use native the
state
attribute found in thelocation
object fromreact-router
How to tests
Infrastructure
>Host