Fix long label trunctaion on the host details page (#33451)

## For #27876 


![ezgif-3d033066375155](https://github.com/user-attachments/assets/f4d358c3-8b3d-4aed-8193-b32fd7b2510b)


- [x] Changes file added for user-visible changes in `changes/`
- [x] QA'd all new/changed functionality manually

---------

Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
This commit is contained in:
jacobshandling 2025-09-25 13:39:26 -07:00 committed by GitHub
parent 54226dad63
commit 05f586a86a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 20 additions and 3 deletions

View file

@ -0,0 +1 @@
- Elegantly handle host details page label pills for labels with very long names

View file

@ -7,6 +7,7 @@ import classnames from "classnames";
import Card from "components/Card";
import CardHeader from "components/CardHeader";
import { LABEL_DISPLAY_MAP } from "utilities/constants";
import TooltipTruncatedText from "components/TooltipTruncatedText";
const baseClass = "labels-card";
@ -31,9 +32,15 @@ const Labels = ({
variant="pill"
className="list__button"
>
{label.label_type === "builtin" && label.name in LABEL_DISPLAY_MAP
? LABEL_DISPLAY_MAP[label.name as keyof typeof LABEL_DISPLAY_MAP]
: label.name}
<TooltipTruncatedText
value={
label.label_type === "builtin" && label.name in LABEL_DISPLAY_MAP
? LABEL_DISPLAY_MAP[
label.name as keyof typeof LABEL_DISPLAY_MAP
]
: label.name
}
/>
</Button>
</li>
);

View file

@ -0,0 +1,9 @@
.labels-card {
.button,
.children-wrapper {
max-width: 100%;
.__react_component_tooltip {
font-weight: $regular;
}
}
}