mirror of https://github.com/jetkvm/kvm.git
feat: implement FailSafeModeOverlay component with log download and issue reporting functionality
This commit is contained in:
parent
82ad2a467f
commit
5933adb23b
|
|
@ -50,7 +50,7 @@ const blockedMethodsByReason: Record<string, string[]> = {
|
||||||
|
|
||||||
export function useJsonRpc(onRequest?: (payload: JsonRpcRequest) => void) {
|
export function useJsonRpc(onRequest?: (payload: JsonRpcRequest) => void) {
|
||||||
const { rpcDataChannel } = useRTCStore();
|
const { rpcDataChannel } = useRTCStore();
|
||||||
const { isFailsafeMode: isFailsafeMode, reason } = useFailsafeModeStore();
|
const { isFailsafeMode, reason } = useFailsafeModeStore();
|
||||||
|
|
||||||
const send = useCallback(
|
const send = useCallback(
|
||||||
async (method: string, params: unknown, callback?: (resp: JsonRpcResponse) => void) => {
|
async (method: string, params: unknown, callback?: (resp: JsonRpcResponse) => void) => {
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,9 @@ import { Button } from "@components/Button";
|
||||||
import LoadingSpinner from "../components/LoadingSpinner";
|
import LoadingSpinner from "../components/LoadingSpinner";
|
||||||
import { useDeviceUiNavigation } from "../hooks/useAppNavigation";
|
import { useDeviceUiNavigation } from "../hooks/useAppNavigation";
|
||||||
|
|
||||||
|
// Time to wait after initiating reboot before redirecting to home
|
||||||
|
const REBOOT_REDIRECT_DELAY_MS = 5000;
|
||||||
|
|
||||||
export default function SettingsGeneralRebootRoute() {
|
export default function SettingsGeneralRebootRoute() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { send } = useJsonRpc();
|
const { send } = useJsonRpc();
|
||||||
|
|
@ -18,7 +21,7 @@ export default function SettingsGeneralRebootRoute() {
|
||||||
// This is where we send the RPC to the golang binary
|
// This is where we send the RPC to the golang binary
|
||||||
send("reboot", { force: true });
|
send("reboot", { force: true });
|
||||||
|
|
||||||
await new Promise(resolve => setTimeout(resolve, 5000));
|
await new Promise(resolve => setTimeout(resolve, REBOOT_REDIRECT_DELAY_MS));
|
||||||
navigateTo("/");
|
navigateTo("/");
|
||||||
}, [navigateTo, send]);
|
}, [navigateTo, send]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,7 @@ export default function SettingsRoute() {
|
||||||
</div>
|
</div>
|
||||||
</FeatureFlag>
|
</FeatureFlag>
|
||||||
<div className={cx("shrink-0", {
|
<div className={cx("shrink-0", {
|
||||||
"opacity-50 cursor-not-allowed!": isVideoDisabled
|
"opacity-50 cursor-not-allowed": isVideoDisabled
|
||||||
})}>
|
})}>
|
||||||
<NavLink
|
<NavLink
|
||||||
to="video"
|
to="video"
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ const ConnectionStatsSidebar = lazy(() => import('@/components/sidebar/connectio
|
||||||
const Terminal = lazy(() => import('@components/Terminal'));
|
const Terminal = lazy(() => import('@components/Terminal'));
|
||||||
const UpdateInProgressStatusCard = lazy(() => import("@/components/UpdateInProgressStatusCard"));
|
const UpdateInProgressStatusCard = lazy(() => import("@/components/UpdateInProgressStatusCard"));
|
||||||
import Modal from "@/components/Modal";
|
import Modal from "@/components/Modal";
|
||||||
import { FailSafeModeOverlay } from "@components/FaileSafeModeOverlay";
|
import { FailSafeModeOverlay } from "@components/FailSafeModeOverlay";
|
||||||
import { JsonRpcRequest, JsonRpcResponse, RpcMethodNotFound, useJsonRpc } from "@/hooks/useJsonRpc";
|
import { JsonRpcRequest, JsonRpcResponse, RpcMethodNotFound, useJsonRpc } from "@/hooks/useJsonRpc";
|
||||||
import {
|
import {
|
||||||
ConnectionFailedOverlay,
|
ConnectionFailedOverlay,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue