mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 19:01:39 -04:00
Delaying reboot/shutdown with asyncio sleep to give API time to shut down.
This commit is contained in:
parent
5ffb8bee8d
commit
4cc00a9cb1
9 changed files with 71 additions and 49 deletions
|
|
@ -32,6 +32,14 @@ function handleEvents(events) {
|
|||
eventToast('Refresh completed', 'Files have been refreshed.');
|
||||
}
|
||||
|
||||
if (event === 'shutdown') {
|
||||
eventToast('Shutdown', message, 'warning');
|
||||
}
|
||||
|
||||
if (event === 'shutdown_failed') {
|
||||
eventToast('Shutdown Failed', message, 'error');
|
||||
}
|
||||
|
||||
if (event === 'downloads_disabled') {
|
||||
eventToast('Downloads Disabled', message, 'info');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,13 @@ export function ShutdownButton() {
|
|||
time: 5000,
|
||||
type: "error",
|
||||
})
|
||||
} else if (response && response['code'] === 'NATIVE_ONLY') {
|
||||
toast({
|
||||
title: 'Shutdown Failed',
|
||||
description: 'Cannot shutdown while running in Docker',
|
||||
time: 5000,
|
||||
type: "error",
|
||||
})
|
||||
} else if (response !== null) {
|
||||
toast({
|
||||
title: 'Shutdown Failed',
|
||||
|
|
@ -58,13 +65,20 @@ export function RestartButton() {
|
|||
const handleRestart = async () => {
|
||||
try {
|
||||
const response = await postRestart();
|
||||
if (response && response['code'] === 'RESTART_FAILED') {
|
||||
if (response && response['code'] === 'SHUTDOWN_FAILED') {
|
||||
toast({
|
||||
title: 'Restart Failed',
|
||||
description: response['error'],
|
||||
time: 5000,
|
||||
type: "error",
|
||||
})
|
||||
} else if (response && response['code'] === 'NATIVE_ONLY') {
|
||||
toast({
|
||||
title: 'Restart Failed',
|
||||
description: 'Cannot restart while running in Docker',
|
||||
time: 5000,
|
||||
type: "error",
|
||||
})
|
||||
} else if (response !== null) {
|
||||
toast({
|
||||
title: 'Restart Failed',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue