mirror of
https://github.com/fleetdm/fleet
synced 2026-04-22 05:57:36 +00:00
<!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #36754 # 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] QA'd all new/changed functionality manually Screenshots: <img width="849" height="394" alt="Screenshot 2025-12-15 at 18 03 06" src="https://github.com/user-attachments/assets/054d0d99-59b7-4664-b682-fb68a5cccad8" /> <img width="882" height="421" alt="Screenshot 2025-12-15 at 18 02 42" src="https://github.com/user-attachments/assets/87ac021e-d88a-4cbf-8b46-8f674d838d3c" />
55 lines
1.3 KiB
TypeScript
55 lines
1.3 KiB
TypeScript
import React, { useContext } from "react";
|
|
|
|
import CustomLink from "components/CustomLink";
|
|
import PATHS from "router/paths";
|
|
import { AppContext } from "context/app";
|
|
|
|
// @ts-ignore
|
|
import InputField from "components/forms/fields/InputField";
|
|
|
|
const generateUrl = (serverUrl: string, enrollSecret: string) => {
|
|
return `${serverUrl}/enroll?enroll_secret=${encodeURIComponent(
|
|
enrollSecret
|
|
)}`;
|
|
};
|
|
|
|
const baseClass = "android-panel";
|
|
|
|
interface IAndroidPanelProps {
|
|
enrollSecret: string;
|
|
}
|
|
|
|
const AndroidPanel = ({ enrollSecret }: IAndroidPanelProps) => {
|
|
const { config, isAndroidMdmEnabledAndConfigured } = useContext(AppContext);
|
|
|
|
if (!config) return null;
|
|
|
|
if (!isAndroidMdmEnabledAndConfigured) {
|
|
return (
|
|
<p>
|
|
<CustomLink
|
|
url={PATHS.ADMIN_INTEGRATIONS_MDM_ANDROID}
|
|
text="Turn on Android MDM"
|
|
/>{" "}
|
|
to enroll Android hosts.
|
|
</p>
|
|
);
|
|
}
|
|
|
|
const url = generateUrl(config.server_settings.server_url, enrollSecret);
|
|
|
|
return (
|
|
<div className={baseClass}>
|
|
<InputField
|
|
label="Send this to your end users:"
|
|
enableCopy
|
|
readOnly
|
|
inputWrapperClass={`${baseClass}__enroll-link`}
|
|
name="enroll-link"
|
|
value={url}
|
|
/>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default AndroidPanel;
|