import React, { useContext } from "react"; import { AppContext } from "context/app"; import Modal from "components/Modal"; import Button from "components/buttons/Button"; const baseClass = "rerun-script-modal"; interface IRerunScriptModalProps { scriptName: string; scriptId: number; onCancel: () => void; onRerun: (scriptId: number) => void; } const generateMessageSuffix = (isPremiumTier?: boolean, teamId?: number) => { if (!isPremiumTier) { return ""; } return teamId ? " assigned to this team" : " with no team"; }; const RerunScriptModal = ({ scriptName, scriptId, onCancel, onRerun, }: IRerunScriptModalProps) => { const { isPremiumTier, currentTeam } = useContext(AppContext); const messageSuffix = generateMessageSuffix(isPremiumTier, currentTeam?.id); return ( onRerun(scriptId)} > <>

This action will rerun script{" "} {scriptName} on all macOS hosts {messageSuffix}.

This may cause the script to run more than once on some hosts.

); }; export default RerunScriptModal;