+ Counts are updated hourly. Click host
+
+ counts for the most up-to-date count.
+ >
+ }
+ />
+ >
+ );
};
const renderMainTable = () => {
@@ -815,7 +838,12 @@ const ManagePolicyPage = ({
currentTeam={currentTeamSummary}
currentAutomatedPolicies={currentAutomatedPolicies}
isPremiumTier={isPremiumTier}
- renderPoliciesCount={() => renderPoliciesCount(globalPoliciesCount)}
+ renderPoliciesCount={() =>
+ renderPoliciesCountAndLastUpdated(
+ globalPoliciesCount,
+ globalPolicies
+ )
+ }
searchQuery={searchQuery}
sortHeader={sortHeader}
sortDirection={sortDirection}
@@ -844,7 +872,10 @@ const ManagePolicyPage = ({
currentTeam={currentTeamSummary}
currentAutomatedPolicies={currentAutomatedPolicies}
renderPoliciesCount={() =>
- renderPoliciesCount(teamPoliciesCountMergeInherited)
+ renderPoliciesCountAndLastUpdated(
+ teamPoliciesCountMergeInherited,
+ teamPolicies
+ )
}
isPremiumTier={isPremiumTier}
searchQuery={searchQuery}
diff --git a/frontend/pages/policies/ManagePoliciesPage/_styles.scss b/frontend/pages/policies/ManagePoliciesPage/_styles.scss
index 4edf0c5432..1de07894b2 100644
--- a/frontend/pages/policies/ManagePoliciesPage/_styles.scss
+++ b/frontend/pages/policies/ManagePoliciesPage/_styles.scss
@@ -295,4 +295,8 @@
}
}
}
+
+ .component__last-updated-text {
+ font-weight: normal;
+ }
}
diff --git a/frontend/pages/policies/ManagePoliciesPage/components/PassingColumnHeader/PassingColumnHeader.tsx b/frontend/pages/policies/ManagePoliciesPage/components/PassingColumnHeader/PassingColumnHeader.tsx
index c3910fd4c0..7f9f85ca3c 100644
--- a/frontend/pages/policies/ManagePoliciesPage/components/PassingColumnHeader/PassingColumnHeader.tsx
+++ b/frontend/pages/policies/ManagePoliciesPage/components/PassingColumnHeader/PassingColumnHeader.tsx
@@ -1,37 +1,20 @@
import Icon from "components/Icon";
import React from "react";
-import TooltipWrapper from "components/TooltipWrapper";
interface IPassingColumnHeaderProps {
isPassing: boolean;
- timeSinceHostCountUpdate: string;
}
const baseClass = "passing-column-header";
-const PassingColumnHeader = ({
- isPassing,
- timeSinceHostCountUpdate,
-}: IPassingColumnHeaderProps) => {
+const PassingColumnHeader = ({ isPassing }: IPassingColumnHeaderProps) => {
const iconName = isPassing ? "success" : "error";
const columnText = isPassing ? "Yes" : "No";
- const updateText = timeSinceHostCountUpdate
- ? `Host count updated ${timeSinceHostCountUpdate}.`
- : "";
return (
-
- {updateText}
-
Counts are updated hourly.
- >
- }
- >
- {columnText}
-
+ {columnText}
);
};
diff --git a/frontend/pages/policies/ManagePoliciesPage/components/PoliciesTable/PoliciesTable.tsx b/frontend/pages/policies/ManagePoliciesPage/components/PoliciesTable/PoliciesTable.tsx
index 6db439a073..88dc329983 100644
--- a/frontend/pages/policies/ManagePoliciesPage/components/PoliciesTable/PoliciesTable.tsx
+++ b/frontend/pages/policies/ManagePoliciesPage/components/PoliciesTable/PoliciesTable.tsx
@@ -97,7 +97,6 @@ const PoliciesTable = ({
selectedTeamId: currentTeam?.id,
hasPermissionAndPoliciesToDelete,
},
- policiesList,
isPremiumTier
)}
data={generateDataSet(
diff --git a/frontend/pages/policies/ManagePoliciesPage/components/PoliciesTable/PoliciesTableConfig.tsx b/frontend/pages/policies/ManagePoliciesPage/components/PoliciesTable/PoliciesTableConfig.tsx
index 76e785d741..6f09884cb9 100644
--- a/frontend/pages/policies/ManagePoliciesPage/components/PoliciesTable/PoliciesTableConfig.tsx
+++ b/frontend/pages/policies/ManagePoliciesPage/components/PoliciesTable/PoliciesTableConfig.tsx
@@ -2,11 +2,7 @@
// disable this rule as it was throwing an error in Header and Cell component
// definitions for the selection row for some reason when we dont really need it.
import React from "react";
-import {
- formatDistanceToNowStrict,
- millisecondsToHours,
- millisecondsToMinutes,
-} from "date-fns";
+import { millisecondsToHours, millisecondsToMinutes } from "date-fns";
import { Tooltip as ReactTooltip5 } from "react-tooltip-5";
// @ts-ignore
import Checkbox from "components/forms/fields/Checkbox";
@@ -91,27 +87,10 @@ const generateTableHeaders = (
hasPermissionAndPoliciesToDelete?: boolean;
tableType?: string;
},
- policiesList: IPolicyStats[] = [],
isPremiumTier?: boolean
): IDataColumn[] => {
const { selectedTeamId, hasPermissionAndPoliciesToDelete } = options;
const viewingTeamPolicies = selectedTeamId !== -1;
- // Figure the time since the host counts were updated.
- // First, find first policy item with host_count_updated_at.
- const updatedAt =
- policiesList.find((p) => !!p.host_count_updated_at)
- ?.host_count_updated_at || "";
- let timeSinceHostCountUpdate = "";
- if (updatedAt) {
- try {
- timeSinceHostCountUpdate = formatDistanceToNowStrict(
- new Date(updatedAt),
- { addSuffix: true }
- );
- } catch (e) {
- // Do nothing.
- }
- }
const tableHeaders: IDataColumn[] = [
{
@@ -170,12 +149,7 @@ const generateTableHeaders = (
title: "Yes",
Header: (cellProps) => (
- }
+ value={}
isSortedDesc={cellProps.column.isSortedDesc}
/>
),
@@ -221,12 +195,7 @@ const generateTableHeaders = (
title: "No",
Header: (cellProps) => (
- }
+ value={}
isSortedDesc={cellProps.column.isSortedDesc}
/>
),