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

[User Profile] Update page header design #205250

Merged

Conversation

kowalczyk-krzysztof
Copy link
Member

@kowalczyk-krzysztof kowalczyk-krzysztof commented Dec 30, 2024

Summary

This PR wraps each right side item of EuiPageHeaderSection in a EuiFlexItem and assigns grow property based on what the field is. This makes it so fields that are usually longer (e.g email) won't truncate too early.

Closes: #204121

Visuals

Previous New Typical user
previous new typical_user

@kowalczyk-krzysztof kowalczyk-krzysztof added Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting Feature:Security/User Profile labels Dec 30, 2024
@kowalczyk-krzysztof kowalczyk-krzysztof self-assigned this Dec 30, 2024
@kowalczyk-krzysztof
Copy link
Member Author

@jeramysoucy @ryankeairns Can I get some feedback on this?

@kowalczyk-krzysztof kowalczyk-krzysztof force-pushed the fix/user-profile-items-grow branch from 0dd7d42 to 2cf2c63 Compare December 30, 2024 14:06
@jeramysoucy
Copy link
Contributor

@kowalczyk-krzysztof Sorry for the delay. The truncation part seems fine to me - I think it will support the vast majority of usernames. The fields can still be hidden when resizing, which is a strange behavior. Not sure how to resolve this. Maybe someone from the @elastic/eui-team could offer a suggestion.
cc @azasypkin

Screen.Recording.2024-12-31.at.2.09.04.PM.mov

@kowalczyk-krzysztof
Copy link
Member Author

@jeramysoucy Yeah it seems like when you resize the viewport down and then up again, then the max-width on EuiPageHeader is not respected. I'll try to find out why it's happening.

@kowalczyk-krzysztof
Copy link
Member Author

kowalczyk-krzysztof commented Jan 2, 2025

@jeramysoucy
It seems that there is something wrong with the onResize function of EuiTextTruncate in this scenario. Assigning width prop to EuiTextTruncate which as per documentation (This callback will not fire if width is passed.) stops the function from firing and fixes this issue. But the goal here was to make the fields have dynamic width based on content so instead I assigned a reasonable max-width to each item. Let me know what you think about it.

@kowalczyk-krzysztof kowalczyk-krzysztof force-pushed the fix/user-profile-items-grow branch from d1a60fc to 8e88a68 Compare January 2, 2025 15:34
@kowalczyk-krzysztof kowalczyk-krzysztof marked this pull request as ready for review January 3, 2025 13:29
@kowalczyk-krzysztof kowalczyk-krzysztof requested a review from a team as a code owner January 3, 2025 13:29
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-security (Team:Security)

@kc13greiner kc13greiner requested review from kc13greiner and removed request for kc13greiner January 3, 2025 13:58
@jeramysoucy
Copy link
Contributor

I pinged the EUI team for some suggestions here. We'll see what they come up with.

@MichaelMarcialis
Copy link
Contributor

Hey, all! Sorry for sticking my nose in here, but since I was involved in this page's design in the past, I figured I'd add my two cents. In short, I think this page's contents have outgrown the current use of EuiDescriptionList components in the header for displaying immutable user information. I imagine we can make a few small tweaks to the header to better accommodate the current content. Here's a super quick mockup with what I was thinking:

Initial

Key suggested changes include:

  • Replace current page title of "Profile" with username. Unless things have changed, I believe username is alway immutable after user creation. As such, it should be OK to use it as the page title for all user types (regardless of manage_security, reserved, SAML, etc.). Page breadcrumbs should be changed to match.
  • Move the user's full name and email address as simple subtitle text below the page title, separated by a comma.
  • Keep the user roles displayed as badges in the right of the page header, but remove the parent EuiDescriptionList. Also reduce the "+X more" text down to a simple "+X" in a default badge.

But like I said, this is just my two cents. I'll defer to whomever is responsible for the design of these pages now (@ek-so?), in case they have different thoughts.

@kowalczyk-krzysztof
Copy link
Member Author

kowalczyk-krzysztof commented Jan 7, 2025

@MichaelMarcialis
This PR is a followup of changes introduced in #202902 as part of papercuts projects so @ryankeairns is involved in this design. IMO your suggestions are great and they would solve the text wrapping and resizing issues.

@ryankeairns could you take a look at this?

@ek-so
Copy link
Contributor

ek-so commented Jan 7, 2025

Thanks for pinging @MichaelMarcialis! I also like your suggestion, we could make a better use of the space "Profile" takes up now.

I'm not deeply involved in the papercuts project and don’t have much context here — but I assume the goal is to quickly address some obvious issues. Speaking more broadly, I’d suggest considering whether the whole profile might be worth a second design iteration. A few new elements have been added, and perhaps we could arrange everything in a more effective manner.

@@ -98,6 +99,18 @@ const rightSideItemCSS = css`
min-width: 160px;
`;

const usernameTextCSS = css`
max-width: 160px;
Copy link
Contributor

Choose a reason for hiding this comment

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

@kowalczyk-krzysztof in case this is the final solution, have you considered using the ch unit? It would be an approximation (not exact) to the actual limit in characters.

Copy link
Member Author

Choose a reason for hiding this comment

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

@acstll I didn't think of using ch unit at all but it seems like a good idea, I'll check it out if we decide to proeceed with this solution.

@jeramysoucy
Copy link
Contributor

jeramysoucy commented Jan 7, 2025

Thanks @MichaelMarcialis! I prefer this solution, especially if it resolves both the original papercut and the subsequent issues. I'll review with my team to get additional feedback.

One thing worth noting is that it does not show the title of each piece of information, which the previous interface did. I don't think this is necessarily an issue.

@jeramysoucy
Copy link
Contributor

After discussing with the team, we are in favor of Michael's design update, with a few notes/asks:

  • Re-include the "Roles" title: removing the titles for username, full name, and email is acceptable, as these fields are generally understandable by all. The roles list should have a title to denote what is being listed.
  • Accessibility: because the titles are removed, we'll want to make sure that accessibility is not negatively impacted. ARIA labels could fill the gap here, but we'll want to test this specifically.
  • Wrapping: using a comma to separate the full name and email puts both on the same line. In most cases this is fine, but someone with a long full name likely also has a longer email. We'll want to make sure this text wraps well if needed, or that the fields are separated to individual lines. Either option is fine with us.

@MichaelMarcialis @kowalczyk-krzysztof
What do you think?

@ryankeairns
Copy link
Contributor

+1 for Michael's suggestions. Greatly simplifies things and looks better to boot :)

@kowalczyk-krzysztof kowalczyk-krzysztof marked this pull request as draft January 7, 2025 22:05
@kowalczyk-krzysztof kowalczyk-krzysztof force-pushed the fix/user-profile-items-grow branch from a617687 to 72d3f7b Compare January 7, 2025 22:09
@kowalczyk-krzysztof
Copy link
Member Author

@jeramysoucy @MichaelMarcialis
I've updated the PR with the requested changes from both comments.
Screenshot 2025-01-08 at 00 29 58

Feel free to play with the draft and let me know what other changes could be made - I guess the typography could use some more styling.

@kowalczyk-krzysztof kowalczyk-krzysztof changed the title [User Profile] Make email and full name grow over username and roles [User Profile] Update page header design Jan 7, 2025
@jeramysoucy
Copy link
Contributor

jeramysoucy commented Jan 9, 2025

@kowalczyk-krzysztof this looks great to me! And resizing works very well. I'll leave it to @MichaelMarcialis or @ryankeairns to comment on typeface/styling.
Screenshot 2025-01-09 at 6 43 31 PM

@ryankeairns ryankeairns self-requested a review January 13, 2025 18:39
Copy link
Contributor

@ryankeairns ryankeairns left a comment

Choose a reason for hiding this comment

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

We're close! Two suggested changes, then good to go.

  • Make 'Roles' a proper header - Wrap with an h3 + an EuiTitle size=xxs outside of that (see below)
  • **Fix heigh of badges when the '+X' badge is present. The xs size EuiEmptyButton is taller than the badges which results in some extra padding on the bottom. EuiBadge accept an onClick, can we remove the empty button and move the this and datat-test-subj to the EuiBadge instead?

Before

After

@MichaelMarcialis
Copy link
Contributor

@kowalczyk-krzysztof this looks great to me! And resizing works very well. I'll leave it to @MichaelMarcialis or @ryankeairns to comment on typeface/styling.

Looking good! Some final suggestions on my part:

  • Unless dealing with super long strings, the page header's subtitle should be a single line with a comma separating the user's full name and email address. The current nesting of these strings in an EuiFlexGroup is preventing that from ever happening. Can the full name and email instead be populated using the page header component's description prop without the EuiFlexGroup? Also, the comma in between is missing.
  • For the page header component, use the alignItems="bottom" prop to vertically align the roles with the subheader.
  • If ya'll feel the "Roles" title is necessary, I'd recommend putting it back in a EuiDescriptionList component with type="column" so that you get that nice bolded title again.

Quick mockup with updates attached.

final

@kowalczyk-krzysztof
Copy link
Member Author

@ryankeairns @MichaelMarcialis
I updated the PR to include both the removal EuiEmptyButton and @MichaelMarcialis requested changes. The <h3> change @ryankeairns suggested is redundant with EuiDescriptionList so I didn't include it.

Screenshot 2025-01-13 at 21 01 37

@kowalczyk-krzysztof kowalczyk-krzysztof marked this pull request as ready for review January 13, 2025 20:04
@kowalczyk-krzysztof
Copy link
Member Author

Not sure about those "help texts" - previously they were rendered as EuiIconTip next to labels.

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

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

id before after diff
security 565.2KB 563.3KB -1.8KB

History

cc @kowalczyk-krzysztof

@jeramysoucy jeramysoucy self-requested a review January 14, 2025 11:23
Copy link
Contributor

@jeramysoucy jeramysoucy left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for your patience and attention to detail on this. I left one comment regarding the aria-labels, but I don't think we need to hold up this PR for that.

alignItems="bottom"
pageTitleProps={{
'data-test-subj': 'username',
'aria-label': i18n.translate(
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I had no luck getting any of these aria labels to announce. I tested this out on main as well, and also could not get the previous implementation to announce. So I don't think this is within scope of this PR, but it is worth noting.
cc @elastic/kibana-accessibility for some guidance

@ryankeairns ryankeairns self-requested a review January 14, 2025 15:50
Copy link
Contributor

@ryankeairns ryankeairns left a comment

Choose a reason for hiding this comment

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

Thanks for the changes and patience :)

@kowalczyk-krzysztof kowalczyk-krzysztof merged commit 8e9fea7 into elastic:main Jan 14, 2025
9 checks passed
viduni94 pushed a commit to viduni94/kibana that referenced this pull request Jan 23, 2025
## Summary

This PR wraps each `right side item` of `EuiPageHeaderSection` in a
`EuiFlexItem` and assigns `grow` property based on what the field is.
This makes it so fields that are usually longer (e.g `email`) won't
truncate too early.

Closes: elastic#204121

## Visuals
| Previous | New | Typical user |
|-----------------|-----------------|-----------------|

|![previous](https://github.com/user-attachments/assets/a7b2d4cc-5ec5-4b0c-883f-d1918a25942f)
|
![new](https://github.com/user-attachments/assets/4447da5d-a8bb-434d-a68c-b6deb3b933a6)
|
![typical_user](https://github.com/user-attachments/assets/f4cfd33f-74ce-4683-b391-8dc6c789c45e)
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:Security/User Profile release_note:skip Skip the PR/issue when compiling release notes Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

User profile header - some fields truncate too early
8 participants