fleet/frontend/pages/ManageControlsPage/MacOSUpdates/MacOSUpdates.tsx
Jacob Shandling 4fb958770c
UI: Aggregate mac settings indicators (#10303)
**Addresses** #9415 

**Implements**
<img width="1225" alt="Screenshot 2023-03-03 at 3 29 06 PM"
src="https://user-images.githubusercontent.com/61553566/222854277-5585f6d7-cb4d-4946-881f-01f79bf8342a.png">

**Demo**
https://www.loom.com/share/1cb3dbb9a1194581be89102029b0d6ba

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

- [x] Changes file added for user-visible changes in `changes/` 
- [x] Updated [testing
inventory](https://docs.google.com/spreadsheets/d/1HyKnq7jTk4IJmDHVwU-x9kcH7bgvjDTxohML4hPGfK8/edit#gid=0)
- [x] Manual QA for all new/changed functionality

---------

Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
2023-03-08 11:43:00 -08:00

60 lines
1.7 KiB
TypeScript

import OperatingSystems from "pages/DashboardPage/cards/OperatingSystems";
import useInfoCard from "pages/DashboardPage/components/InfoCard";
import React from "react";
import OsMinVersionForm from "./components/OsMinVersionForm";
import NudgePreview from "./components/NudgePreview";
const baseClass = "mac-os-updates";
interface IMacOSUpdatesProps {
location: {
query: { team_id?: string };
};
}
const MacOSUpdates = ({ location }: IMacOSUpdatesProps) => {
const { team_id } = location.query;
// Avoids possible case where Number(undefined) returns NaN
const teamId = team_id === undefined ? team_id : Number(team_id);
const OperatingSystemCard = useInfoCard({
title: "macOS versions",
children: (
<OperatingSystems
currentTeamId={teamId}
selectedPlatform="darwin"
showTitle
showDescription={false}
includeNameColumn={false}
setShowTitle={() => {
return null;
}}
/>
),
});
return (
<div className={baseClass}>
<p className={`${baseClass}__description`}>
Remotely encourage the installation of macOS updates on hosts assigned
to this team.
</p>
<div className={`${baseClass}__content`}>
<div className={`${baseClass}__form-table-content`}>
<div className={`${baseClass}__os-versions-card`}>
{OperatingSystemCard}
</div>
<div className={`${baseClass}__os-version-form`}>
<OsMinVersionForm currentTeamId={teamId} key={teamId} />
</div>
</div>
<div className={`${baseClass}__nudge-preview`}>
<NudgePreview />
</div>
</div>
</div>
);
};
export default MacOSUpdates;