import { Alert } from "@mui/material"; import React, { PropsWithChildren } from "react"; import { NetworkHookStatus, ServerApi } from "../../api/ServerApi"; import { AsyncWidget } from "../AsyncWidget"; import { CopyToClipboard } from "../CopyToClipboard"; import { InlineCode } from "../InlineCode"; export function NetworkHookStatusWidget(p: { hiddenIfInstalled: boolean; }): React.ReactElement { const [status, setStatus] = React.useState(); const load = async () => { setStatus(await ServerApi.NetworkHookStatus()); }; return ( } /> ); } function NetworkHookStatusWidgetInner(p: { status: NetworkHookStatus; hiddenIfInstalled: boolean; }): React.ReactElement { if (p.status.installed && p.hiddenIfInstalled) return <>; if (p.status.installed) return ( The network hook has been installed on this system. ); const makeExecutable = `chmod +x ${p.status.path}`; return ( The network hook has not been detected on this system. It must be installed in order to expose ports from virtual machines through NAT on the network.

In order to install it, please create a file named   {p.status.path}   with the following content:
{p.status.content}
Make sure that the created file is executable :
{makeExecutable}
You will need then to restart both libvirtd and VirtWeb.
); } function CodeBlock(p: PropsWithChildren): React.ReactElement { return (
      {p.children}
    
); }