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 ( <>