-
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 Monitoring UI] Change infrastructure pages titles to use breadcrumbs #135874 #140824
[Infra Monitoring UI] Change infrastructure pages titles to use breadcrumbs #135874 #140824
Conversation
5f3d989
to
a4166c0
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.
Thanks for this change and for adding the tests 💪 ! I left just a couple of comments, but nothing major.
]); | ||
]; | ||
|
||
const docTitle: string[] = [...breadcrumbs] |
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.
We're already casting breadcrumb.text
as string
so the returned array will be a string[]
. Do we still need to declare docTitle
as string[]
?
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.
You are right, there is no need to declare it. Removed.
import { ErrorPageBody } from '../../../error'; | ||
import { InfraHttpError } from '../../../../types'; | ||
import { errorTitle } from '../../../../translations'; | ||
|
||
interface Props { | ||
name: string; | ||
error: InfraHttpError; | ||
} | ||
|
||
export const PageError = ({ error, name }: Props) => { |
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.
It would be nice to add a test for this one!
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.
I added one unit test for the error page component and a functional test 4e2fd39
The title changes according to what's expected, but the error page apparently has a problem. Perhaps the way I brute-forced an error, by blocking requests to Here the title should contain |
@elasticmachine merge upstream |
@elasticmachine merge upstream |
This comment was marked as resolved.
This comment was marked as resolved.
@crespocarlos Thank you for finding that! Really interesting when I was testing it I put a not existing name in the url to force the error and it looks good: |
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.
Thanks for adding the tests for the page_error
component! I just left a couple of comments/questions.
*/ | ||
|
||
import React from 'react'; | ||
import { mount } from 'enzyme'; |
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.
Enzyme works just fine, especially if we need to play with component internals and state. In this case we don't need to do that so I believe we could use react-testing-library. What do you think?
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.
That's a good point, thank you. I agree, I realize that we don't actually need to change the internal state there - just to test if the hook is called and the text error message is correct. I updated it 👍
} as InfraHttpError); | ||
|
||
const callOut = mounted.find('EuiCallOut'); | ||
expect(callOut.render()).toMatchSnapshot(); |
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.
Instead of matching a snapshot, how about if we just assert the existence of the "Please click the back button and try again." on the page?
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.
I removed the snapshot and I added a check for the error name and message
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
History
To update your PR or re-run it, just comment with: |
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.
Looks good! Thanks for all the improvements
Summary
Related #135874
This PR changes the titles in Logs and Infrastructure apps. Similar to other apps now the titles are constructed from the breadcrumbs in reverse order. This helps us to keep the titles consistent. Also, it makes it easier for users to navigate using screen readers.
Based on the comment regarding how we should set the document title here I also changed the error page title to use
chrome.docTitle.change
in (ebe26be). The error page can also use the general breadcrumbs title but it has a different title now. So I kept the current title and added the Observability title part to it so it will be closer to the other page titles.Example
Old title: Metrics | Inventory - Kibana
New title: Inventory - Infrastructure - Observability - Elastic
Testing
I checked locally. Steps:
✅ check in the cloud as well.