mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-02 01:05:20 +03:00
Improve restart from UI
This commit is contained in:
parent
9954e1fb07
commit
b9169232ae
@ -12,7 +12,7 @@ import { useCallback, useRef, useState } from 'preact/hooks';
|
|||||||
|
|
||||||
export default function AppBar() {
|
export default function AppBar() {
|
||||||
const [showMoreMenu, setShowMoreMenu] = useState(false);
|
const [showMoreMenu, setShowMoreMenu] = useState(false);
|
||||||
const [showDialogRestart, setShowDialogRestart] = useState(false);
|
const [showDialogRestart, setShowDialogRestart] = useState(0);
|
||||||
const { setDarkMode } = useDarkMode();
|
const { setDarkMode } = useDarkMode();
|
||||||
|
|
||||||
const handleSelectDarkMode = useCallback(
|
const handleSelectDarkMode = useCallback(
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import { useCallback, useEffect, useState } from 'preact/hooks';
|
|||||||
import { useRestart } from '../api/mqtt';
|
import { useRestart } from '../api/mqtt';
|
||||||
|
|
||||||
export default function DialogRestart({ show, setShow }) {
|
export default function DialogRestart({ show, setShow }) {
|
||||||
|
const { payload: restartedMessage = null, send: sendRestart } = useRestart();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (show === 2) {
|
if (show === 2) {
|
||||||
@ -11,12 +12,12 @@ export default function DialogRestart({ show, setShow }) {
|
|||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
const delay = (ms) => new Promise(res => setTimeout(res, ms));
|
const delay = (ms) => new Promise(res => setTimeout(res, ms));
|
||||||
|
|
||||||
while (show === 2) {
|
/* eslint-disable no-constant-condition */
|
||||||
|
while (true) {
|
||||||
try {
|
try {
|
||||||
const response = await fetch('/api/config', { method: 'GET' });
|
const response = await fetch('/api/config', { method: 'GET' });
|
||||||
if (await response.status === 200) {
|
if (await response.status === 200) {
|
||||||
setShow(0);
|
break;;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (e) {}
|
catch (e) {}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user