mirror of
https://github.com/fleetdm/fleet
synced 2026-04-21 13:37:30 +00:00
<!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #41601 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Details This PR updates the front end to use the following renamed API keys: * bootstrap_package -> macos_bootstrap_package * manual_agent_install -> macos_manual_agent_install * enable_release_device_manually -> apple_ enable_release_device_manually * script -> macos_script * macos_setup -> setup_experience * macos_settings -> apple_settings * custom_settings -> configuration_profiles * macos_setup_assistant -> apple_setup_assistant It also ensures that consumers of the "get fleet config" API pull from the `.fleet` property rather than `.team`, so that they can use all of the newly renamed response fields. ## Summary by CodeRabbit * **Refactor** * Restructured Mobile Device Management configuration for Apple devices, reorganizing setup experience, bootstrap package, and device configuration field organization. * Updated filter terminology and query parameters throughout device management interfaces, improving how users filter and navigate Apple device settings. * Enhanced configuration field naming conventions for better clarity and maintainability across device management features. <!-- end of auto-generated comment: release notes by coderabbit.ai --> # Checklist for submitter If some of the following don't apply, delete the relevant line. - [X] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. See [Changes files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files) for more information. ## Testing - [X] Added/updated automated tests - [X] QA'd all new/changed functionality manually --- Manual Test Plan Prerequisites - Fleet server with MDM enabled (macOS at minimum) - At least one macOS host enrolled in Fleet MDM - A team configured with setup experience settings --- 1. Manage Hosts — Filters - [X] macOS settings filter: - Go to Hosts > Manage Hosts - Filter by macOS settings status (e.g. Pending, Verified, Failed) - Verify the filter applies and hosts list updates - Check that the URL contains apple_settings=<status> - Copy the URL, paste it in a new tab — verify the filter is still applied - Manually edit the URL to use macos_settings=<status> instead — verify it still works (backward compat) - Clear the filter pill — verify both apple_settings and macos_settings are removed from the URL - [X] Bootstrap package filter: - Filter by bootstrap package status - Verify the URL contains macos_bootstrap_package=<status> - Manually edit the URL to use bootstrap_package=<status> — verify it still works - Clear the filter pill — verify both params are removed --- 2. Setup Experience (Controls Page) - [X] Bootstrap package: - Go to Controls > Setup experience for a team - Upload a bootstrap package — verify it appears in the table - Toggle the "manual agent install" advanced option on/off — verify it saves - Delete the bootstrap package — verify it's removed - In the bootstrap package table, click "View all hosts" link for a status row — verify it navigates to Manage Hosts with macos_bootstrap_package in the URL - [X] End user authentication: - Toggle end user authentication on/off for a team and for "No team" - Verify the toggle reflects the saved state after page reload - [X] Setup assistant: - Upload a setup assistant profile - Verify the "release device manually" toggle works for both a team and "No team" - [X] Install software: - Verify the "require all software" checkbox reflects the correct saved state for both team and "No team"
277 lines
7.3 KiB
TypeScript
277 lines
7.3 KiB
TypeScript
import { IHost, IHostEndUser, IGeoLocation } from "interfaces/host";
|
|
import { IHostMdmProfile } from "interfaces/mdm";
|
|
import { pick } from "lodash";
|
|
|
|
import { normalizeEmptyValues } from "utilities/helpers";
|
|
import { HOST_SUMMARY_DATA } from "utilities/constants";
|
|
import { IGetHostSoftwareResponse } from "services/entities/hosts";
|
|
import {
|
|
IHostAppStoreApp,
|
|
IHostSoftware,
|
|
IHostSoftwarePackage,
|
|
} from "interfaces/software";
|
|
|
|
const DEFAULT_HOST_PROFILE_MOCK: IHostMdmProfile = {
|
|
profile_uuid: "123-abc",
|
|
name: "Test Profile",
|
|
operation_type: "install",
|
|
platform: "darwin",
|
|
status: "verified",
|
|
detail: "This is verified",
|
|
scope: "device",
|
|
managed_local_account: "",
|
|
};
|
|
|
|
export const createMockHostMdmProfile = (
|
|
overrides?: Partial<IHostMdmProfile>
|
|
): IHostMdmProfile => {
|
|
return { ...DEFAULT_HOST_PROFILE_MOCK, ...overrides };
|
|
};
|
|
|
|
export const DEFAULT_HOST_HOSTNAME = "9b20fc72a247";
|
|
|
|
const DEFAULT_HOST_MOCK: IHost = {
|
|
id: 1,
|
|
created_at: "2022-01-01T12:00:00Z",
|
|
updated_at: "2022-01-02T12:00:00Z",
|
|
detail_updated_at: "2022-01-02T12:00:00Z",
|
|
last_restarted_at: "2022-01-02T12:00:00Z",
|
|
label_updated_at: "2022-01-02T12:00:00Z",
|
|
policy_updated_at: "2022-01-02T12:00:00Z",
|
|
last_enrolled_at: "2022-01-02T12:00:00Z",
|
|
last_mdm_enrolled_at: "2022-01-02T12:00:00Z",
|
|
seen_time: "2022-04-06T02:11:41Z",
|
|
refetch_requested: false,
|
|
refetch_critical_queries_until: null,
|
|
hostname: DEFAULT_HOST_HOSTNAME,
|
|
display_name: "9b20fc72a247",
|
|
display_text: "mock host 1",
|
|
uuid: "09b244f8-0000-0000-b5cc-791a15f11073",
|
|
platform: "ubuntu",
|
|
osquery_version: "4.9.0",
|
|
orbit_version: "1.22.0",
|
|
fleet_desktop_version: "1.22.1",
|
|
os_version: "Ubuntu 18.4.0",
|
|
build: "",
|
|
platform_like: "debian",
|
|
code_name: "",
|
|
uptime: 281037000000000,
|
|
memory: 6232231936,
|
|
cpu_type: "x86_64",
|
|
cpu_subtype: "158",
|
|
cpu_brand: "Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz",
|
|
cpu_physical_cores: 8,
|
|
cpu_logical_cores: 8,
|
|
hardware_vendor: "",
|
|
hardware_model: "",
|
|
hardware_version: "",
|
|
hardware_serial: "",
|
|
computer_name: "9b20fc72a247",
|
|
mdm: {
|
|
encryption_key_available: false,
|
|
enrollment_status: "Off",
|
|
server_url: "https://www.example.com/1",
|
|
profiles: [],
|
|
os_settings: {
|
|
disk_encryption: {
|
|
status: null,
|
|
detail: "",
|
|
},
|
|
certificates: [],
|
|
},
|
|
apple_settings: {
|
|
disk_encryption: null,
|
|
action_required: null,
|
|
},
|
|
setup_experience: {
|
|
bootstrap_package_status: "",
|
|
details: "",
|
|
bootstrap_package_name: "",
|
|
},
|
|
device_status: "unlocked",
|
|
pending_action: "",
|
|
},
|
|
public_ip: "",
|
|
primary_ip: "172.23.0.3",
|
|
primary_mac: "02:42:ac:17:00:03",
|
|
distributed_interval: 10,
|
|
config_tls_refresh: 10,
|
|
logger_tls_period: 10,
|
|
team_id: null,
|
|
pack_stats: null,
|
|
team_name: null,
|
|
gigs_disk_space_available: 100.0,
|
|
percent_disk_space_available: 50,
|
|
issues: {
|
|
total_issues_count: 0,
|
|
critical_vulnerabilities_count: 0,
|
|
failing_policies_count: 0,
|
|
},
|
|
status: "offline",
|
|
scripts_enabled: false,
|
|
labels: [],
|
|
packs: [],
|
|
software: [],
|
|
users: [],
|
|
policies: [],
|
|
device_mapping: [],
|
|
end_users: [],
|
|
conditional_access_bypassed: false,
|
|
};
|
|
|
|
const createMockHost = (overrides?: Partial<IHost>): IHost => {
|
|
return { ...DEFAULT_HOST_MOCK, ...overrides };
|
|
};
|
|
|
|
export const createMockHostGeolocation = (
|
|
overrides: Partial<IGeoLocation> = {}
|
|
): IGeoLocation => {
|
|
return {
|
|
country_iso: "US",
|
|
city_name: "Minneapolis",
|
|
geometry: {
|
|
type: "Point",
|
|
coordinates: [-93.2602, 44.9844], // [lng, lat]
|
|
},
|
|
...overrides,
|
|
};
|
|
};
|
|
|
|
export const createMockHostResponse = { host: createMockHost() };
|
|
|
|
export const createMockHostsResponse = (overrides?: Partial<IHost>[]) => {
|
|
const numHosts = overrides?.length || 1;
|
|
const hosts = Array(numHosts)
|
|
.fill(null)
|
|
.map((_, i) => createMockHost(overrides?.[i]));
|
|
return {
|
|
hosts,
|
|
};
|
|
};
|
|
|
|
export const createMockIosHostResponse = {
|
|
host: createMockHost({
|
|
hostname: "Test device (iPhone)",
|
|
display_name: "Test device (iPhone)",
|
|
team_id: 2,
|
|
team_name: "Mobile",
|
|
platform: "ios",
|
|
os_version: "iOS 14.7.1",
|
|
hardware_serial: "C8QH6T96DPNA",
|
|
created_at: "2024-01-01T12:00:00Z",
|
|
updated_at: "2024-05-02T12:00:00Z",
|
|
detail_updated_at: "2024-05-02T12:00:00Z",
|
|
last_restarted_at: "2024-04-02T12:00:00Z",
|
|
last_enrolled_at: "2024-01-02T12:00:00Z",
|
|
}),
|
|
};
|
|
|
|
export const createMockHostSummary = (overrides?: Partial<IHost>) => {
|
|
return normalizeEmptyValues(
|
|
pick(createMockHost(overrides), HOST_SUMMARY_DATA)
|
|
);
|
|
};
|
|
|
|
const DEFAULT_HOST_SOFTWARE_PACKAGE_MOCK: IHostSoftwarePackage = {
|
|
name: "mock software.app",
|
|
version: "1.0.0", // Used in version comparison tests
|
|
self_service: false,
|
|
icon_url: "https://example.com/icon.png",
|
|
last_install: {
|
|
install_uuid: "123-abc",
|
|
installed_at: "2022-01-01T12:00:00Z",
|
|
},
|
|
last_uninstall: null,
|
|
};
|
|
|
|
export const createMockHostSoftwarePackage = (
|
|
overrides?: Partial<IHostSoftwarePackage>
|
|
): IHostSoftwarePackage => {
|
|
return { ...DEFAULT_HOST_SOFTWARE_PACKAGE_MOCK, ...overrides };
|
|
};
|
|
|
|
const DEFAULT_HOST_APP_STORE_APP_MOCK: IHostAppStoreApp = {
|
|
app_store_id: "123456789",
|
|
platform: "darwin",
|
|
version: "1.0.0",
|
|
self_service: false,
|
|
icon_url: "https://via.placeholder.com/512",
|
|
last_install: null,
|
|
};
|
|
|
|
export const createMockHostAppStoreApp = (
|
|
overrides?: Partial<IHostAppStoreApp>
|
|
): IHostAppStoreApp => {
|
|
return { ...DEFAULT_HOST_APP_STORE_APP_MOCK, ...overrides };
|
|
};
|
|
|
|
export const DEFAULT_INSTALLED_VERSION = {
|
|
version: "1.0.0", // Used in version comparison tests
|
|
last_opened_at: "2022-01-01T12:00:00Z",
|
|
vulnerabilities: ["CVE-2020-0001"],
|
|
installed_paths: ["/Applications/mock.app"],
|
|
bundle_identifier: "com.mock.software",
|
|
signature_information: [
|
|
{
|
|
installed_path: "/Applications/mock.app",
|
|
team_identifier: "12345TEAMIDENT",
|
|
hash_sha256: "mockhashhere",
|
|
},
|
|
],
|
|
};
|
|
const DEFAULT_HOST_SOFTWARE_MOCK: IHostSoftware = {
|
|
id: 1,
|
|
name: "mock software.app",
|
|
display_name: "Mock Software",
|
|
icon_url: null,
|
|
software_package: createMockHostSoftwarePackage(),
|
|
app_store_app: null,
|
|
source: "apps",
|
|
bundle_identifier: "com.test.mock",
|
|
status: "installed",
|
|
installed_versions: [DEFAULT_INSTALLED_VERSION],
|
|
};
|
|
|
|
export const createMockHostSoftware = (
|
|
overrides?: Partial<IHostSoftware>
|
|
): IHostSoftware => {
|
|
return {
|
|
...DEFAULT_HOST_SOFTWARE_MOCK,
|
|
...overrides,
|
|
};
|
|
};
|
|
|
|
const DEFAULT_GET_HOST_SOFTWARE_RESPONSE_MOCK: IGetHostSoftwareResponse = {
|
|
count: 1,
|
|
software: [createMockHostSoftware()],
|
|
meta: {
|
|
has_next_results: false,
|
|
has_previous_results: false,
|
|
},
|
|
};
|
|
|
|
export const createMockGetHostSoftwareResponse = (
|
|
overrides?: Partial<IGetHostSoftwareResponse>
|
|
): IGetHostSoftwareResponse => {
|
|
return {
|
|
...DEFAULT_GET_HOST_SOFTWARE_RESPONSE_MOCK,
|
|
...overrides,
|
|
};
|
|
};
|
|
|
|
export const DEFAULT_HOST_END_USER_MOCK: IHostEndUser = {
|
|
idp_department: "Engineering",
|
|
idp_info_updated_at: "2025-09-15T12:00:00Z",
|
|
idp_username: "jdoe",
|
|
idp_full_name: "John Doe",
|
|
idp_groups: ["GroupA", "GroupB"],
|
|
other_emails: [{ email: "other@example.com", source: "chrome" }],
|
|
};
|
|
|
|
export const createMockHostEndUser = (
|
|
overrides?: Partial<IHostEndUser>
|
|
): IHostEndUser => {
|
|
return { ...DEFAULT_HOST_END_USER_MOCK, ...overrides };
|
|
};
|
|
|
|
export default createMockHost;
|