mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 01:18:42 +00:00
Fleet UI: Add last opened tooltip (#32592)
This commit is contained in:
parent
3830657031
commit
b71e69182e
3 changed files with 40 additions and 3 deletions
|
|
@ -258,8 +258,9 @@ const HostSoftware = ({
|
|||
router,
|
||||
teamId: hostTeamId,
|
||||
onShowInventoryVersions,
|
||||
platform,
|
||||
});
|
||||
}, [isMyDevicePage, router, hostTeamId, onShowInventoryVersions]);
|
||||
}, [isMyDevicePage, router, hostTeamId, onShowInventoryVersions, platform]);
|
||||
|
||||
const isLoading = isMyDevicePage
|
||||
? deviceSoftwareLoading
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import {
|
|||
isIpadOrIphoneSoftwareSource,
|
||||
SoftwareSource,
|
||||
} from "interfaces/software";
|
||||
import { HostPlatform, isLinuxLike } from "interfaces/platform";
|
||||
import { IHeaderProps, IStringCellProps } from "interfaces/datatable_config";
|
||||
|
||||
import PATHS from "router/paths";
|
||||
|
|
@ -18,6 +19,7 @@ import TextCell from "components/TableContainer/DataTable/TextCell";
|
|||
import SoftwareNameCell from "components/TableContainer/DataTable/SoftwareNameCell";
|
||||
import InstalledPathCell from "pages/SoftwarePage/components/tables/InstalledPathCell";
|
||||
import HashCell from "pages/SoftwarePage/components/tables/HashCell/HashCell";
|
||||
import TooltipWrapper from "components/TooltipWrapper";
|
||||
import { HumanTimeDiffWithDateTip } from "components/HumanTimeDiffWithDateTip";
|
||||
|
||||
import VulnerabilitiesCell from "pages/SoftwarePage/components/tables/VulnerabilitiesCell";
|
||||
|
|
@ -40,6 +42,7 @@ interface ISoftwareTableHeadersProps {
|
|||
router: InjectedRouter;
|
||||
teamId: number;
|
||||
onShowInventoryVersions: (software: IHostSoftware) => void;
|
||||
platform: HostPlatform;
|
||||
}
|
||||
|
||||
// NOTE: cellProps come from react-table
|
||||
|
|
@ -48,6 +51,7 @@ export const generateSoftwareTableHeaders = ({
|
|||
router,
|
||||
teamId,
|
||||
onShowInventoryVersions,
|
||||
platform,
|
||||
}: ISoftwareTableHeadersProps): ISoftwareTableConfig[] => {
|
||||
const tableHeaders: ISoftwareTableConfig[] = [
|
||||
{
|
||||
|
|
@ -121,7 +125,21 @@ export const generateSoftwareTableHeaders = ({
|
|||
},
|
||||
{
|
||||
Header: (): JSX.Element => {
|
||||
return <HeaderCell value="Last opened" disableSortBy />;
|
||||
const lastOpenedHeader = isLinuxLike(platform) ? (
|
||||
<TooltipWrapper
|
||||
tipContent={
|
||||
<>
|
||||
The last time the package was opened by the end user <br />
|
||||
or accessed by any process on the host.
|
||||
</>
|
||||
}
|
||||
>
|
||||
Last opened
|
||||
</TooltipWrapper>
|
||||
) : (
|
||||
"Last opened"
|
||||
);
|
||||
return <HeaderCell value={lastOpenedHeader} disableSortBy />;
|
||||
},
|
||||
id: "Last opened",
|
||||
disableSortBy: true,
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { dateAgo } from "utilities/date_format";
|
|||
|
||||
import {
|
||||
formatSoftwareType,
|
||||
INSTALLABLE_SOURCE_PLATFORM_CONVERSION,
|
||||
IHostSoftware,
|
||||
ISoftwareInstallVersion,
|
||||
SoftwareSource,
|
||||
|
|
@ -11,6 +12,7 @@ import {
|
|||
|
||||
import Card from "components/Card";
|
||||
import DataSet from "components/DataSet";
|
||||
import TooltipWrapper from "components/TooltipWrapper";
|
||||
|
||||
export const sourcesWithLastOpenedTime = new Set([
|
||||
"programs",
|
||||
|
|
@ -52,6 +54,22 @@ const InventoryVersion = ({
|
|||
signature_information: signatureInformation,
|
||||
} = version;
|
||||
|
||||
const lastOpenedTitle =
|
||||
INSTALLABLE_SOURCE_PLATFORM_CONVERSION[source] === "linux" ? (
|
||||
<TooltipWrapper
|
||||
tipContent={
|
||||
<>
|
||||
The last time the package was opened by the end user <br />
|
||||
or accessed by any process on the host.
|
||||
</>
|
||||
}
|
||||
>
|
||||
Last opened
|
||||
</TooltipWrapper>
|
||||
) : (
|
||||
"Last opened"
|
||||
);
|
||||
|
||||
return (
|
||||
<Card
|
||||
className={`${baseClass}__version`}
|
||||
|
|
@ -66,7 +84,7 @@ const InventoryVersion = ({
|
|||
)}
|
||||
{version.last_opened_at || sourcesWithLastOpenedTime.has(source) ? (
|
||||
<DataSet
|
||||
title="Last opened"
|
||||
title={lastOpenedTitle}
|
||||
value={
|
||||
version.last_opened_at ? dateAgo(version.last_opened_at) : "Never"
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue