mirror of https://github.com/jetkvm/kvm.git
Compare commits
5 Commits
bbbea61723
...
8406a35e70
| Author | SHA1 | Date |
|---|---|---|
|
|
8406a35e70 | |
|
|
d8e3140fc9 | |
|
|
b70199cc72 | |
|
|
4def3e636e | |
|
|
029a78e245 |
|
|
@ -929,13 +929,12 @@ export const useMacrosStore = create<MacrosState>((set, get) => ({
|
||||||
|
|
||||||
export interface FailsafeModeState {
|
export interface FailsafeModeState {
|
||||||
isFailsafeMode: boolean;
|
isFailsafeMode: boolean;
|
||||||
reason: string | null; // "video", "network", etc.
|
reason: string; // "video", "network", etc.
|
||||||
setFailsafeMode: (active: boolean, reason: string | null) => void;
|
setFailsafeMode: (active: boolean, reason: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useFailsafeModeStore = create<FailsafeModeState>(set => ({
|
export const useFailsafeModeStore = create<FailsafeModeState>(set => ({
|
||||||
isFailsafeMode: false,
|
isFailsafeMode: false,
|
||||||
reason: null,
|
reason: "",
|
||||||
setFailsafeMode: (active: boolean, reason: string | null) =>
|
setFailsafeMode: (active, reason) => set({ isFailsafeMode: active, reason }),
|
||||||
set({ isFailsafeMode: active, reason }),
|
|
||||||
}));
|
}));
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import { useCallback, useState } from "react";
|
||||||
|
|
||||||
import { useJsonRpc } from "@/hooks/useJsonRpc";
|
import { useJsonRpc } from "@/hooks/useJsonRpc";
|
||||||
import { Button } from "@components/Button";
|
import { Button } from "@components/Button";
|
||||||
|
import { useFailsafeModeStore } from "@/hooks/stores";
|
||||||
|
|
||||||
import LoadingSpinner from "../components/LoadingSpinner";
|
import LoadingSpinner from "../components/LoadingSpinner";
|
||||||
import { useDeviceUiNavigation } from "../hooks/useAppNavigation";
|
import { useDeviceUiNavigation } from "../hooks/useAppNavigation";
|
||||||
|
|
@ -15,6 +16,7 @@ export default function SettingsGeneralRebootRoute() {
|
||||||
const { send } = useJsonRpc();
|
const { send } = useJsonRpc();
|
||||||
const [isRebooting, setIsRebooting] = useState(false);
|
const [isRebooting, setIsRebooting] = useState(false);
|
||||||
const { navigateTo } = useDeviceUiNavigation();
|
const { navigateTo } = useDeviceUiNavigation();
|
||||||
|
const { setFailsafeMode } = useFailsafeModeStore();
|
||||||
|
|
||||||
const onConfirmUpdate = useCallback(async () => {
|
const onConfirmUpdate = useCallback(async () => {
|
||||||
setIsRebooting(true);
|
setIsRebooting(true);
|
||||||
|
|
@ -22,8 +24,9 @@ export default function SettingsGeneralRebootRoute() {
|
||||||
send("reboot", { force: true });
|
send("reboot", { force: true });
|
||||||
|
|
||||||
await new Promise(resolve => setTimeout(resolve, REBOOT_REDIRECT_DELAY_MS));
|
await new Promise(resolve => setTimeout(resolve, REBOOT_REDIRECT_DELAY_MS));
|
||||||
|
setFailsafeMode(false, "");
|
||||||
navigateTo("/");
|
navigateTo("/");
|
||||||
}, [navigateTo, send]);
|
}, [navigateTo, send, setFailsafeMode]);
|
||||||
|
|
||||||
{
|
{
|
||||||
/* TODO: Migrate to using URLs instead of the global state. To simplify the refactoring, we'll keep the global state for now. */
|
/* TODO: Migrate to using URLs instead of the global state. To simplify the refactoring, we'll keep the global state for now. */
|
||||||
|
|
|
||||||
|
|
@ -853,7 +853,7 @@ export default function KvmIdRoute() {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div className="relative flex h-full w-full overflow-hidden">
|
<div className="relative flex h-full w-full overflow-hidden">
|
||||||
{!isFailsafeMode && failsafeReason === "video" && <WebRTCVideo />}
|
{(isFailsafeMode && failsafeReason === "video") ? null : <WebRTCVideo />}
|
||||||
<div
|
<div
|
||||||
style={{ animationDuration: "500ms" }}
|
style={{ animationDuration: "500ms" }}
|
||||||
className="animate-slideUpFade pointer-events-none absolute inset-0 flex items-center justify-center p-4"
|
className="animate-slideUpFade pointer-events-none absolute inset-0 flex items-center justify-center p-4"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue