import { useRef } from 'react'; import { useDisclosure } from '@mantine/hooks'; import Button from '../../../../common/components/buttons/Button'; import Dialog from '../../../../common/components/dialog/Dialog'; import { useElectronEvent } from '../../../../common/hooks/useElectronEvent'; import { isLocalhost, isOntimeCloud } from '../../../../externals'; import * as Panel from '../../panel-utils/PanelUtils'; export default function ShutdownPanel() { const { isElectron, sendToElectron } = useElectronEvent(); const [isOpen, handler] = useDisclosure(); const cancelRef = useRef(null); const sendShutdown = () => { sendToElectron('shutdown', 'now'); handler.close(); }; const canShutdown = isElectron || isLocalhost; return ( <> Shutdown Ontime {isOntimeCloud ? ( For security reasons, shutting down the server must be done from the Ontime Cloud dashboard. ) : ( This will shutdown the Ontime server.
The runtime state will be lost, but your project is kept for next time.
)} {!canShutdown && ( Note: Ontime can only be shutdown from the machine it is running in. )} This will shutdown the Ontime server.
Are you sure? } footerElements={ <> } />
); }