Hide builtin labels on host page (#37393)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #32777 # Checklist for submitter If some of the following don't apply, delete the relevant line. - [x] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. See [Changes files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files) for more information. ## Testing - [x] QA'd all new/changed functionality manually
This commit is contained in:
@@ -0,0 +1 @@
|
||||
* Changed the Host details page to hide builtin labels in line with other areas such as the label filter
|
||||
@@ -24,27 +24,21 @@ const Labels = ({
|
||||
}: ILabelsProps): JSX.Element => {
|
||||
const classNames = classnames(baseClass, className);
|
||||
|
||||
const labelItems = labels.map((label: ILabel) => {
|
||||
return (
|
||||
<li className="list__item" key={label.id}>
|
||||
<Button
|
||||
onClick={() => onLabelClick(label)}
|
||||
variant="pill"
|
||||
className="list__button"
|
||||
>
|
||||
<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>
|
||||
);
|
||||
});
|
||||
const labelItems = labels
|
||||
.filter((label: ILabel) => label.label_type !== "builtin")
|
||||
.map((label: ILabel) => {
|
||||
return (
|
||||
<li className="list__item" key={label.id}>
|
||||
<Button
|
||||
onClick={() => onLabelClick(label)}
|
||||
variant="pill"
|
||||
className="list__button"
|
||||
>
|
||||
<TooltipTruncatedText value={label.name} />
|
||||
</Button>
|
||||
</li>
|
||||
);
|
||||
});
|
||||
|
||||
return (
|
||||
<Card
|
||||
@@ -53,7 +47,7 @@ const Labels = ({
|
||||
className={classNames}
|
||||
>
|
||||
<CardHeader header="Labels" />
|
||||
{labels.length === 0 ? (
|
||||
{labelItems.length === 0 ? (
|
||||
<p className="info-flex__item">
|
||||
No labels are associated with this host.
|
||||
</p>
|
||||
|
||||
Reference in New Issue
Block a user