Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ const AppleMdmPage = ({ router }: { router: InjectedRouter }) => {
)}
{showTurnOffMdmModal && (
<TurnOffAppleMdmModal
serverUrl={getMdmServerUrl(config.server_settings)}
onCancel={toggleTurnOffMdmModal}
onConfirm={turnOffMdm}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
import React, { useCallback, useState } from "react";

import Button from "components/buttons/Button";

import InputField from "components/forms/fields/InputField";
import Modal from "components/Modal";

const baseClass = "modal turn-off-apple-mdm-modal";
const bemClass = "turn-off-apple-mdm-modal";

interface ITurnOffAppleMdmModalProps {
serverUrl: string;
onCancel: () => void;
onConfirm: () => void;
}

const TurnOffAppleMdmModal = ({
serverUrl,
onConfirm,
onCancel,
}: ITurnOffAppleMdmModalProps): JSX.Element => {
const [isDeleting, setIsDeleting] = useState(false);
const [enteredUrl, setEnteredUrl] = useState("");

const onClickConfirm = useCallback(() => {
setIsDeleting(true);
Expand All @@ -25,16 +29,28 @@ const TurnOffAppleMdmModal = ({
return (
<Modal title="Turn off MDM" onExit={onCancel} className={baseClass}>
<div className={baseClass}>
If you want to use MDM features again, you&apos;ll have to upload a new
APNs certificate and all end users will have to turn MDM off and back
on.
<p>
If you want to use MDM features again, you&apos;ll have to upload a
new APNs certificate and all end users will have to turn MDM off and
back on.
</p>
<p>
To confirm, enter your Fleet URL: <b>{serverUrl}</b>
</p>
<InputField
autofocus
inputWrapperClass={`${bemClass}__url-input`}
placeholder="https://fleet.example.com"
value={enteredUrl}
onChange={(val: string) => setEnteredUrl(val)}
/>
<div className="modal-cta-wrap">
<Button
type="button"
variant="alert"
onClick={onClickConfirm}
isLoading={isDeleting}
disabled={isDeleting}
disabled={isDeleting || enteredUrl !== serverUrl}
>
Turn off
</Button>
Expand Down
Loading