fleet/frontend/pages/software/components/EmptySoftwareTable.tsx
Zachary Winnerman b5e37ce056
Rebase sandcastle onto main (#10317)
# Checklist for submitter

If some of the following don't apply, delete the relevant line.

- [ ] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [ ] Documented any API changes (docs/Using-Fleet/REST-API.md or
docs/Contributing/API-for-contributors.md)
- [ ] Documented any permissions changes
- [ ] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [ ] Added support on fleet's osquery simulator `cmd/osquery-perf` for
new osquery data ingestion features.
- [ ] Added/updated tests
- [ ] Manual QA for all new/changed functionality
  - For Orbit and Fleet Desktop changes:
- [ ] Manual QA must be performed in the three main OSs, macOS, Windows
and Linux.
- [ ] Auto-update manual QA, from released version of component to new
version (see [tools/tuf/test](../tools/tuf/test/README.md)).

---------

Co-authored-by: RachelElysia <71795832+RachelElysia@users.noreply.github.com>
2023-03-30 11:22:41 -07:00

74 lines
2.2 KiB
TypeScript

// This component is used on DashboardPage.tsx > Software.tsx, Host Details/Device User > Software.tsx, and ManageSoftwarePage.tsx
import React from "react";
import CustomLink from "components/CustomLink";
import EmptyTable from "components/EmptyTable";
import { IEmptyTableProps } from "interfaces/empty_table";
export interface IEmptySoftwareTableProps {
isSoftwareDisabled?: boolean;
isFilterVulnerable?: boolean;
isSandboxMode?: boolean;
isCollectingSoftware?: boolean;
isSearching?: boolean;
noSandboxHosts?: boolean;
}
const EmptySoftwareTable = ({
isSoftwareDisabled,
isFilterVulnerable,
isSandboxMode,
isCollectingSoftware,
isSearching,
noSandboxHosts,
}: IEmptySoftwareTableProps): JSX.Element => {
const emptySoftware: IEmptyTableProps = {
header: `No ${
isFilterVulnerable ? "vulnerable " : ""
}software match the current search criteria`,
info: `Try again in about ${
isSandboxMode ? "15 minutes" : "1 hour"
} as the system catches up.`,
};
if (isCollectingSoftware) {
emptySoftware.header = "No software detected";
emptySoftware.info =
"This report is updated every hour to protect the performance of your devices.";
if (isSandboxMode) {
emptySoftware.info = noSandboxHosts
? "Fleet begins collecting software inventory after a host is enrolled."
: "Fleet is collecting software inventory";
}
}
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
/>
.
</>
);
}
if (isFilterVulnerable && !isSearching) {
emptySoftware.header = "No vulnerable software detected";
emptySoftware.info = `This report is updated every ${
isSandboxMode ? "15 minutes" : "hour"
} to protect the performance of your devices.`;
}
return (
<EmptyTable
iconName="empty-software"
header={emptySoftware.header}
info={emptySoftware.info}
/>
);
};
export default EmptySoftwareTable;