From 2d2aa244669f17e59ed7633acb5f1b8db246dc48 Mon Sep 17 00:00:00 2001 From: RachelElysia <71795832+RachelElysia@users.noreply.github.com> Date: Mon, 4 Nov 2024 21:51:08 -0500 Subject: [PATCH] Fleet UI: Hide host software filters when no software + no filters applied (#23519) --- .../Software/HostSoftwareTable/HostSoftwareTable.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/frontend/pages/hosts/details/cards/Software/HostSoftwareTable/HostSoftwareTable.tsx b/frontend/pages/hosts/details/cards/Software/HostSoftwareTable/HostSoftwareTable.tsx index 99275f7751..d601141631 100644 --- a/frontend/pages/hosts/details/cards/Software/HostSoftwareTable/HostSoftwareTable.tsx +++ b/frontend/pages/hosts/details/cards/Software/HostSoftwareTable/HostSoftwareTable.tsx @@ -207,6 +207,13 @@ const HostSoftwareTable = ({ ); }, [hostSoftwareFilter, platform, searchQuery]); + // Determines if a user should be able to filter or search in the table + const hasData = data && data.software.length > 0; + const hasQuery = searchQuery !== ""; + const hasSoftwareFilter = hostSoftwareFilter !== "allSoftware"; + + const showFilterHeaders = hasData || hasQuery || hasSoftwareFilter; + return (