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

Merged
merged 9 commits into from
Feb 20, 2025

Conversation

sgress454
Copy link
Contributor

@sgress454 sgress454 commented Feb 11, 2025

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


Tooltips:
image
image


With regular email:
image


With one email:
image


With one long email:
image

@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 33.33333% with 2 lines in your changes missing coverage. Please review.

Project coverage is 63.42%. Comparing base (a669f39) to head (c344dd4).
Report is 27 commits behind head on main.

Files with missing lines Patch % Lines
frontend/pages/hosts/details/cards/About/About.tsx 33.33% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #26262      +/-   ##
==========================================
- Coverage   63.79%   63.42%   -0.37%     
==========================================
  Files        1655     1633      -22     
  Lines      158962   154923    -4039     
  Branches     4093     4108      +15     
==========================================
- Hits       101413    98266    -3147     
+ Misses      49608    48851     -757     
+ Partials     7941     7806     -135     
Flag Coverage Δ
frontend 53.59% <33.33%> (ø)

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
@sgress454 sgress454 marked this pull request as ready for review February 18, 2025 20:59
Comment on lines +9 to +11
.about-card__device-mapping__source {
color: inherit;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

so the source (e.g. (google chrome)) doesn't show up as grey on grey in the tooltip.

Comment on lines +13 to +16
&__multiple {
max-width: 270px;
padding-right: 5px;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

leave room for the more... text

@sgress454
Copy link
Contributor Author

@ghernandez345 updated to use TooltipTruncatedText and use base class for styles. I updated the screenshots accordingly.

@sgress454 sgress454 merged commit 8bab38b into main Feb 20, 2025
14 checks passed
@sgress454 sgress454 deleted the sgress454/25283-fix-user-tooltip branch February 20, 2025 18:08
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