Skip to content

Commit

Permalink
Fleet UI: Hide host software filters when no software + no filters ap…
Browse files Browse the repository at this point in the history
…plied (#23519)
  • Loading branch information
RachelElysia authored Nov 5, 2024
1 parent 441661d commit 2d2aa24
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div className={baseClass}>
<TableContainer
Expand All @@ -223,10 +230,10 @@ const HostSoftwareTable = ({
inputPlaceHolder="Search by name"
onQueryChange={onQueryChange}
emptyComponent={memoizedEmptyComponent}
customControl={memoizedFilterDropdown}
customControl={showFilterHeaders ? memoizedFilterDropdown : undefined}
showMarkAllPages={false}
isAllPagesSelected={false}
searchable
searchable={showFilterHeaders}
manualSortBy
/>
</div>
Expand Down

0 comments on commit 2d2aa24

Please sign in to comment.