[19857 bug fix] Fleet UI: Update empty state of OS to show info line (#21647)

This commit is contained in:
RachelElysia 2024-08-29 09:24:37 -04:00 committed by GitHub
parent 3d799e0f1c
commit 3cabefc1f1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 6 additions and 31 deletions

View file

@ -521,13 +521,6 @@ const DashboardPage = ({ router, location }: IDashboardProps): JSX.Element => {
renderFlash,
]
);
// TODO: Rework after backend is adjusted to differentiate empty search/filter results from
// collecting inventory
const isCollectingInventory =
!isAnyTeamSelected &&
!softwarePageIndex &&
!software?.software &&
software?.counts_updated_at === null;
const HostsSummaryCard = useInfoCard({
title: "Hosts",
@ -640,7 +633,6 @@ const DashboardPage = ({ router, location }: IDashboardProps): JSX.Element => {
children: (
<Software
errorSoftware={errorSoftware}
isCollectingInventory={isCollectingInventory}
isSoftwareFetching={isSoftwareFetching}
isSoftwareEnabled={isSoftwareEnabled}
software={software}

View file

@ -62,7 +62,6 @@ describe("Dashboard software card", () => {
render(
<Software
errorSoftware={null}
isCollectingInventory={false}
isSoftwareFetching={false}
isSoftwareEnabled
navTabIndex={0}
@ -118,7 +117,6 @@ describe("Dashboard software card", () => {
render(
<Software
errorSoftware={null}
isCollectingInventory={false}
isSoftwareFetching={false}
isSoftwareEnabled
navTabIndex={1}

View file

@ -18,7 +18,6 @@ import generateTableHeaders from "./SoftwareTableConfig";
interface ISoftwareCardProps {
errorSoftware: Error | null;
isCollectingInventory: boolean;
isSoftwareFetching: boolean;
isSoftwareEnabled?: boolean;
software?: ISoftwareResponse;
@ -45,7 +44,6 @@ const baseClass = "home-software";
const Software = ({
errorSoftware,
isCollectingInventory,
isSoftwareFetching,
isSoftwareEnabled,
navTabIndex,
@ -95,11 +93,7 @@ const Software = ({
defaultSortHeader={SOFTWARE_DEFAULT_SORT_DIRECTION}
defaultSortDirection={SOFTWARE_DEFAULT_SORT_DIRECTION}
resultsTitle="software"
emptyComponent={() => (
<EmptySoftwareTable
isCollectingSoftware={isCollectingInventory}
/>
)}
emptyComponent={() => <EmptySoftwareTable />}
showMarkAllPages={false}
isAllPagesSelected={false}
disableCount
@ -122,10 +116,7 @@ const Software = ({
defaultSortDirection={SOFTWARE_DEFAULT_SORT_DIRECTION}
resultsTitle="software"
emptyComponent={() => (
<EmptySoftwareTable
isCollectingSoftware={isCollectingInventory}
vulnFilters={{ vulnerable: true }}
/>
<EmptySoftwareTable vulnFilters={{ vulnerable: true }} />
)}
showMarkAllPages={false}
isAllPagesSelected={false}

View file

@ -356,7 +356,6 @@ const SoftwareTable = ({
vulnFilters={vulnFilters}
isSoftwareDisabled={!isSoftwareEnabled}
noSearchQuery={query === ""}
isCollectingSoftware={data?.counts_updated_at === null}
installableSoftwareExists={installableSoftwareExists}
/>
)}

View file

@ -14,7 +14,6 @@ export interface IEmptySoftwareTableProps {
tableName?: string;
isSoftwareDisabled?: boolean;
noSearchQuery?: boolean;
isCollectingSoftware?: boolean;
installableSoftwareExists?: boolean;
}
@ -38,7 +37,6 @@ const EmptySoftwareTable = ({
tableName = "software",
isSoftwareDisabled,
noSearchQuery,
isCollectingSoftware,
installableSoftwareExists,
}: IEmptySoftwareTableProps): JSX.Element => {
const softwareTypeText = generateTypeText(
@ -80,13 +78,10 @@ const EmptySoftwareTable = ({
info: "Install software on your hosts to see versions.",
};
}
if (isCollectingSoftware) {
return {
header: `No ${tableName} detected`,
info: `Expecting to see ${softwareTypeText}? Check back later.`,
};
}
return { header: `No ${tableName} detected`, info: "" };
return {
header: `No ${tableName} detected`,
info: `Expecting to see ${softwareTypeText}? Check back later.`,
};
}
}