mirror of
https://github.com/fleetdm/fleet
synced 2026-05-22 16:39:01 +00:00
## For #28049 , #28610 - **Implement front end ability to enable or disable conditional access on a per-policy basis** - **Update policy status UI to include new "action required" state, representing a failed policy on a host with conditional access enabled** - Additional improvements <img width="1624" alt="Screenshot 2025-04-29 at 1 32 33 PM" src="https://github.com/user-attachments/assets/960b3348-b0e2-48b8-bcff-28f91f64fd01" /> <img width="1624" alt="Screenshot 2025-04-29 at 12 15 39 PM" src="https://github.com/user-attachments/assets/b0e0cf1f-a693-4e0b-b18a-a44ee258975f" /> <img width="1624" alt="Screenshot 2025-04-29 at 12 15 49 PM" src="https://github.com/user-attachments/assets/15f7bea1-7338-4997-93bf-8baeb308e3f0" /> <img width="1400" alt="updated policies table headers" src="https://github.com/user-attachments/assets/164fd84a-a9ee-4dfe-8d73-b4e82e27edbc" /> - [x] Changes file added for user-visible changes in `changes/` - [ ] Added/updated automated tests - [x] A detailed QA plan exists on the associated ticket (if it isn't there, work with the product group's QA engineer to add it) - [x] Manual QA for all new/changed functionality --------- Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
130 lines
3.5 KiB
TypeScript
130 lines
3.5 KiB
TypeScript
import PropTypes from "prop-types";
|
|
import { CommaSeparatedPlatformString } from "interfaces/platform";
|
|
import { IScript } from "./script";
|
|
import { ILabelPolicy } from "./label";
|
|
|
|
// Legacy PropTypes used on host interface
|
|
export default PropTypes.shape({
|
|
author_email: PropTypes.string.isRequired,
|
|
author_id: PropTypes.number.isRequired,
|
|
author_name: PropTypes.string.isRequired,
|
|
created_at: PropTypes.string.isRequired,
|
|
description: PropTypes.string.isRequired,
|
|
id: PropTypes.number.isRequired,
|
|
name: PropTypes.string.isRequired,
|
|
query: PropTypes.string.isRequired,
|
|
resoluton: PropTypes.string.isRequired,
|
|
critical: PropTypes.bool,
|
|
response: PropTypes.string,
|
|
team_id: PropTypes.number,
|
|
updated_at: PropTypes.string.isRequired,
|
|
});
|
|
|
|
export interface IStoredPolicyResponse {
|
|
policy: IPolicy;
|
|
}
|
|
|
|
export interface IPoliciesCountResponse {
|
|
count: number;
|
|
}
|
|
|
|
export interface IPolicy {
|
|
id: number;
|
|
name: string;
|
|
query: string;
|
|
description: string;
|
|
author_id: number;
|
|
author_name: string;
|
|
author_email: string;
|
|
resolution: string;
|
|
platform: CommaSeparatedPlatformString;
|
|
team_id: number | null;
|
|
created_at: string;
|
|
updated_at: string;
|
|
critical: boolean;
|
|
calendar_events_enabled: boolean;
|
|
conditional_access_enabled: boolean;
|
|
install_software?: IPolicySoftwareToInstall;
|
|
run_script?: Pick<IScript, "id" | "name">;
|
|
labels_include_any?: ILabelPolicy[];
|
|
labels_exclude_any?: ILabelPolicy[];
|
|
}
|
|
export interface IPolicySoftwareToInstall {
|
|
name: string;
|
|
software_title_id: number;
|
|
}
|
|
|
|
// Used on the manage hosts page and other places where aggregate stats are displayed
|
|
export interface IPolicyStats extends IPolicy {
|
|
passing_host_count: number;
|
|
failing_host_count: number;
|
|
host_count_updated_at: string;
|
|
webhook: string;
|
|
has_run: boolean;
|
|
next_update_ms: number;
|
|
}
|
|
|
|
export interface IPolicyWebhookPreviewPayload {
|
|
id: number;
|
|
name: string;
|
|
query: string;
|
|
description: string;
|
|
author_id: number;
|
|
author_name: string;
|
|
author_email: string;
|
|
resolution: string;
|
|
passing_host_count: number;
|
|
failing_host_count: number;
|
|
critical?: boolean;
|
|
}
|
|
|
|
export type PolicyStatusResponse = "pass" | "fail" | "";
|
|
|
|
// Used on the host details page and other places where the status of individual hosts are displayed
|
|
export interface IHostPolicy extends IPolicy {
|
|
response: PolicyStatusResponse;
|
|
}
|
|
|
|
// Policies API can return {}
|
|
export interface ILoadAllPoliciesResponse {
|
|
policies?: IPolicyStats[];
|
|
}
|
|
|
|
// Team policies API can return {}
|
|
export interface ILoadTeamPoliciesResponse {
|
|
policies?: IPolicyStats[];
|
|
}
|
|
|
|
export interface ILoadTeamPolicyResponse {
|
|
policy: IPolicyStats;
|
|
}
|
|
|
|
export interface IPolicyFormData {
|
|
description?: string | number | boolean | undefined;
|
|
resolution?: string | number | boolean | undefined;
|
|
critical?: boolean;
|
|
platform?: CommaSeparatedPlatformString;
|
|
name?: string | number | boolean | undefined;
|
|
query?: string | number | boolean | undefined;
|
|
team_id?: number | null;
|
|
id?: number;
|
|
calendar_events_enabled?: boolean;
|
|
conditional_access_enabled?: boolean;
|
|
software_title_id?: number | null;
|
|
// null for PATCH to unset - note asymmetry with GET/LIST - see IPolicy.run_script
|
|
script_id?: number | null;
|
|
labels_include_any?: string[];
|
|
labels_exclude_any?: string[];
|
|
}
|
|
|
|
export interface IPolicyNew {
|
|
id?: number;
|
|
key?: number;
|
|
name: string;
|
|
description: string;
|
|
query: string;
|
|
resolution: string;
|
|
critical: boolean;
|
|
platform: CommaSeparatedPlatformString;
|
|
mdm_required?: boolean;
|
|
}
|