fleet/frontend/interfaces/policy.ts

131 lines
3.5 KiB
TypeScript
Raw Normal View History

2021-11-30 18:24:30 +00:00
import PropTypes from "prop-types";
import { CommaSeparatedPlatformString } from "interfaces/platform";
import { IScript } from "./script";
import { ILabelPolicy } from "./label";
2021-11-30 18:24:30 +00:00
// 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,
resolution: PropTypes.string.isRequired,
critical: PropTypes.bool,
2021-11-30 18:24:30 +00:00
response: PropTypes.string,
team_id: PropTypes.number,
updated_at: PropTypes.string.isRequired,
});
export interface IStoredPolicyResponse {
policy: IPolicy;
}
export interface IPoliciesCountResponse {
count: number;
}
2021-08-30 23:02:53 +00:00
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;
2021-11-30 18:24:30 +00:00
created_at: string;
updated_at: string;
critical: boolean;
17445 calendar events modal (#17717) Addresses #17445 Follow-up iteration: - Finalize styling of dropdown tooltips - All `//TODO`s <img width="1393" alt="Screenshot 2024-03-20 at 1 43 54 PM" src="https://github.com/fleetdm/fleet/assets/61553566/9b792cf0-058a-4ae6-8f5f-a49eb936ebef"> <img width="1393" alt="Screenshot 2024-03-20 at 1 44 01 PM" src="https://github.com/fleetdm/fleet/assets/61553566/86195dcf-ec28-4cf0-ab8b-d785d12372ed"> <img width="1393" alt="Screenshot 2024-03-20 at 1 44 21 PM" src="https://github.com/fleetdm/fleet/assets/61553566/01effdec-ca20-49ec-a442-5fe754a5e12b"> <img width="1393" alt="Screenshot 2024-03-20 at 1 44 26 PM" src="https://github.com/fleetdm/fleet/assets/61553566/b6de6891-6eae-426e-bbff-b01184094ac9"> <img width="1393" alt="Screenshot 2024-03-20 at 1 44 33 PM" src="https://github.com/fleetdm/fleet/assets/61553566/96e167dd-752c-4b49-a1a7-69fe9b4f42ac"> <img width="1393" alt="Screenshot 2024-03-20 at 1 44 43 PM" src="https://github.com/fleetdm/fleet/assets/61553566/feedbda5-e915-4e5e-84ee-2316db49434a"> <img width="1393" alt="Screenshot 2024-03-20 at 1 44 47 PM" src="https://github.com/fleetdm/fleet/assets/61553566/c4b5ac47-3357-43ef-95ca-dd0953994f6f"> <img width="1393" alt="Screenshot 2024-03-20 at 1 45 02 PM" src="https://github.com/fleetdm/fleet/assets/61553566/17838415-5bf4-46f0-9bde-522deb0f0886"> <img width="1393" alt="Screenshot 2024-03-20 at 1 45 10 PM" src="https://github.com/fleetdm/fleet/assets/61553566/b7228484-bb9f-4119-9fbf-a60ce990ba0e"> --------- Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
2024-03-20 20:53:34 +00:00
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;
2021-11-30 18:24:30 +00:00
}
// Used on the manage hosts page and other places where aggregate stats are displayed
export interface IPolicyStats extends IPolicy {
2021-08-30 23:02:53 +00:00
passing_host_count: number;
failing_host_count: number;
host_count_updated_at: string;
2021-12-28 18:07:18 +00:00
webhook: string;
has_run: boolean;
next_update_ms: number;
2021-11-30 18:24:30 +00:00
}
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" | "";
2021-11-30 18:24:30 +00:00
// 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 {}
2022-11-11 21:08:03 +00:00
export interface ILoadTeamPoliciesResponse {
policies?: IPolicyStats[];
2022-11-11 21:08:03 +00:00
}
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;
2021-12-28 18:07:18 +00:00
id?: number;
17445 calendar events modal (#17717) Addresses #17445 Follow-up iteration: - Finalize styling of dropdown tooltips - All `//TODO`s <img width="1393" alt="Screenshot 2024-03-20 at 1 43 54 PM" src="https://github.com/fleetdm/fleet/assets/61553566/9b792cf0-058a-4ae6-8f5f-a49eb936ebef"> <img width="1393" alt="Screenshot 2024-03-20 at 1 44 01 PM" src="https://github.com/fleetdm/fleet/assets/61553566/86195dcf-ec28-4cf0-ab8b-d785d12372ed"> <img width="1393" alt="Screenshot 2024-03-20 at 1 44 21 PM" src="https://github.com/fleetdm/fleet/assets/61553566/01effdec-ca20-49ec-a442-5fe754a5e12b"> <img width="1393" alt="Screenshot 2024-03-20 at 1 44 26 PM" src="https://github.com/fleetdm/fleet/assets/61553566/b6de6891-6eae-426e-bbff-b01184094ac9"> <img width="1393" alt="Screenshot 2024-03-20 at 1 44 33 PM" src="https://github.com/fleetdm/fleet/assets/61553566/96e167dd-752c-4b49-a1a7-69fe9b4f42ac"> <img width="1393" alt="Screenshot 2024-03-20 at 1 44 43 PM" src="https://github.com/fleetdm/fleet/assets/61553566/feedbda5-e915-4e5e-84ee-2316db49434a"> <img width="1393" alt="Screenshot 2024-03-20 at 1 44 47 PM" src="https://github.com/fleetdm/fleet/assets/61553566/c4b5ac47-3357-43ef-95ca-dd0953994f6f"> <img width="1393" alt="Screenshot 2024-03-20 at 1 45 02 PM" src="https://github.com/fleetdm/fleet/assets/61553566/17838415-5bf4-46f0-9bde-522deb0f0886"> <img width="1393" alt="Screenshot 2024-03-20 at 1 45 10 PM" src="https://github.com/fleetdm/fleet/assets/61553566/b7228484-bb9f-4119-9fbf-a60ce990ba0e"> --------- Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
2024-03-20 20:53:34 +00:00
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[];
2021-08-30 23:02:53 +00:00
}
export interface IPolicyNew {
id?: number;
key?: number;
name: string;
description: string;
query: string;
resolution: string;
critical: boolean;
platform: CommaSeparatedPlatformString;
mdm_required?: boolean;
}