diff --git a/frontend/pages/SoftwarePage/SoftwareTitles/SoftwareTable/SoftwareTable.tests.tsx b/frontend/pages/SoftwarePage/SoftwareTitles/SoftwareTable/SoftwareTable.tests.tsx index 99e4cb7221..6549fd1d7f 100644 --- a/frontend/pages/SoftwarePage/SoftwareTitles/SoftwareTable/SoftwareTable.tests.tsx +++ b/frontend/pages/SoftwarePage/SoftwareTitles/SoftwareTable/SoftwareTable.tests.tsx @@ -54,9 +54,11 @@ describe("Software table", () => { expect(screen.getByText("Software inventory disabled")).toBeInTheDocument(); expect(screen.queryByText("Vulnerability")).toBeNull(); + expect(screen.queryByText("All software")).toBeNull(); + expect(screen.queryByText("Available for install")).toBeNull(); }); - it("Renders the page-wide empty state when no software are present", () => { + it("Renders the page-wide empty state when no software are present hiding 'Available for install' filter", () => { const render = createCustomRenderer({ context: { app: { @@ -102,9 +104,11 @@ describe("Software table", () => { expect(screen.getByText("0 items")).toBeInTheDocument(); expect(screen.queryByText("Search")).toBeNull(); expect(screen.queryByText("Updated")).toBeNull(); + expect(screen.queryByText("All software")).toBeNull(); + expect(screen.queryByText("Available for install")).toBeNull(); }); - it("Renders the page-wide empty state when search query does not exist but versions toggle is applied", () => { + it("Renders the page-wide empty state hiding 'Available for install' filter when search query does not exist but versions toggle is applied", () => { const render = createCustomRenderer({ context: { app: { @@ -146,9 +150,11 @@ describe("Software table", () => { expect( screen.getByText("Expecting to see software? Check back later.") ).toBeInTheDocument(); + expect(screen.queryByText("All software")).toBeNull(); + expect(screen.queryByText("Available for install")).toBeNull(); }); - it("Renders the empty search state when search query does not exist but dropdown is applied", () => { + it("Renders the empty search state and 'Available for install' filter when search query does not exist but filter is applied", () => { const render = createCustomRenderer({ context: { app: { @@ -194,9 +200,10 @@ describe("Software table", () => { "Expecting to see installable software? Check back later." ) ).toBeInTheDocument(); + expect(screen.getByText("Available for install")).toBeInTheDocument(); }); - it("Renders the empty search state when search query does not exist but vulnerability filter is applied", () => { + it("Renders the empty search state and 'Available for install' filter when search query does not exist but vulnerability filter is applied", () => { const render = createCustomRenderer({ context: { app: { @@ -242,5 +249,48 @@ describe("Software table", () => { "Expecting to see vulnerable software? Check back later." ) ).toBeInTheDocument(); + expect(screen.getByText("All software")).toBeInTheDocument(); + }); + + it("does not render 'Available for install' filter when team id is undefined (Fleet Free/All teams)", () => { + const render = createCustomRenderer({ + context: { + app: { + isGlobalAdmin: true, + currentUser: createMockUser(), + }, + }, + }); + + render( + + ); + + expect(screen.queryByText("All software")).toBeNull(); + expect(screen.queryByText("Available for install")).toBeNull(); }); }); diff --git a/frontend/pages/SoftwarePage/SoftwareTitles/SoftwareTable/SoftwareTable.tsx b/frontend/pages/SoftwarePage/SoftwareTitles/SoftwareTable/SoftwareTable.tsx index 2d5b475400..9f2d30007a 100644 --- a/frontend/pages/SoftwarePage/SoftwareTitles/SoftwareTable/SoftwareTable.tsx +++ b/frontend/pages/SoftwarePage/SoftwareTitles/SoftwareTable/SoftwareTable.tsx @@ -281,8 +281,9 @@ const SoftwareTable = ({ }; const renderCustomControls = () => { - // Hidden when viewing versions table - if (showVersions) { + // Hidden when viewing versions table or viewing "All teams" + // or Fleet Free + if (showVersions || teamId === undefined) { return null; } @@ -293,7 +294,6 @@ const SoftwareTable = ({ value={softwareFilter} className={`${baseClass}__software-filter`} options={SOFTWARE_TITLES_DROPDOWN_OPTIONS} - isDisabled={teamId === undefined} onChange={(newValue: SingleValue) => newValue && handleCustomFilterDropdownChange(