## Addresses #12636 – follow-up work for PR #12713 - Update Platforms column to render the user-selected platforms for a query if any, otherwise those that are compatible <img width="686" alt="Screenshot 2023-07-14 at 6 03 06 PM" src="https://github.com/fleetdm/fleet/assets/61553566/abd1f079-bdfe-45be-b1dd-58eb903672ef"> - Clean up typing and names around this column - Encapsulate logic for query automations column cells into new QueryAutomationsStatusIndicator component - Increase modularity and decrease coupling of StatusIndicator - Cleanly handle overflowing queries table due to very long query name <img width="512" alt="Screenshot 2023-07-14 at 6 07 20 PM" src="https://github.com/fleetdm/fleet/assets/61553566/6e970038-0aac-4f71-b21d-ececfa66b94f"> - Small copy and layout fixes - [x] Manual QA for all new/changed functionality --------- Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
101 lines
2.5 KiB
TypeScript
101 lines
2.5 KiB
TypeScript
import PropTypes from "prop-types";
|
|
import { SelectedPlatformString } from "interfaces/platform";
|
|
|
|
// 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 IPolicy {
|
|
id: number;
|
|
name: string;
|
|
query: string;
|
|
description: string;
|
|
author_id: number;
|
|
author_name: string;
|
|
author_email: string;
|
|
resolution: string;
|
|
platform: SelectedPlatformString;
|
|
team_id?: number;
|
|
created_at: string;
|
|
updated_at: string;
|
|
critical: boolean;
|
|
}
|
|
|
|
// 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;
|
|
webhook: string;
|
|
has_run: boolean;
|
|
osquery_policy_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;
|
|
}
|
|
|
|
export interface ILoadAllPoliciesResponse {
|
|
policies: IPolicyStats[];
|
|
}
|
|
|
|
export interface ILoadTeamPoliciesResponse {
|
|
policies: IPolicyStats[];
|
|
inherited_policies: IPolicyStats[];
|
|
}
|
|
export interface IPolicyFormData {
|
|
description?: string | number | boolean | undefined;
|
|
resolution?: string | number | boolean | undefined;
|
|
critical?: boolean;
|
|
platform?: SelectedPlatformString;
|
|
name?: string | number | boolean | undefined;
|
|
query?: string | number | boolean | undefined;
|
|
team_id?: number;
|
|
id?: number;
|
|
}
|
|
|
|
export interface IPolicyNew {
|
|
id?: number;
|
|
key?: number;
|
|
name: string;
|
|
description: string;
|
|
query: string;
|
|
resolution: string;
|
|
critical: boolean;
|
|
platform: SelectedPlatformString;
|
|
mdm_required?: boolean;
|
|
}
|