diff --git a/web-client/src/main.jsx b/web-client/src/main.jsx index f91466f..778fd28 100644 --- a/web-client/src/main.jsx +++ b/web-client/src/main.jsx @@ -196,6 +196,8 @@ function App() { const agentCommand = latestAgentPackage?.installCommand || installCommand; const clientOs = useMemo(() => detectClientOs(), []); const isClientLinux = clientOs === 'linux'; + const isClientWindows = clientOs === 'windows'; + const canShowAgentCommand = isClientLinux || isClientWindows; const clientOsLabel = getClientOsLabel(clientOs); const installedByAppId = useMemo(() => { @@ -288,7 +290,9 @@ function App() { setInstalledApps([]); setAgentStatus({ state: 'warning', - message: `Current client is ${clientOsLabel}. Web Client only supports Linux.` + message: isClientWindows + ? 'Windows detected. Copy the Agent command and run it in Ubuntu SSH.' + : `Current client is ${clientOsLabel}. Web Client only supports Linux.` }); return false; } @@ -313,7 +317,7 @@ function App() { setAgentStatus({ state: 'danger', message: getErrorMessage(error) }); return false; } - }, [agentBaseUrl, clientOsLabel, isClientLinux]); + }, [agentBaseUrl, clientOsLabel, isClientLinux, isClientWindows]); const refreshAll = useCallback(async () => { await Promise.all([refreshPackage(), refreshAgent()]); @@ -497,7 +501,7 @@ function App() { }, [draftSettings, notify]); const copyInstallCommand = useCallback(async () => { - if (!isClientLinux) { + if (!canShowAgentCommand) { notify('warning', 'Lệnh cài Agent chỉ hiển thị trên máy Linux.'); return; } @@ -519,7 +523,7 @@ function App() { } catch { notify('warning', 'Không thể copy tự động trong browser này'); } - }, [agentCommand, agentNeedsUpdate, isClientLinux, notify]); + }, [agentCommand, agentNeedsUpdate, canShowAgentCommand, notify]); useEffect(() => { refreshAll(); @@ -603,8 +607,8 @@ function App() {
Runtime
${latestAgentPackage.version}` : ''}` : '127.0.0.1:5010')} + title={!isClientLinux ? (isClientWindows ? 'SSH install mode' : 'Linux client required') : (agentNeedsUpdate ? 'Agent update available' : (agentHealth ? 'Agent online' : 'Agent offline'))} + detail={!isClientLinux ? (isClientWindows ? 'Windows detected · run command on Ubuntu SSH' : `${clientOsLabel} detected`) : (agentHealth ? `${agentHealth.hostname || 'localhost'} · ${agentHealth.agentVersion || '-'}${agentNeedsUpdate ? ` -> ${latestAgentPackage.version}` : ''}` : '127.0.0.1:5010')} tone={!isClientLinux ? 'warning' : (agentNeedsUpdate ? 'warning' : (agentHealth ? 'success' : 'danger'))} />
robot.installer - {!isClientLinux ? 'Linux client required' : (agentHealth ? 'Ready for install' : 'Waiting for Agent')} + {!isClientLinux ? (isClientWindows ? 'Copy command for Ubuntu SSH' : 'Linux client required') : (agentHealth ? 'Ready for install' : 'Waiting for Agent')}
@@ -655,16 +659,18 @@ function App() {

Application catalog

Released apps từ package server và trạng thái cài đặt trên máy local.

- {isClientLinux && ( + {canShowAgentCommand && (
- - + {isClientLinux && ( + + + )}
)} @@ -677,7 +683,13 @@ function App() { {!isClientLinux && ( - + )} {isClientLinux && !agentHealth && ( @@ -990,16 +1002,25 @@ function MetricCard({ label, value, note, tone }) { ); } -function ClientOsNotice({ osLabel }) { +function ClientOsNotice({ agentCommand, canShowCommand, isWindows, onCopyCommand, osLabel }) { return ( -
+
); } diff --git a/web-client/src/styles.css b/web-client/src/styles.css index 2c24fb6..39b73b7 100644 --- a/web-client/src/styles.css +++ b/web-client/src/styles.css @@ -551,6 +551,10 @@ code { grid-template-columns: auto minmax(0, 1fr); } +.client-os-banner.command-visible { + grid-template-columns: auto minmax(0, 1fr) auto; +} + .offline-banner strong { color: #111827; display: block;