fleet/frontend/pages/hosts/details/MacSettingsModal/MacSettingsTable/MacSettingsTableConfig.tsx

79 lines
1.8 KiB
TypeScript
Raw Normal View History

UI: Add macOS settings (profiles) indicator and modal with data table (#9809) # Addresses #9413 # Implements https://www.loom.com/share/d1b66a3076b94bf2add4fcf8666649a4 - macOS settings indicator on host details and device user pages. Only displayed if (1) the host is enrolled in a Fleet MDM server and (2) the host has at least one setting (profile) enforced. - macOS settings modal, toggled by clicking on above indicator. Contains a data table with the name, status, and error messages, if any, of each enforced macOS setting on the host. # Notes - To aid in reviewing, you'll probably want to focus on: - [DeviceUserPage.tsx](https://github.com/fleetdm/fleet/pull/9809/files#diff-be9f14d3cee9f345058212985c26b3452688c6d75853a5e9dcb968a69dfcbbd7) and [HostDetailsPage.tsx](https://github.com/fleetdm/fleet/pull/9809/files#diff-72f7403682d211fc8a84a411fc39c4a33c3eb6a33549a33f1179dd7da6a893cc) - [HostSummary.tsx](https://github.com/fleetdm/fleet/pull/9809/files#diff-435e720f1ad82e892bec00fbc9c14e01e9488b776ae293f9158500c66d85bd0d) - [MacSettingsIndicator.tsx](https://github.com/fleetdm/fleet/pull/9809/files#diff-e23079f72b13bd34eb978eded467265dad4f366a6fece60cd52c887f355f92d1) - [MacSettingsModal.tsx](https://github.com/fleetdm/fleet/pull/9809/files#diff-75a08aa5b66cc2b63fc616d8ba012e552376f23d3c3df01d875586857f326f53) - [MacSettingsTable.tsx](https://github.com/fleetdm/fleet/pull/9809/files#diff-5dc441b06f770f112bb32bb618e2140e9bbccb7ebf80d86ee57c2754e067a421) and its associated [MacSettingsTableConfig.tsx](https://github.com/fleetdm/fleet/pull/9809/files#diff-0ab0cb34e249e2a41bf51508d38bea018dc5e683b705308250241c42549ab093) - Currently using mock data. Once #9599 is completed, #9888 will change these components to use the real data - 2/21 - removed mock data. Until the API returns the host.mdm.profiles data, settings indicator and modal will not render # Checklist - [x] Changes file added - [x] Manual QA - [x] Updated testing inventory --------- Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
2023-02-22 16:13:12 +00:00
import TextCell from "components/TableContainer/DataTable/TextCell";
import React from "react";
import { IHostMacMdmProfile } from "interfaces/mdm";
UI: Add macOS settings (profiles) indicator and modal with data table (#9809) # Addresses #9413 # Implements https://www.loom.com/share/d1b66a3076b94bf2add4fcf8666649a4 - macOS settings indicator on host details and device user pages. Only displayed if (1) the host is enrolled in a Fleet MDM server and (2) the host has at least one setting (profile) enforced. - macOS settings modal, toggled by clicking on above indicator. Contains a data table with the name, status, and error messages, if any, of each enforced macOS setting on the host. # Notes - To aid in reviewing, you'll probably want to focus on: - [DeviceUserPage.tsx](https://github.com/fleetdm/fleet/pull/9809/files#diff-be9f14d3cee9f345058212985c26b3452688c6d75853a5e9dcb968a69dfcbbd7) and [HostDetailsPage.tsx](https://github.com/fleetdm/fleet/pull/9809/files#diff-72f7403682d211fc8a84a411fc39c4a33c3eb6a33549a33f1179dd7da6a893cc) - [HostSummary.tsx](https://github.com/fleetdm/fleet/pull/9809/files#diff-435e720f1ad82e892bec00fbc9c14e01e9488b776ae293f9158500c66d85bd0d) - [MacSettingsIndicator.tsx](https://github.com/fleetdm/fleet/pull/9809/files#diff-e23079f72b13bd34eb978eded467265dad4f366a6fece60cd52c887f355f92d1) - [MacSettingsModal.tsx](https://github.com/fleetdm/fleet/pull/9809/files#diff-75a08aa5b66cc2b63fc616d8ba012e552376f23d3c3df01d875586857f326f53) - [MacSettingsTable.tsx](https://github.com/fleetdm/fleet/pull/9809/files#diff-5dc441b06f770f112bb32bb618e2140e9bbccb7ebf80d86ee57c2754e067a421) and its associated [MacSettingsTableConfig.tsx](https://github.com/fleetdm/fleet/pull/9809/files#diff-0ab0cb34e249e2a41bf51508d38bea018dc5e683b705308250241c42549ab093) - Currently using mock data. Once #9599 is completed, #9888 will change these components to use the real data - 2/21 - removed mock data. Until the API returns the host.mdm.profiles data, settings indicator and modal will not render # Checklist - [x] Changes file added - [x] Manual QA - [x] Updated testing inventory --------- Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
2023-02-22 16:13:12 +00:00
import { DEFAULT_EMPTY_CELL_VALUE } from "utilities/constants";
import TruncatedTextCell from "components/TableContainer/DataTable/TruncatedTextCell";
import MacSettingStatusCell from "./MacSettingStatusCell";
UI: Add macOS settings (profiles) indicator and modal with data table (#9809) # Addresses #9413 # Implements https://www.loom.com/share/d1b66a3076b94bf2add4fcf8666649a4 - macOS settings indicator on host details and device user pages. Only displayed if (1) the host is enrolled in a Fleet MDM server and (2) the host has at least one setting (profile) enforced. - macOS settings modal, toggled by clicking on above indicator. Contains a data table with the name, status, and error messages, if any, of each enforced macOS setting on the host. # Notes - To aid in reviewing, you'll probably want to focus on: - [DeviceUserPage.tsx](https://github.com/fleetdm/fleet/pull/9809/files#diff-be9f14d3cee9f345058212985c26b3452688c6d75853a5e9dcb968a69dfcbbd7) and [HostDetailsPage.tsx](https://github.com/fleetdm/fleet/pull/9809/files#diff-72f7403682d211fc8a84a411fc39c4a33c3eb6a33549a33f1179dd7da6a893cc) - [HostSummary.tsx](https://github.com/fleetdm/fleet/pull/9809/files#diff-435e720f1ad82e892bec00fbc9c14e01e9488b776ae293f9158500c66d85bd0d) - [MacSettingsIndicator.tsx](https://github.com/fleetdm/fleet/pull/9809/files#diff-e23079f72b13bd34eb978eded467265dad4f366a6fece60cd52c887f355f92d1) - [MacSettingsModal.tsx](https://github.com/fleetdm/fleet/pull/9809/files#diff-75a08aa5b66cc2b63fc616d8ba012e552376f23d3c3df01d875586857f326f53) - [MacSettingsTable.tsx](https://github.com/fleetdm/fleet/pull/9809/files#diff-5dc441b06f770f112bb32bb618e2140e9bbccb7ebf80d86ee57c2754e067a421) and its associated [MacSettingsTableConfig.tsx](https://github.com/fleetdm/fleet/pull/9809/files#diff-0ab0cb34e249e2a41bf51508d38bea018dc5e683b705308250241c42549ab093) - Currently using mock data. Once #9599 is completed, #9888 will change these components to use the real data - 2/21 - removed mock data. Until the API returns the host.mdm.profiles data, settings indicator and modal will not render # Checklist - [x] Changes file added - [x] Manual QA - [x] Updated testing inventory --------- Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
2023-02-22 16:13:12 +00:00
interface IHeaderProps {
column: {
title: string;
isSortedDesc: boolean;
};
}
interface ICellProps {
cell: {
value: string;
};
row: {
original: IHostMacMdmProfile;
};
}
interface IDataColumn {
Header: ((props: IHeaderProps) => JSX.Element) | string;
Cell: (props: ICellProps) => JSX.Element;
id?: string;
title?: string;
accessor?: string;
disableHidden?: boolean;
disableSortBy?: boolean;
sortType?: string;
}
const tableHeaders: IDataColumn[] = [
{
title: "Name",
Header: "Name",
disableSortBy: true,
accessor: "name",
Cell: (cellProps: ICellProps): JSX.Element => (
<TextCell value={cellProps.cell.value} />
),
},
{
title: "Status",
Header: "Status",
disableSortBy: true,
accessor: "statusText",
Cell: (cellProps: ICellProps) => {
return (
<MacSettingStatusCell
status={cellProps.row.original.status}
operationType={cellProps.row.original.operation_type}
/>
);
UI: Add macOS settings (profiles) indicator and modal with data table (#9809) # Addresses #9413 # Implements https://www.loom.com/share/d1b66a3076b94bf2add4fcf8666649a4 - macOS settings indicator on host details and device user pages. Only displayed if (1) the host is enrolled in a Fleet MDM server and (2) the host has at least one setting (profile) enforced. - macOS settings modal, toggled by clicking on above indicator. Contains a data table with the name, status, and error messages, if any, of each enforced macOS setting on the host. # Notes - To aid in reviewing, you'll probably want to focus on: - [DeviceUserPage.tsx](https://github.com/fleetdm/fleet/pull/9809/files#diff-be9f14d3cee9f345058212985c26b3452688c6d75853a5e9dcb968a69dfcbbd7) and [HostDetailsPage.tsx](https://github.com/fleetdm/fleet/pull/9809/files#diff-72f7403682d211fc8a84a411fc39c4a33c3eb6a33549a33f1179dd7da6a893cc) - [HostSummary.tsx](https://github.com/fleetdm/fleet/pull/9809/files#diff-435e720f1ad82e892bec00fbc9c14e01e9488b776ae293f9158500c66d85bd0d) - [MacSettingsIndicator.tsx](https://github.com/fleetdm/fleet/pull/9809/files#diff-e23079f72b13bd34eb978eded467265dad4f366a6fece60cd52c887f355f92d1) - [MacSettingsModal.tsx](https://github.com/fleetdm/fleet/pull/9809/files#diff-75a08aa5b66cc2b63fc616d8ba012e552376f23d3c3df01d875586857f326f53) - [MacSettingsTable.tsx](https://github.com/fleetdm/fleet/pull/9809/files#diff-5dc441b06f770f112bb32bb618e2140e9bbccb7ebf80d86ee57c2754e067a421) and its associated [MacSettingsTableConfig.tsx](https://github.com/fleetdm/fleet/pull/9809/files#diff-0ab0cb34e249e2a41bf51508d38bea018dc5e683b705308250241c42549ab093) - Currently using mock data. Once #9599 is completed, #9888 will change these components to use the real data - 2/21 - removed mock data. Until the API returns the host.mdm.profiles data, settings indicator and modal will not render # Checklist - [x] Changes file added - [x] Manual QA - [x] Updated testing inventory --------- Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
2023-02-22 16:13:12 +00:00
},
},
{
title: "Error",
Header: "Error",
disableSortBy: true,
accessor: "detail",
Cell: (cellProps: ICellProps): JSX.Element => {
const profile = cellProps.row.original;
return (
<TruncatedTextCell
value={
(profile.status === "failed" && profile.detail) ||
DEFAULT_EMPTY_CELL_VALUE
}
/>
);
},
},
];
export default tableHeaders;