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

Update "used by" display and tooltip styling #26262

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

sgress454
Copy link
Contributor

For #25283

Checklist for submitter

  • Changes file added for user-visible changes in changes/, orbit/changes/ or ee/fleetd-chrome/changes.
    See Changes files for more information.

Details

This PR updates the styling on the "Used by" line of the host details page in the following ways:

  • Updated color of the "more..." text
  • Truncated long email address with ellipses
  • Tooltip displays all email addresses (in case the first one was truncated)

Screenshots

With extra long email:
image

Tooltip:
image

With regular email:
image

With one email:
image

With one long email:
image

^ ideally we'd be able to hover over this to get the whole email. The simplest way to do this would be to just always have the tooltip be active all the time, but that's a product decision. I at least have it dedicating more space to the address if there's only one.

@sgress454 sgress454 requested a review from a team as a code owner February 11, 2025 17:18
return deviceMapping.slice(1).map((d) => (
return deviceMapping.map((d) => (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Show all emails in the tooltip, since the first one may be truncated.

Comment on lines 133 to 136
<span className="device-mapping__primary-user">
{email}{" "}
<span className="device-mapping__source">{`(${source})`}</span>
</>
</span>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

New class to allow for truncating the email w/ ellipses.

color: $ui-fleet-black-50;
}
&__primary-user {
max-width: 270px;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This allows for up to "+ 999 more" without cutting of the "more" text.

Copy link

codecov bot commented Feb 11, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 63.66%. Comparing base (e2b8368) to head (da1b9a8).
Report is 24 commits behind head on main.

Files with missing lines Patch % Lines
frontend/pages/hosts/details/cards/About/About.tsx 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #26262   +/-   ##
=======================================
  Coverage   63.65%   63.66%           
=======================================
  Files        1631     1631           
  Lines      156543   156538    -5     
  Branches     4045     4089   +44     
=======================================
  Hits        99655    99655           
+ Misses      49038    49032    -6     
- Partials     7850     7851    +1     
Flag Coverage Δ
frontend 53.51% <50.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines -22 to -26
&__source {
color: $ui-fleet-black-75;
}
&__more {
color: $ui-fleet-black-50;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These were not being used because __data isn't a thing in this component as far as I can see. Moved them out from under __data and now the "More" link is grey as intended.

@sgress454 sgress454 changed the title Sgress454/25283 fix user tooltip Update "used by" display and tooltip styling Feb 11, 2025
Comment on lines 132 to 135
let className = "device-mapping__primary-user";
if (newDeviceMapping.length > 1) {
className += " multiple";
}
Copy link
Contributor

@ghernandez345 ghernandez345 Feb 12, 2025

Choose a reason for hiding this comment

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

We tend to namespace our class names and use the baseClass as the root of the class name. This helps flatten out the scss styles so they are less nested and easier to read. We also use the classnames package to handle conditional classes. This could replace line 132:

const classNames = classnames(`${baseClass}__device-mapping__primary-user`, {
  [`${baseClass}__multiple": newDeviceMapping.length > 1
}

I know it's a nitpick, and I know we're not doing it everywhere, but I do think it's better to follow the pattern that we are using across the majority of the codebase.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated. The styles were nested under .info-flex but didn't need to be, so this works!

@sgress454
Copy link
Contributor Author

Putting this back in draft as we decided in standup to use <TooltipTruncatedText/> here as well.

@sgress454 sgress454 marked this pull request as draft February 12, 2025 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants