Add ability to restart

This commit is contained in:
ElMoribond 2021-06-21 09:34:59 +02:00 committed by GitHub
parent 42d268c869
commit 221b4960dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,6 +14,7 @@ import { useRestart } from './api/mqtt';
export default function AppBar() {
const [showMoreMenu, setShowMoreMenu] = useState(false);
const [showDialog, setShowDialog] = useState(false);
const [showDialogWait, setShowDialogWait] = useState(false);
const { setDarkMode } = useDarkMode();
const { send: sendRestart } = useRestart();
@ -37,6 +38,7 @@ export default function AppBar() {
const handleClickRestartDialog = useCallback(() => {
setShowDialog(false);
setShowDialogWait(true);
sendRestart();
}, [setShowDialog]);
@ -72,6 +74,12 @@ export default function AppBar() {
{ text: 'Cancel', onClick: handleDismissRestartDialog },
]}
/>
) : null},
{showDialogWait ? (
<Dialog
title="Restart in progress"
text="Please wait a few seconds for the restart to complete before reloading the page."
/>
) : null}
</Fragment>
);