Fleet UI: Clarify last fetched and last seen time on Manage Host Page (#8087)

This commit is contained in:
RachelElysia
2022-10-06 09:15:40 -04:00
committed by GitHub
parent 78a562808a
commit 92d6161edb
3 changed files with 37 additions and 13 deletions
@@ -0,0 +1 @@
* Clarify last seen time and last fetched time in Fleet UI
@@ -13,6 +13,7 @@ import IssueCell from "components/TableContainer/DataTable/IssueCell/IssueCell";
import LinkCell from "components/TableContainer/DataTable/LinkCell/LinkCell";
import StatusCell from "components/TableContainer/DataTable/StatusCell/StatusCell";
import TextCell from "components/TableContainer/DataTable/TextCell/TextCell";
import TooltipWrapper from "components/TooltipWrapper";
import {
humanHostMemory,
humanHostLastRestart,
@@ -285,12 +286,23 @@ const allHostTableHeaders: IDataColumn[] = [
},
{
title: "Last fetched",
Header: (cellProps: IHeaderProps) => (
<HeaderCell
value={cellProps.column.title}
isSortedDesc={cellProps.column.isSortedDesc}
/>
),
Header: (headerProps: IHeaderProps): JSX.Element => {
const titleWithToolTip = (
<TooltipWrapper
tipContent={`
The last time the host reported vitals.
`}
>
Last fetched
</TooltipWrapper>
);
return (
<HeaderCell
value={titleWithToolTip}
isSortedDesc={headerProps.column.isSortedDesc}
/>
);
},
accessor: "detail_updated_at",
Cell: (cellProps: ICellProps) => (
<TextCell
@@ -301,12 +313,23 @@ const allHostTableHeaders: IDataColumn[] = [
},
{
title: "Last seen",
Header: (cellProps: IHeaderProps) => (
<HeaderCell
value={cellProps.column.title}
isSortedDesc={cellProps.column.isSortedDesc}
/>
),
Header: (headerProps: IHeaderProps): JSX.Element => {
const titleWithToolTip = (
<TooltipWrapper
tipContent={`
The last time the host was online.
`}
>
Last seen
</TooltipWrapper>
);
return (
<HeaderCell
value={titleWithToolTip}
isSortedDesc={headerProps.column.isSortedDesc}
/>
);
},
accessor: "seen_time",
Cell: (cellProps: ICellProps) => (
<TextCell value={cellProps.cell.value} formatter={humanHostLastSeen} />
+1 -1
View File
@@ -588,7 +588,7 @@ export const humanHostLastSeen = (lastSeen: string): string => {
if (!lastSeen || lastSeen < "2016-07-28T00:00:00Z") {
return "Never";
}
return format(new Date(lastSeen), "MMM d yyyy, HH:mm:ss");
return formatDistanceToNow(new Date(lastSeen), { addSuffix: true });
};
export const humanHostEnrolled = (enrolled: string): string => {