mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-02 01:05:20 +03:00
improved user experience
This commit is contained in:
parent
6471b5b433
commit
48700a4051
@ -4,18 +4,16 @@ import Dialog from './Dialog';
|
|||||||
import { useApiHost } from '../api';
|
import { useApiHost } from '../api';
|
||||||
import { useRestart } from '../api/mqtt';
|
import { useRestart } from '../api/mqtt';
|
||||||
|
|
||||||
export default function DialogRestart({ showDialog, setShowDialog }) {
|
export default function DialogRestart({ show, setShow }) {
|
||||||
const apiHost = useApiHost();
|
const apiHost = useApiHost();
|
||||||
const { payload: detectRestarted = null, send: sendRestart } = useRestart();
|
const { payload: detectRestarted = null, send: sendRestart } = useRestart();
|
||||||
const [dialogTitle, setDialogTitle] = useState("Restart in progress");
|
const [dialogTitle, setDialogTitle] = useState('Restart in progress');
|
||||||
const [showDialogWait, setShowDialogWait] = useState(false);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (detectRestarted != null && Number.isInteger(detectRestarted)) {
|
if (detectRestarted != null && Number.isInteger(detectRestarted)) {
|
||||||
if (!detectRestarted)
|
if (!detectRestarted)
|
||||||
setDialogTitle("Server-initiated startup");
|
setDialogTitle('Server-initiated startup');
|
||||||
setShowDialog(false);
|
setShow(false);
|
||||||
setShowDialogWait(true);
|
|
||||||
}
|
}
|
||||||
}, [detectRestarted]);
|
}, [detectRestarted]);
|
||||||
|
|
||||||
@ -35,18 +33,17 @@ export default function DialogRestart({ showDialog, setShowDialog }) {
|
|||||||
|
|
||||||
const handleClick = useCallback(() => {
|
const handleClick = useCallback(() => {
|
||||||
sendRestart();
|
sendRestart();
|
||||||
setShowDialog(false);
|
setShow(false);
|
||||||
waitPlease();
|
waitPlease();
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleDismiss = useCallback(() => {
|
const handleDismiss = useCallback(() => {
|
||||||
setShowDialog(false);
|
setShow(false);
|
||||||
setShowDialogWait(false);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
{showDialog ? (
|
{show ? (
|
||||||
<Dialog
|
<Dialog
|
||||||
onDismiss={handleDismiss}
|
onDismiss={handleDismiss}
|
||||||
title="Restart Frigate"
|
title="Restart Frigate"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user