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() {
- Máy hiện tại được nhận diện là {osLabel}. Lệnh cài Agent và các thao tác cài đặt đã được ẩn. + {isWindows + ? 'Máy hiện tại là Windows. Hãy SSH vào Ubuntu server rồi chạy lệnh bên dưới trong terminal Ubuntu.' + : `Máy hiện tại được nhận diện là ${osLabel}. Lệnh cài Agent và các thao tác cài đặt đã được ẩn.`}
+ {canShowCommand &&{agentCommand}}