2023-12-12 21:03:33 +00:00
|
|
|
// This component is used on DashboardPage.tsx > Software.tsx,
|
|
|
|
|
// Host Details / Device User > Software.tsx, and SoftwarePage.tsx
|
2023-01-17 16:23:46 +00:00
|
|
|
|
|
|
|
|
import React from "react";
|
|
|
|
|
|
|
|
|
|
import CustomLink from "components/CustomLink";
|
|
|
|
|
import EmptyTable from "components/EmptyTable";
|
|
|
|
|
import { IEmptyTableProps } from "interfaces/empty_table";
|
2024-05-06 12:49:49 +00:00
|
|
|
import { ISoftwareDropdownFilterVal } from "pages/SoftwarePage/SoftwareTitles/SoftwareTable/helpers";
|
2023-01-17 16:23:46 +00:00
|
|
|
|
|
|
|
|
export interface IEmptySoftwareTableProps {
|
2024-05-06 12:49:49 +00:00
|
|
|
softwareFilter?: ISoftwareDropdownFilterVal;
|
2023-01-17 16:23:46 +00:00
|
|
|
isSoftwareDisabled?: boolean;
|
|
|
|
|
isCollectingSoftware?: boolean;
|
|
|
|
|
isSearching?: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-06 12:49:49 +00:00
|
|
|
const generateTypeText = (softwareFilter?: ISoftwareDropdownFilterVal) => {
|
|
|
|
|
if (softwareFilter === "installableSoftware") {
|
|
|
|
|
return "installable";
|
|
|
|
|
}
|
|
|
|
|
return softwareFilter === "vulnerableSoftware" ? "vulnerable" : "";
|
|
|
|
|
};
|
|
|
|
|
|
2023-01-17 16:23:46 +00:00
|
|
|
const EmptySoftwareTable = ({
|
2024-05-06 12:49:49 +00:00
|
|
|
softwareFilter,
|
2023-01-17 16:23:46 +00:00
|
|
|
isSoftwareDisabled,
|
|
|
|
|
isCollectingSoftware,
|
|
|
|
|
isSearching,
|
|
|
|
|
}: IEmptySoftwareTableProps): JSX.Element => {
|
2024-05-06 12:49:49 +00:00
|
|
|
const softwareTypeText = generateTypeText(softwareFilter);
|
|
|
|
|
|
2023-01-17 16:23:46 +00:00
|
|
|
const emptySoftware: IEmptyTableProps = {
|
2024-05-06 12:49:49 +00:00
|
|
|
header: `No ${softwareTypeText} software match the current search criteria`,
|
|
|
|
|
info:
|
|
|
|
|
"This report is updated every hour to protect the performance of your devices.",
|
2023-01-17 16:23:46 +00:00
|
|
|
};
|
2024-05-06 12:49:49 +00:00
|
|
|
|
2023-01-17 16:23:46 +00:00
|
|
|
if (isCollectingSoftware) {
|
|
|
|
|
emptySoftware.header = "No software detected";
|
|
|
|
|
emptySoftware.info =
|
|
|
|
|
"This report is updated every hour to protect the performance of your devices.";
|
|
|
|
|
}
|
2024-05-06 12:49:49 +00:00
|
|
|
|
2023-01-17 16:23:46 +00:00
|
|
|
if (isSoftwareDisabled) {
|
|
|
|
|
emptySoftware.header = "Software inventory disabled";
|
|
|
|
|
emptySoftware.info = (
|
|
|
|
|
<>
|
|
|
|
|
Users with the admin role can{" "}
|
|
|
|
|
<CustomLink
|
|
|
|
|
url="https://fleetdm.com/docs/using-fleet/vulnerability-processing#configuration"
|
|
|
|
|
text="turn on software inventory"
|
|
|
|
|
newTab
|
|
|
|
|
/>
|
|
|
|
|
.
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
}
|
2024-05-06 12:49:49 +00:00
|
|
|
if (softwareFilter === "vulnerableSoftware" && !isSearching) {
|
2023-01-17 16:23:46 +00:00
|
|
|
emptySoftware.header = "No vulnerable software detected";
|
2024-05-06 12:49:49 +00:00
|
|
|
emptySoftware.info =
|
|
|
|
|
"This report is updated every hour to protect the performance of your devices.";
|
2023-01-17 16:23:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<EmptyTable
|
2023-10-31 16:06:38 +00:00
|
|
|
graphicName="empty-software"
|
2023-01-17 16:23:46 +00:00
|
|
|
header={emptySoftware.header}
|
|
|
|
|
info={emptySoftware.info}
|
|
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default EmptySoftwareTable;
|