import { useState } from 'react' import { Monitor, Loader2, AlertTriangle, ExternalLink } from 'lucide-react' import { remoteDesktopApi } from '../api/client' import type { RemoteSessionInfo } from '../api/types' import { cn } from '../lib/utils' interface RemoteDesktopButtonProps { agentId: string agentHostname: string className?: string } export function RemoteDesktopButton({ agentId, agentHostname, className }: RemoteDesktopButtonProps) { const [loading, setLoading] = useState(false) const [error, setError] = useState(null) const [sessionInfo, setSessionInfo] = useState(null) const [showModal, setShowModal] = useState(false) async function handleClick() { setLoading(true) setError(null) try { const info = await remoteDesktopApi.getSession(agentId) setSessionInfo(info) setShowModal(true) } catch (e) { setError('Remote-Session konnte nicht geladen werden') } finally { setLoading(false) } } function handleConnect() { if (sessionInfo?.sessionUrl) { window.open(sessionInfo.sessionUrl, `rmm-remote-${agentId}`, 'width=1280,height=800,scrollbars=no,toolbar=no,menubar=no') } } return ( <> {/* Modal */} {showModal && (
setShowModal(false)}>
e.stopPropagation()}>

Remote Desktop

{agentHostname}

{/* Status: nicht konfiguriert */} {sessionInfo && !sessionInfo.configured && (

{sessionInfo.message}

MeshCentral läuft unter{' '} {sessionInfo.setupUrl}. Richte MeshCentral ein und setze MeshCentral:Enabled=true in der appsettings.json.

)} {/* Status: Agent nicht installiert */} {sessionInfo?.configured && !sessionInfo.agentInstalled && (

{sessionInfo.message}

Der NexusRMM-Agent installiert MeshAgent automatisch wenn{' '} mesh_enabled: true in der Agent-Config gesetzt ist.

{sessionInfo.meshAgentDownloadUrl && ( )}
)} {/* Status: bereit */} {sessionInfo?.configured && sessionInfo.agentInstalled && (

✓ MeshAgent verbunden

Node ID: {sessionInfo.meshNodeId}

Remote Desktop öffnet sich in einem neuen Fenster. Falls du nach einem Login gefragt wirst, melde dich bei MeshCentral an.

)} {error && (

{error}

)}
)} ) }