fleet/frontend/interfaces/team.ts
Scott Gress fcdd01d78d
Add "Require BitLocker PIN" checkbox to disk encryption page (#31132)
for #31064 

# Details

This PR adds a "Require BitLocker PIN" checkbox under a new "Advanced"
section on the Disk Encryption page. This UI will only be visible if:

* "Turn on disk encryption" is checked
* The front-end was compiled using the `SHOW_BITLOCKER_PIN_OPTION=true`
env var, e.g.:
```
SHOW_BITLOCKER_PIN_OPTION=true NODE_ENV=development yarn run webpack --progress --watch
```

See Figma for reference:
https://www.figma.com/design/XbhlPuEJxQtOgTZW9EOJZp/-28133-Enforce-BitLocker-PIN?node-id=5334-1026&t=NuPo1M5fJepyCCRy-0

With encryption off:
<img width="569" height="233" alt="image"
src="https://github.com/user-attachments/assets/558e74cc-ce3d-47e3-aa14-1391e1cb4146"
/>

With encryption on:
<img width="551" height="285" alt="image"
src="https://github.com/user-attachments/assets/adfe2ead-4c5c-43a0-a5aa-9566635aba5f"
/>

Expanded:
<img width="534" height="297" alt="image"
src="https://github.com/user-attachments/assets/ac0620a2-528f-4118-ae46-992a646c97d8"
/>

Tooltip:
<img width="579" height="317" alt="image"
src="https://github.com/user-attachments/assets/23d13820-9bcb-49fb-b32b-2b5c60e7e55c"
/>



# Checklist for submitter

If some of the following don't apply, delete the relevant line.

<!-- Note that API documentation changes are now addressed by the
product design team. -->

- [ ] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
   - will add changelog when feature is complete
- [x] Manual QA for all new/changed functionality
2025-07-23 14:36:28 -05:00

143 lines
3.8 KiB
TypeScript

import PropTypes from "prop-types";
import {
IAppleDeviceUpdates,
IConfigFeatures,
IWebhookSettings,
} from "./config";
import enrollSecretInterface, { IEnrollSecret } from "./enroll_secret";
import { ITeamIntegrations } from "./integration";
import { UserRole } from "./user";
export default PropTypes.shape({
id: PropTypes.number.isRequired,
created_at: PropTypes.string,
name: PropTypes.string.isRequired,
description: PropTypes.string,
agent_options: PropTypes.object, // eslint-disable-line react/forbid-prop-types
role: PropTypes.any, // eslint-disable-line react/forbid-prop-types
// role value is included when the team is in the context of a user
user_count: PropTypes.number,
host_count: PropTypes.number,
secrets: PropTypes.arrayOf(enrollSecretInterface),
});
/**
* The id, name, description, and host count for a team entity
*/
export interface ITeamSummary {
id: number;
name: string;
description?: string;
host_count?: number;
}
/**
* The shape of a team entity excluding integrations and webhook settings
*/
export interface ITeam extends ITeamSummary {
uuid?: string;
display_text?: string;
count?: number;
created_at?: string;
features?: IConfigFeatures;
agent_options?: {
[key: string]: any;
};
user_count?: number;
host_count?: number;
secrets?: IEnrollSecret[];
role?: UserRole; // role value is included when the team is in the context of a user
mdm?: {
enable_disk_encryption: boolean;
windows_require_bitlocker_pin: boolean;
macos_updates: IAppleDeviceUpdates;
ios_updates: IAppleDeviceUpdates;
ipados_updates: IAppleDeviceUpdates;
macos_settings: {
custom_settings: null; // TODO: types?
enable_disk_encryption: boolean;
};
macos_setup: {
bootstrap_package: string | null;
enable_end_user_authentication: boolean;
macos_setup_assistant: string | null;
enable_release_device_manually: boolean | null;
manual_agent_install: boolean | null;
};
windows_updates: {
deadline_days: number | null;
grace_period_days: number | null;
};
};
host_expiry_settings?: {
host_expiry_enabled: boolean;
host_expiry_window: number; // days
};
}
/**
* The webhook settings of a team
*/
export type ITeamWebhookSettings = Pick<
IWebhookSettings,
"vulnerabilities_webhook" | "failing_policies_webhook" | "host_status_webhook"
>;
/**
* The integrations and webhook settings of a team
*/
export interface ITeamAutomationsConfig {
webhook_settings: ITeamWebhookSettings;
integrations: ITeamIntegrations;
}
/**
* The shape of a team entity including integrations and webhook settings
*/
export type ITeamConfig = ITeam & ITeamAutomationsConfig;
/**
* The shape of a new user to add to a team
*/
export interface INewTeamUser {
id: number;
role: UserRole;
}
/**
* The shape of the body expected from the API when adding new users to teams
*/
export interface INewTeamUsersBody {
users: INewTeamUser[];
}
export interface IRemoveTeamUserBody {
users: { id?: number }[];
}
interface INewTeamSecret {
team_id: number;
secret: string;
created_at?: string;
}
export interface INewTeamSecretBody {
secrets: INewTeamSecret[];
}
export interface IRemoveTeamSecretBody {
secrets: { secret: string }[];
}
export const API_ALL_TEAMS_ID = undefined;
export const APP_CONTEXT_ALL_TEAMS_ID = -1;
export const APP_CONTEXT_ALL_TEAMS_SUMMARY: ITeamSummary = {
id: APP_CONTEXT_ALL_TEAMS_ID,
name: "All teams",
} as const;
export const API_NO_TEAM_ID = 0;
export const APP_CONTEXT_NO_TEAM_ID = 0;
export const APP_CONTEXT_NO_TEAM_SUMMARY: ITeamSummary = {
id: APP_CONTEXT_NO_TEAM_ID,
name: "No team",
} as const;
export const isAnyTeamSelected = (currentTeamId?: number) =>
currentTeamId !== undefined && currentTeamId > APP_CONTEXT_NO_TEAM_ID;