Skip to content
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] Change breadcrumbs and add return button #164726

Merged

Conversation

crespocarlos
Copy link
Contributor

@crespocarlos crespocarlos commented Aug 24, 2023

closes: #148956

Summary

This PR adds a return button to the Node Details page, both old and new versions. When returning to the previous page, the page has to load with its previous state. This doesn't work for the Inventory and Metrics UI.

The Return button will not show when: the URL is copied from the address bar and opened in a new tab/browser. Clicking on the a link to open the page in a new tab will show the return button.

Return to Host View

hosts_view_node_details.mov

Return to Inventory UI

inventory_node_details.mov

Returning state in Inventory UI doesn't work. There are 2 main problems: The hierarchy of the WaffleOptionContext in the page and the Saved View load, which overrides the URL state.

Return to Metrics UI

metrics_node_details.mov

Returning state in Metrics UI doesn't work because the Saved View overrides the URL state.

Return to APM

APM_node_details.mov

Return button remains after page refresh

refresh_return.mov

Here it's possible to see that the Inventory UI doesn't return to its previous state

How to test this PR.

  • Setup a new Kibana instance
  • Follow the steps from the video above

@apmmachine
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • /oblt-deploy-serverless : Deploy a serverless Kibana instance using the Observability test environments.
  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@crespocarlos crespocarlos added Feature:Metrics UI Metrics UI feature Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting Feature:ObsHosts Hosts feature within Observability v8.11.0 labels Aug 24, 2023
@crespocarlos crespocarlos force-pushed the 148956-node-details-page-return-button branch from 527228d to fc60d07 Compare August 24, 2023 14:46
@crespocarlos crespocarlos force-pushed the 148956-node-details-page-return-button branch from 9c6c0f2 to 93734a8 Compare August 28, 2023 09:54
@crespocarlos crespocarlos marked this pull request as ready for review August 28, 2023 15:13
@crespocarlos crespocarlos requested a review from a team as a code owner August 28, 2023 15:13
@elasticmachine
Copy link
Contributor

Pinging @elastic/infra-monitoring-ui (Team:Infra Monitoring UI)

@crespocarlos
Copy link
Contributor Author

@elasticmachine merge upstream

@crespocarlos crespocarlos changed the title Change breadcrumbs and add return button [Infra UI] Change breadcrumbs and add return button Aug 28, 2023
const breadcrumbs: EuiBreadcrumbsProps['breadcrumbs'] =
// If there is a state object in location, it's persisted in case the page is opened in a new tab or after page refresh
// With that, we can show the return button. Otherwise, it will be hidden (ex: the user opened a shared URL or opened the page from their bookmarks)
location.state || history.length > 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small caveat about history.length here. If a user has a browser tab with existing history and then pastes a Kibana URL into that tab, history will still have all of the previous records and the Return button will go back to an arbitrary page from the history. Kind of an edge case, but worth mentioning.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to simulate this, but the history is reset when I paste a URL in a tab with existing history.
Returning using history.goBack() should be an edge case. I'm even thinking about removing it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like react router does some additional transformations with the history. Just checked, after pasting a URL window.history has all the previous records and history from useHistory() has only the current record. All good then 👍

Copy link
Contributor

@mykolaharmash mykolaharmash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tested, everything works as on the videos ✨ Left a few small comments.

to={{
pathname: `/detail/${nodeType}/${nodeId}`,
search: queryParams.toString(),
state: state ? JSON.parse(state) : undefined,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth wrapping JSON.parse with try/catch considering the unstructured nature of the state property.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True! Good catch.

? {
state: JSON.stringify({
originAppId: appId,
originData: location.search,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: originData sounds to me like it holds some data object, might be worth sticking to originSearch to better describe the content.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree! renaming it.

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
infra 1423 1424 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
infra 2.0MB 2.0MB +1.8KB
Unknown metric groups

ESLint disabled line counts

id before after diff
infra 51 50 -1

Total ESLint disabled count

id before after diff
infra 60 59 -1

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Contributor

@mykolaharmash mykolaharmash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! ✨🚀

@crespocarlos crespocarlos merged commit 9ca30e8 into elastic:main Aug 30, 2023
23 checks passed
@crespocarlos crespocarlos deleted the 148956-node-details-page-return-button branch August 30, 2023 07:30
bryce-b pushed a commit to bryce-b/kibana that referenced this pull request Sep 19, 2023
closes: elastic#148956

## Summary

This PR adds a return button to the Node Details page, both old and new
versions. When returning to the previous page, the page has to load with
its previous state. **This doesn't work for the Inventory and Metrics
UI.**

The Return button will not show when: the URL is copied from the address
bar and opened in a new tab/browser. Clicking on the a link to open the
page in a new tab will show the return button.


**Return to Host View**


https://github.com/elastic/kibana/assets/2767137/06e218fc-5f35-4e67-a4f9-3f04b3f79dee


**Return to Inventory UI**


https://github.com/elastic/kibana/assets/2767137/906012ce-e5ca-49dd-a19b-2b3d16e9e4f6

_Returning state in Inventory UI doesn't work. There are 2 main
problems: The hierarchy of the WaffleOptionContext in the page and the
Saved View load, which overrides the URL state._

**Return to Metrics UI**


https://github.com/elastic/kibana/assets/2767137/de2b19f4-c5e2-4368-8e00-b50ae9ba357b

_Returning state in Metrics UI doesn't work because the Saved View
overrides the URL state._

**Return to APM**


https://github.com/elastic/kibana/assets/2767137/704ce2f0-17eb-4fa9-a791-f0cf9b29c43a

**Return button remains after page refresh**


https://github.com/elastic/kibana/assets/2767137/58600504-1863-4254-83ea-a2d488e2b38a

**Here it's possible to see that the Inventory UI doesn't return to its
previous state**


###  How to test this PR.

- Setup a new Kibana instance
- Follow the steps from the video above

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Metrics UI Metrics UI feature Feature:ObsHosts Hosts feature within Observability release_note:skip Skip the PR/issue when compiling release notes Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services v8.11.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Infrastructure UI] Hosts: When linking to the individual host detail page, show breadcrumbs/back option
6 participants