>
) {
@@ -109,57 +114,62 @@ function PoliciesPaginatedList(
const DEFAULT_PAGE_SIZE = 10;
const DEFAULT_SORT_COLUMN = "name";
- const fetchPage = useCallback((pageNumber: number) => {
- let fetchPromise;
+ const fetchPage = useCallback(
+ (pageNumber: number) => {
+ let fetchPromise;
- if (teamId === APP_CONTEXT_ALL_TEAMS_ID) {
- fetchPromise = queryClient.fetchQuery(
- [
- {
- scope: "globalPolicies",
- page: pageNumber,
- perPage: DEFAULT_PAGE_SIZE,
- query: "",
- orderDirection: "asc" as const,
- orderKey: DEFAULT_SORT_COLUMN,
- },
- ],
- ({ queryKey }) => {
- return globalPoliciesAPI.loadAllNew(queryKey[0]);
- }
- );
- } else {
- fetchPromise = queryClient.fetchQuery(
- [
- {
- scope: "teamPolicies",
- page: pageNumber,
- perPage: DEFAULT_PAGE_SIZE,
- query: "",
- orderDirection: "asc" as const,
- orderKey: DEFAULT_SORT_COLUMN,
- teamId,
- mergeInherited: false,
- },
- ],
- ({ queryKey }) => {
- return teamPoliciesAPI.loadAllNew(queryKey[0]);
- }
- );
- }
+ if (teamId === APP_CONTEXT_ALL_TEAMS_ID) {
+ fetchPromise = queryClient.fetchQuery(
+ [
+ {
+ scope: "globalPolicies",
+ page: pageNumber,
+ perPage: DEFAULT_PAGE_SIZE,
+ query: "",
+ orderDirection: "asc" as const,
+ orderKey: DEFAULT_SORT_COLUMN,
+ },
+ ],
+ ({ queryKey }) => {
+ return globalPoliciesAPI.loadAllNew(queryKey[0]);
+ }
+ );
+ } else {
+ fetchPromise = queryClient.fetchQuery(
+ [
+ {
+ scope: "teamPolicies",
+ page: pageNumber,
+ perPage: DEFAULT_PAGE_SIZE,
+ query: "",
+ orderDirection: "asc" as const,
+ orderKey: DEFAULT_SORT_COLUMN,
+ teamId,
+ mergeInherited: false,
+ },
+ ],
+ ({ queryKey }) => {
+ return teamPoliciesAPI.loadAllNew(queryKey[0]);
+ }
+ );
+ }
- return fetchPromise.then((policiesResponse) => {
- // Marshall the response into IFormPolicy objects.
- return (policiesResponse.policies || []).map((policy) => ({
- ...policy,
- installSoftwareEnabled: !!policy.install_software,
- swIdToInstall: policy.install_software?.software_title_id,
- runScriptEnabled: !!policy.run_script,
- scriptIdToRun: policy.run_script?.id,
- scriptNameToRun: policy.run_script?.name,
- })) as IFormPolicy[];
- });
- }, []);
+ return fetchPromise.then((policiesResponse) => {
+ // Marshall the response into IFormPolicy objects.
+ return (policiesResponse.policies || []).map((policy) => {
+ return {
+ ...policy,
+ installSoftwareEnabled: !!policy.install_software,
+ swIdToInstall: policy.install_software?.software_title_id,
+ runScriptEnabled: !!policy.run_script,
+ scriptIdToRun: policy.run_script?.id,
+ scriptNameToRun: policy.run_script?.name,
+ };
+ }) as IFormPolicy[];
+ });
+ },
+ [queryClient, teamId]
+ );
const fetchCount = useCallback(() => {
let fetchPromise;
@@ -203,18 +213,20 @@ function PoliciesPaginatedList(
fetchPage={fetchPage}
fetchCount={fetchCount}
isSelected={isSelected}
+ isItemDisabled={getPolicyDisabled}
+ getItemTooltipContent={getPolicyTooltipContent}
onClickRow={onToggleItem}
renderItemRow={renderItemRow}
pageSize={DEFAULT_PAGE_SIZE}
onUpdate={onUpdate}
- disabled={disabled || gitOpsModeEnabled}
+ disabled={disableList || gitOpsModeEnabled}
heading={Policies}
+ helpText={helpText}
/>
- {footer && {footer}
}
(
(
}
@@ -199,7 +199,7 @@ const generateTableHeaders = (
},
},
{
- title: "No",
+ title: "Fail",
Header: (cellProps) => (
}
diff --git a/frontend/pages/policies/ManagePoliciesPage/components/PolicyRunScriptModal/PolicyRunScriptModal.tsx b/frontend/pages/policies/ManagePoliciesPage/components/PolicyRunScriptModal/PolicyRunScriptModal.tsx
index f3514643d2..12c42b25d3 100644
--- a/frontend/pages/policies/ManagePoliciesPage/components/PolicyRunScriptModal/PolicyRunScriptModal.tsx
+++ b/frontend/pages/policies/ManagePoliciesPage/components/PolicyRunScriptModal/PolicyRunScriptModal.tsx
@@ -183,7 +183,7 @@ const PolicyRunScriptModal = ({
) : null;
}}
- footer={
+ helpText={
<>
If{" "}
diff --git a/frontend/pages/policies/ManagePoliciesPage/helpers.tests.tsx b/frontend/pages/policies/ManagePoliciesPage/helpers.tests.tsx
index cb291d155a..949311c966 100644
--- a/frontend/pages/policies/ManagePoliciesPage/helpers.tests.tsx
+++ b/frontend/pages/policies/ManagePoliciesPage/helpers.tests.tsx
@@ -27,6 +27,7 @@ describe("getInstallSoftwareErrorMessage", () => {
updated_at: "",
critical: false,
calendar_events_enabled: false,
+ conditional_access_enabled: false,
},
{
swIdToInstall: 456,
@@ -47,6 +48,7 @@ describe("getInstallSoftwareErrorMessage", () => {
updated_at: "",
critical: false,
calendar_events_enabled: false,
+ conditional_access_enabled: false,
},
];
@@ -157,6 +159,7 @@ describe("getRunScriptErrorMessage", () => {
updated_at: "",
critical: false,
calendar_events_enabled: false,
+ conditional_access_enabled: false,
},
{
scriptIdToRun: 456,
@@ -177,6 +180,7 @@ describe("getRunScriptErrorMessage", () => {
updated_at: "",
critical: false,
calendar_events_enabled: false,
+ conditional_access_enabled: false,
},
];
diff --git a/frontend/pages/queries/ManageQueriesPage/ManageQueriesPage.tsx b/frontend/pages/queries/ManageQueriesPage/ManageQueriesPage.tsx
index 2c261ded04..08a2e550fa 100644
--- a/frontend/pages/queries/ManageQueriesPage/ManageQueriesPage.tsx
+++ b/frontend/pages/queries/ManageQueriesPage/ManageQueriesPage.tsx
@@ -125,10 +125,6 @@ const ManageQueriesPage = ({
const [showPreviewDataModal, setShowPreviewDataModal] = useState(false);
const [isUpdatingQueries, setIsUpdatingQueries] = useState(false);
const [isUpdatingAutomations, setIsUpdatingAutomations] = useState(false);
- const [
- tableQueryDataForApi,
- setTableQueryDataForApi,
- ] = useState();
const curPageFromURL = location.query.page
? parseInt(location.query.page, 10)
diff --git a/frontend/services/entities/team_policies.ts b/frontend/services/entities/team_policies.ts
index 6aa29e1127..e5c82dcc9a 100644
--- a/frontend/services/entities/team_policies.ts
+++ b/frontend/services/entities/team_policies.ts
@@ -84,6 +84,7 @@ export default {
labels_exclude_any,
});
},
+ // TODO - response type Promise
update: (id: number, data: IPolicyFormData) => {
const {
name,
@@ -95,6 +96,7 @@ export default {
critical,
// automations-related fields
calendar_events_enabled,
+ conditional_access_enabled,
software_title_id,
script_id,
labels_include_any,
@@ -111,6 +113,7 @@ export default {
platform,
critical,
calendar_events_enabled,
+ conditional_access_enabled,
software_title_id,
script_id,
labels_include_any,
diff --git a/frontend/utilities/sort/sort_functions.ts b/frontend/utilities/sort/sort_functions.ts
index f94dbb1b07..692c86f8d5 100644
--- a/frontend/utilities/sort/sort_functions.ts
+++ b/frontend/utilities/sort/sort_functions.ts
@@ -56,9 +56,26 @@ const hasLength = (a: unknown[], b: unknown[]): number => {
return 0;
};
+const POLICY_STATUS_PRECEDENCE = ["actionRequired", "fail", "pass"];
+
+const hostPolicyStatus = (a: unknown, b: unknown): number => {
+ const [aI, bI] = [
+ POLICY_STATUS_PRECEDENCE.indexOf(a as string),
+ POLICY_STATUS_PRECEDENCE.indexOf(b as string),
+ ];
+ if (aI > bI) {
+ return 1;
+ }
+ if (aI === bI) {
+ return 0;
+ }
+ return -1;
+};
+
export default {
booleanAsc,
caseInsensitiveAsc,
dateStringsAsc,
hasLength,
+ hostPolicyStatus,
};