From 31ac40828f06cbb6f34877c90be3d94c1c62b201 Mon Sep 17 00:00:00 2001 From: RachelElysia <71795832+RachelElysia@users.noreply.github.com> Date: Tue, 24 Sep 2024 09:05:39 -0700 Subject: [PATCH] Fleet UI: Hide redundant built in label filtering (#22308) --- changes/21343-hide-redundant-built-in-label-pills | 1 + .../HostsFilterBlock/HostsFilterBlock.tsx | 13 +++++++++++++ .../components/LabelFilterSelect/_styles.scss | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 changes/21343-hide-redundant-built-in-label-pills diff --git a/changes/21343-hide-redundant-built-in-label-pills b/changes/21343-hide-redundant-built-in-label-pills new file mode 100644 index 0000000000..92baea5ba5 --- /dev/null +++ b/changes/21343-hide-redundant-built-in-label-pills @@ -0,0 +1 @@ +- UI: Remove redundant built in label filter pills diff --git a/frontend/pages/hosts/ManageHostsPage/components/HostsFilterBlock/HostsFilterBlock.tsx b/frontend/pages/hosts/ManageHostsPage/components/HostsFilterBlock/HostsFilterBlock.tsx index 62dc63ed56..f3ea242e68 100644 --- a/frontend/pages/hosts/ManageHostsPage/components/HostsFilterBlock/HostsFilterBlock.tsx +++ b/frontend/pages/hosts/ManageHostsPage/components/HostsFilterBlock/HostsFilterBlock.tsx @@ -24,6 +24,7 @@ import { import { PLATFORM_LABEL_DISPLAY_NAMES, + PLATFORM_TYPE_ICONS, isPlatformLabelNameFromAPI, PolicyResponse, } from "utilities/constants"; @@ -41,6 +42,8 @@ import BootstrapPackageStatusFilter from "../BootstrapPackageStatusFilter/Bootst const baseClass = "hosts-filter-block"; +type PlatformLabelNameFromAPI = keyof typeof PLATFORM_TYPE_ICONS; + interface IHostsFilterBlockProps { /** * An object of params the the HostFilterBlock uses to render the correct @@ -145,6 +148,16 @@ const HostsFilterBlock = ({ PLATFORM_LABEL_DISPLAY_NAMES[display_text]) || display_text; + // Hide built-in labels supported in label dropdown + if ( + label_type === "builtin" && + Object.keys(PLATFORM_TYPE_ICONS).includes( + display_text as PlatformLabelNameFromAPI + ) + ) { + return <>; + } + return ( <>