refactor(i18n): U16 AgentWizard i18n 治理 — 29 个 agentwizardtsx.* hash 乱码键清理为 agent.wizard.* 语义化键 + 组件从 i18n.t() 全局改为 useTranslation() hook + 8 处硬编码中文 UI 文案清零. zh/en 7564=7564 对齐, tsc -b=0, npm build✓, ESLint=0/66/0, 17/17 测试通过
This commit is contained in:
1 parent
f178609d09
commit
a85e063a47
3 files changed
+113
-96
No files matched your search
@@ -1,4 +1,5 @@
|
|||||||
import { useState, useEffect } from 'react';
|
import { useState, useEffect } from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useUserStore } from '@/store';
|
import { useUserStore } from '@/store';
|
||||||
import {
|
import {
|
||||||
Dialog,
|
Dialog,
|
||||||
@@ -14,7 +15,6 @@ import { Label } from '@/components/ui/label';
|
|||||||
import { Copy, Check, Terminal, Download, Settings, Play, Cpu, Zap, Loader2, Server, Shield } from 'lucide-react';
|
import { Copy, Check, Terminal, Download, Settings, Play, Cpu, Zap, Loader2, Server, Shield } from 'lucide-react';
|
||||||
import { serverApi } from '@/api';
|
import { serverApi } from '@/api';
|
||||||
import { toast } from 'sonner';
|
import { toast } from 'sonner';
|
||||||
import i18n from '@/i18n';
|
|
||||||
|
|
||||||
interface AgentWizardProps {
|
interface AgentWizardProps {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
@@ -41,6 +41,7 @@ function detectServerAddress() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function AgentWizard({ open, onOpenChange, server, onStart, onInstalled, onFailed }: AgentWizardProps) {
|
export function AgentWizard({ open, onOpenChange, server, onStart, onInstalled, onFailed }: AgentWizardProps) {
|
||||||
|
const { t } = useTranslation();
|
||||||
const token = useUserStore((s) => s.token) || '<YOUR_TOKEN>';
|
const token = useUserStore((s) => s.token) || '<YOUR_TOKEN>';
|
||||||
const origin = detectServerAddress();
|
const origin = detectServerAddress();
|
||||||
const isWindowsServer = Boolean(server?.os && server.os.toLowerCase().includes('windows'));
|
const isWindowsServer = Boolean(server?.os && server.os.toLowerCase().includes('windows'));
|
||||||
@@ -108,10 +109,10 @@ export function AgentWizard({ open, onOpenChange, server, onStart, onInstalled,
|
|||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
setCopied(true);
|
setCopied(true);
|
||||||
toast.success(i18n.t('agent.agentwizardtsx.s19ee0048'));
|
toast.success(t('agent.wizard.copySuccess'));
|
||||||
setTimeout(() => setCopied(false), 3000);
|
setTimeout(() => setCopied(false), 3000);
|
||||||
} else {
|
} else {
|
||||||
toast.error(i18n.t('agent.agentwizardtsx.s7ac41b1c'));
|
toast.error(t('agent.wizard.copyFailed'));
|
||||||
setShowManualInput(true);
|
setShowManualInput(true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -122,19 +123,19 @@ export function AgentWizard({ open, onOpenChange, server, onStart, onInstalled,
|
|||||||
const manualSteps = [
|
const manualSteps = [
|
||||||
{
|
{
|
||||||
icon: Download,
|
icon: Download,
|
||||||
title: i18n.t('agent.agentwizardtsx.s8c59e054'),
|
title: t('agent.wizard.stepDownload'),
|
||||||
commands: [
|
commands: [
|
||||||
`curl -fsSL ${binaryUrl} -o /usr/local/bin/aiops-agent`,
|
`curl -fsSL ${binaryUrl} -o /usr/local/bin/aiops-agent`,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: Settings,
|
icon: Settings,
|
||||||
title: i18n.t('agent.agentwizardtsx.s2f17bf61'),
|
title: t('agent.wizard.stepChmod'),
|
||||||
commands: ['chmod +x /usr/local/bin/aiops-agent'],
|
commands: ['chmod +x /usr/local/bin/aiops-agent'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: Cpu,
|
icon: Cpu,
|
||||||
title: i18n.t('agent.agentwizardtsx.s03fa0002'),
|
title: t('agent.wizard.stepService'),
|
||||||
commands: [
|
commands: [
|
||||||
`cat > /etc/systemd/system/aiops-agent.service << 'EOF'`,
|
`cat > /etc/systemd/system/aiops-agent.service << 'EOF'`,
|
||||||
`[Unit]`,
|
`[Unit]`,
|
||||||
@@ -154,7 +155,7 @@ export function AgentWizard({ open, onOpenChange, server, onStart, onInstalled,
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: Play,
|
icon: Play,
|
||||||
title: i18n.t('agent.agentwizardtsx.s84bd81f4'),
|
title: t('agent.wizard.stepStart'),
|
||||||
commands: [
|
commands: [
|
||||||
'systemctl daemon-reload',
|
'systemctl daemon-reload',
|
||||||
'systemctl enable --now aiops-agent',
|
'systemctl enable --now aiops-agent',
|
||||||
@@ -165,7 +166,7 @@ export function AgentWizard({ open, onOpenChange, server, onStart, onInstalled,
|
|||||||
const windowsManualSteps = [
|
const windowsManualSteps = [
|
||||||
{
|
{
|
||||||
icon: Download,
|
icon: Download,
|
||||||
title: '下载 Windows Agent',
|
title: t('agent.wizard.stepDownloadWindows'),
|
||||||
commands: [
|
commands: [
|
||||||
`New-Item -ItemType Directory -Force "C:\\Program Files\\AIOps"`,
|
`New-Item -ItemType Directory -Force "C:\\Program Files\\AIOps"`,
|
||||||
`Invoke-WebRequest -Uri ${windowsBinaryUrl} -OutFile "C:\\Program Files\\AIOps\\aiops-agent.exe" -UseBasicParsing`,
|
`Invoke-WebRequest -Uri ${windowsBinaryUrl} -OutFile "C:\\Program Files\\AIOps\\aiops-agent.exe" -UseBasicParsing`,
|
||||||
@@ -173,14 +174,14 @@ export function AgentWizard({ open, onOpenChange, server, onStart, onInstalled,
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: Cpu,
|
icon: Cpu,
|
||||||
title: '注册 Windows 服务',
|
title: t('agent.wizard.stepRegisterWindows'),
|
||||||
commands: [
|
commands: [
|
||||||
`New-Service -Name AIOpsAgent -DisplayName "AIOps Agent" -BinaryPathName '"C:\\Program Files\\AIOps\\aiops-agent.exe" -server ${origin} -interval 10 -token ${token}' -StartupType Automatic`,
|
`New-Service -Name AIOpsAgent -DisplayName "AIOps Agent" -BinaryPathName '"C:\\Program Files\\AIOps\\aiops-agent.exe" -server ${origin} -interval 10 -token ${token}' -StartupType Automatic`,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: Play,
|
icon: Play,
|
||||||
title: '启动并检查',
|
title: t('agent.wizard.stepStartCheck'),
|
||||||
commands: [
|
commands: [
|
||||||
'Start-Service AIOpsAgent',
|
'Start-Service AIOpsAgent',
|
||||||
'Get-Service AIOpsAgent',
|
'Get-Service AIOpsAgent',
|
||||||
@@ -193,11 +194,11 @@ export function AgentWizard({ open, onOpenChange, server, onStart, onInstalled,
|
|||||||
const handleSshInstall = async () => {
|
const handleSshInstall = async () => {
|
||||||
if (!server || !token) return;
|
if (!server || !token) return;
|
||||||
if (isWindowsServer) {
|
if (isWindowsServer) {
|
||||||
toast.error('Windows Agent 请使用 PowerShell 安装命令,SSH 一键安装仅支持 Linux/macOS');
|
toast.error(t('agent.wizard.windowsSSHNotSupported'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (needsCreds && !sshPassword && !sshKey) {
|
if (needsCreds && !sshPassword && !sshKey) {
|
||||||
toast.error(i18n.t('agent.agentwizardtsx.s6cfe961c'));
|
toast.error(t('agent.wizard.credsRequired'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setSshInstalling(true);
|
setSshInstalling(true);
|
||||||
@@ -216,11 +217,11 @@ export function AgentWizard({ open, onOpenChange, server, onStart, onInstalled,
|
|||||||
: undefined;
|
: undefined;
|
||||||
// 优先尝试异步批量接口,即使单台也后台执行
|
// 优先尝试异步批量接口,即使单台也后台执行
|
||||||
await serverApi.batchInstallAgent([server.id], token, credentials);
|
await serverApi.batchInstallAgent([server.id], token, credentials);
|
||||||
toast.success(`${server.hostname}: 已提交 Agent 安装任务,后台执行中…`);
|
toast.success(t('agent.wizard.installSubmitted', { hostname: server.hostname }));
|
||||||
onInstalled?.(server.id);
|
onInstalled?.(server.id);
|
||||||
onOpenChange(false);
|
onOpenChange(false);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const msg = e?.message || i18n.t('agent.installFailed');
|
const msg = e instanceof Error ? e.message : String(e);
|
||||||
toast.error(`${server.hostname} ${msg}`);
|
toast.error(`${server.hostname} ${msg}`);
|
||||||
onFailed?.(server.id, msg);
|
onFailed?.(server.id, msg);
|
||||||
} finally {
|
} finally {
|
||||||
@@ -233,12 +234,12 @@ export function AgentWizard({ open, onOpenChange, server, onStart, onInstalled,
|
|||||||
<DialogContent className="max-w-2xl dg-card text-[var(--dg-text-primary)]">
|
<DialogContent className="max-w-2xl dg-card text-[var(--dg-text-primary)]">
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle className="text-[var(--dg-text-primary)]">
|
<DialogTitle className="text-[var(--dg-text-primary)]">
|
||||||
{server ? `部署 Agent → ${server.hostname}` : i18n.t('agent.agentwizardtsx.s812cc1a5')}
|
{server ? t('agent.wizard.titleWithHost', { hostname: server.hostname }) : t('agent.wizard.title')}
|
||||||
</DialogTitle>
|
</DialogTitle>
|
||||||
<DialogDescription className="dg-text-secondary">
|
<DialogDescription className="dg-text-secondary">
|
||||||
{server
|
{server
|
||||||
? `目标主机 ${server.hostname} (${server.ip}),选择安装方式:`
|
? t('agent.wizard.descWithHost', { hostname: server.hostname, ip: server.ip })
|
||||||
: i18n.t('agent.agentwizardtsx.sed0c1b63')
|
: t('agent.wizard.desc')
|
||||||
}
|
}
|
||||||
</DialogDescription>
|
</DialogDescription>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
@@ -247,29 +248,29 @@ export function AgentWizard({ open, onOpenChange, server, onStart, onInstalled,
|
|||||||
<TabsList className="bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)]">
|
<TabsList className="bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)]">
|
||||||
<TabsTrigger value="auto" className="data-[state=active]:bg-[var(--dg-bg-active)]">
|
<TabsTrigger value="auto" className="data-[state=active]:bg-[var(--dg-bg-active)]">
|
||||||
<Terminal className="h-4 w-4 mr-1.5" />
|
<Terminal className="h-4 w-4 mr-1.5" />
|
||||||
{isWindowsServer ? 'PowerShell 安装' : i18n.t('agent.agentwizardtsx.s1a2b3c4d')}
|
{isWindowsServer ? t('agent.wizard.tabPowerShell') : t('agent.wizard.tabAuto')}
|
||||||
</TabsTrigger>
|
</TabsTrigger>
|
||||||
{server && !isWindowsServer && (
|
{server && !isWindowsServer && (
|
||||||
<TabsTrigger value="ssh" className="data-[state=active]:bg-[var(--dg-bg-active)]">
|
<TabsTrigger value="ssh" className="data-[state=active]:bg-[var(--dg-bg-active)]">
|
||||||
<Zap className="h-4 w-4 mr-1.5" />
|
<Zap className="h-4 w-4 mr-1.5" />
|
||||||
{i18n.t('agent.agentwizardtsx.s2b3c4d5e')}
|
{t('agent.wizard.tabSSH')}
|
||||||
</TabsTrigger>
|
</TabsTrigger>
|
||||||
)}
|
)}
|
||||||
{!server && (
|
{!server && (
|
||||||
<TabsTrigger value="ssh" className="data-[state=active]:bg-[var(--dg-bg-active)] opacity-50 cursor-not-allowed" disabled>
|
<TabsTrigger value="ssh" className="data-[state=active]:bg-[var(--dg-bg-active)] opacity-50 cursor-not-allowed" disabled>
|
||||||
<Zap className="h-4 w-4 mr-1.5" />
|
<Zap className="h-4 w-4 mr-1.5" />
|
||||||
SSH一键安装
|
{t('agent.wizard.tabSSH')}
|
||||||
</TabsTrigger>
|
</TabsTrigger>
|
||||||
)}
|
)}
|
||||||
<TabsTrigger value="manual" className="data-[state=active]:bg-[var(--dg-bg-active)]">
|
<TabsTrigger value="manual" className="data-[state=active]:bg-[var(--dg-bg-active)]">
|
||||||
{i18n.t('agent.agentwizardtsx.s3c4d5e6f')}
|
{t('agent.wizard.tabManual')}
|
||||||
</TabsTrigger>
|
</TabsTrigger>
|
||||||
</TabsList>
|
</TabsList>
|
||||||
|
|
||||||
{/* 自动安装 */}
|
{/* 自动安装 */}
|
||||||
<TabsContent value="auto" className="mt-4 space-y-3">
|
<TabsContent value="auto" className="mt-4 space-y-3">
|
||||||
<p className="text-sm dg-text-secondary">
|
<p className="text-sm dg-text-secondary">
|
||||||
{isWindowsServer ? '请在目标 Windows 主机的管理员 PowerShell 中执行以下命令。' : i18n.t('agent.agentwizardtsx.s4d5e6f7g')}
|
{isWindowsServer ? t('agent.wizard.autoHintWindows') : t('agent.wizard.autoHint')}
|
||||||
</p>
|
</p>
|
||||||
<div className="relative rounded-lg bg-[var(--dg-bg-primary)] border border-[var(--dg-border)] p-4">
|
<div className="relative rounded-lg bg-[var(--dg-bg-primary)] border border-[var(--dg-border)] p-4">
|
||||||
<pre className="text-xs dg-text-green font-mono whitespace-pre-wrap break-all pr-10">
|
<pre className="text-xs dg-text-green font-mono whitespace-pre-wrap break-all pr-10">
|
||||||
@@ -280,7 +281,7 @@ export function AgentWizard({ open, onOpenChange, server, onStart, onInstalled,
|
|||||||
variant="ghost"
|
variant="ghost"
|
||||||
onClick={handleCopy}
|
onClick={handleCopy}
|
||||||
className="absolute top-2 right-2 h-8 w-8 dg-text-secondary hover:text-[var(--dg-text-primary)] hover:bg-[var(--dg-bg-hover)]"
|
className="absolute top-2 right-2 h-8 w-8 dg-text-secondary hover:text-[var(--dg-text-primary)] hover:bg-[var(--dg-bg-hover)]"
|
||||||
title={i18n.t('agent.agentwizardtsx.s564be0b1')}
|
title={t('agent.wizard.copyBtn')}
|
||||||
>
|
>
|
||||||
{copied ? <Check className="h-4 w-4 dg-text-green" /> : <Copy className="h-4 w-4" />}
|
{copied ? <Check className="h-4 w-4 dg-text-green" /> : <Copy className="h-4 w-4" />}
|
||||||
</Button>
|
</Button>
|
||||||
@@ -290,7 +291,7 @@ export function AgentWizard({ open, onOpenChange, server, onStart, onInstalled,
|
|||||||
{showManualInput && (
|
{showManualInput && (
|
||||||
<div className="rounded-lg bg-amber-950/30 border border-amber-800/50 p-4">
|
<div className="rounded-lg bg-amber-950/30 border border-amber-800/50 p-4">
|
||||||
<p className="text-xs dg-text-yellow mb-2">
|
<p className="text-xs dg-text-yellow mb-2">
|
||||||
{i18n.t('agent.agentwizardtsx.s5e6f7g8h')}
|
{t('agent.wizard.manualCopyHint')}
|
||||||
</p>
|
</p>
|
||||||
<textarea
|
<textarea
|
||||||
readOnly
|
readOnly
|
||||||
@@ -303,7 +304,7 @@ export function AgentWizard({ open, onOpenChange, server, onStart, onInstalled,
|
|||||||
<div className="flex items-start gap-2 text-xs dg-text-muted">
|
<div className="flex items-start gap-2 text-xs dg-text-muted">
|
||||||
<Terminal className="h-3.5 w-3.5 mt-0.5 shrink-0" />
|
<Terminal className="h-3.5 w-3.5 mt-0.5 shrink-0" />
|
||||||
<span>
|
<span>
|
||||||
服务器地址已自动检测 — 安装脚本与 Agent 上报均使用 {origin}(通过 Nginx/Vite proxy 转发到后端)。安装成功后将自动连接并开始上报指标。
|
{t('agent.wizard.addressDetected', { origin })}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</TabsContent>
|
</TabsContent>
|
||||||
@@ -313,8 +314,8 @@ export function AgentWizard({ open, onOpenChange, server, onStart, onInstalled,
|
|||||||
{!server ? (
|
{!server ? (
|
||||||
<div className="text-center py-12 dg-text-secondary">
|
<div className="text-center py-12 dg-text-secondary">
|
||||||
<Server className="h-10 w-10 mx-auto mb-3 opacity-50" />
|
<Server className="h-10 w-10 mx-auto mb-3 opacity-50" />
|
||||||
<p className="text-sm font-medium mb-1"> {i18n.t('agent.agentwizardtsx.sc9b7eec2')} </p>
|
<p className="text-sm font-medium mb-1"> {t('agent.wizard.noServer')} </p>
|
||||||
<p className="text-xs"> {i18n.t('agent.agentwizardtsx.s12a11150')} </p>
|
<p className="text-xs"> {t('agent.wizard.noServerHint')} </p>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
@@ -332,11 +333,11 @@ export function AgentWizard({ open, onOpenChange, server, onStart, onInstalled,
|
|||||||
<div className="mb-4 p-3 rounded-lg bg-amber-950/30 border border-amber-800/40 space-y-3">
|
<div className="mb-4 p-3 rounded-lg bg-amber-950/30 border border-amber-800/40 space-y-3">
|
||||||
<div className="flex items-center gap-2 text-xs text-amber-300/80">
|
<div className="flex items-center gap-2 text-xs text-amber-300/80">
|
||||||
<Shield className="h-3.5 w-3.5" />
|
<Shield className="h-3.5 w-3.5" />
|
||||||
<span> {i18n.t('agent.agentwizardtsx.seb55dff9')} </span>
|
<span> {t('agent.wizard.credsHint')} </span>
|
||||||
</div>
|
</div>
|
||||||
<div className="grid grid-cols-2 gap-2">
|
<div className="grid grid-cols-2 gap-2">
|
||||||
<div>
|
<div>
|
||||||
<Label className="text-xs dg-text-secondary"> {i18n.t('system.userName')} </Label>
|
<Label className="text-xs dg-text-secondary"> {t('system.userName')} </Label>
|
||||||
<Input
|
<Input
|
||||||
value={sshUsername}
|
value={sshUsername}
|
||||||
onChange={e => setSshUsername(e.target.value)}
|
onChange={e => setSshUsername(e.target.value)}
|
||||||
@@ -346,7 +347,7 @@ export function AgentWizard({ open, onOpenChange, server, onStart, onInstalled,
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex items-end gap-1">
|
<div className="flex items-end gap-1">
|
||||||
<div className="flex-1">
|
<div className="flex-1">
|
||||||
<Label className="text-xs dg-text-secondary"> {i18n.t('system.passwordLabel')} </Label>
|
<Label className="text-xs dg-text-secondary"> {t('system.passwordLabel')} </Label>
|
||||||
<Input
|
<Input
|
||||||
type="password"
|
type="password"
|
||||||
value={sshPassword}
|
value={sshPassword}
|
||||||
@@ -355,17 +356,17 @@ export function AgentWizard({ open, onOpenChange, server, onStart, onInstalled,
|
|||||||
className="h-8 text-sm dg-input text-[var(--dg-text-primary)] mt-1"
|
className="h-8 text-sm dg-input text-[var(--dg-text-primary)] mt-1"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<span className="text-xs dg-text-muted px-1 pb-1">{i18n.t("agent.agentwizardtsx.s1k2l3m4n")}</span>
|
<span className="text-xs dg-text-muted px-1 pb-1">{t("agent.wizard.or")}</span>
|
||||||
<Button variant="ghost" size="sm"
|
<Button variant="ghost" size="sm"
|
||||||
onClick={() => { setAuthType('key'); setSshPassword(''); }}
|
onClick={() => { setAuthType('key'); setSshPassword(''); }}
|
||||||
className={`text-xs h-7 px-2 ${authType==='key'?'dg-text-blue':'dg-text-muted'}`}>
|
className={`text-xs h-7 px-2 ${authType==='key'?'dg-text-blue':'dg-text-muted'}`}>
|
||||||
{i18n.t('agent.agentwizardtsx.s2l3m4n5o')}
|
{t('agent.wizard.keyAuth')}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{authType === 'key' && (
|
{authType === 'key' && (
|
||||||
<div>
|
<div>
|
||||||
<Label className="text-xs dg-text-secondary">{i18n.t("agent.agentwizardtsx.s3m4n5o6p")}</Label>
|
<Label className="text-xs dg-text-secondary">{t("agent.wizard.privateKey")}</Label>
|
||||||
<textarea
|
<textarea
|
||||||
value={sshKey}
|
value={sshKey}
|
||||||
onChange={e => setSshKey(e.target.value)}
|
onChange={e => setSshKey(e.target.value)}
|
||||||
@@ -379,7 +380,7 @@ export function AgentWizard({ open, onOpenChange, server, onStart, onInstalled,
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
<p className="text-sm dg-text-secondary mb-4">
|
<p className="text-sm dg-text-secondary mb-4">
|
||||||
{i18n.t("agent.agentwizardtsx.s7g8h9i0j")}
|
{t("agent.wizard.sshHint")}
|
||||||
</p>
|
</p>
|
||||||
<Button
|
<Button
|
||||||
onClick={handleSshInstall}
|
onClick={handleSshInstall}
|
||||||
@@ -389,12 +390,12 @@ export function AgentWizard({ open, onOpenChange, server, onStart, onInstalled,
|
|||||||
{sshInstalling ? (
|
{sshInstalling ? (
|
||||||
<>
|
<>
|
||||||
<Loader2 className="h-4 w-4 mr-2 animate-spin" />
|
<Loader2 className="h-4 w-4 mr-2 animate-spin" />
|
||||||
{i18n.t('agent.agentwizardtsx.s8h9i0j1k')}
|
{t('agent.wizard.sshInstalling')}
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<Zap className="h-4 w-4 mr-2" />
|
<Zap className="h-4 w-4 mr-2" />
|
||||||
{needsCreds ? i18n.t('agent.agentwizardtsx.sce2f5317') : i18n.t('agent.agentwizardtsx.s9866eb4f')}
|
{needsCreds ? t('agent.wizard.installWithCreds') : t('agent.wizard.installNow')}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
@@ -402,7 +403,7 @@ export function AgentWizard({ open, onOpenChange, server, onStart, onInstalled,
|
|||||||
<div className="flex items-start gap-2 text-xs dg-text-muted">
|
<div className="flex items-start gap-2 text-xs dg-text-muted">
|
||||||
<Terminal className="h-3.5 w-3.5 mt-0.5 shrink-0" />
|
<Terminal className="h-3.5 w-3.5 mt-0.5 shrink-0" />
|
||||||
<span>
|
<span>
|
||||||
系统将通过 SSH 连接 {server.ip},执行安装脚本。请确保服务器 SSH 凭据已正确配置(编辑服务器可修改密码/密钥)。
|
{t('agent.wizard.sshConnectHint', { ip: server.ip })}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
@@ -432,7 +433,7 @@ export function AgentWizard({ open, onOpenChange, server, onStart, onInstalled,
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<p className="text-xs dg-text-muted">
|
<p className="text-xs dg-text-muted">
|
||||||
{i18n.t('agent.agentwizardtsx.s0j1k2l3m')}
|
{t('agent.wizard.manualHint')}
|
||||||
</p>
|
</p>
|
||||||
</TabsContent>
|
</TabsContent>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|||||||
@@ -6851,21 +6851,6 @@
|
|||||||
"agentalertstsx.sddab4a17": "Alert Threshold Triggered",
|
"agentalertstsx.sddab4a17": "Alert Threshold Triggered",
|
||||||
"agentalertstsx.sbfdcf242": "Metric:",
|
"agentalertstsx.sbfdcf242": "Metric:",
|
||||||
"agentalertstsx.s2d13763b": "Current Value:",
|
"agentalertstsx.s2d13763b": "Current Value:",
|
||||||
"agentwizardtsx.s19ee0048": "Install command copied to clipboard, paste and execute on the target host",
|
|
||||||
"agentwizardtsx.s7ac41b1c": "Auto-copy failed, please manually select all and copy below (Ctrl+A → Ctrl+C)",
|
|
||||||
"agentwizardtsx.s8c59e054": "1. Download binary",
|
|
||||||
"agentwizardtsx.s2f17bf61": "2. Set execute permission",
|
|
||||||
"agentwizardtsx.s03fa0002": "3. Create systemd service",
|
|
||||||
"agentwizardtsx.s84bd81f4": "4. Start and enable on boot",
|
|
||||||
"agentwizardtsx.s6cfe961c": "Please fill in SSH login credentials (password or key)",
|
|
||||||
"agentwizardtsx.s812cc1a5": "Deploy Agent",
|
|
||||||
"agentwizardtsx.sed0c1b63": "Execute the following command on the target host to install and register the Agent",
|
|
||||||
"agentwizardtsx.s564be0b1": "Copy to Clipboard",
|
|
||||||
"agentwizardtsx.sc9b7eec2": "No target host selected",
|
|
||||||
"agentwizardtsx.s12a11150": "Please check a host in the host list first, then click \"Install Agent\" to open this page",
|
|
||||||
"agentwizardtsx.seb55dff9": "This server has no SSH credentials configured, please fill in the following (auto-saved after first successful connection)",
|
|
||||||
"agentwizardtsx.sce2f5317": "Connect and install Agent (credentials will be auto-saved)",
|
|
||||||
"agentwizardtsx.s9866eb4f": "One-click Install Agent",
|
|
||||||
"agentalerthelpe.sc1eec3e5": "CPU IO Wait",
|
"agentalerthelpe.sc1eec3e5": "CPU IO Wait",
|
||||||
"agentalerthelpe.sa2f9101c": "Swap Usage",
|
"agentalerthelpe.sa2f9101c": "Swap Usage",
|
||||||
"agentalerthelpe.sf23ce82f": "1-minute Load",
|
"agentalerthelpe.sf23ce82f": "1-minute Load",
|
||||||
@@ -6906,20 +6891,43 @@
|
|||||||
"agentmonitortsx.s8h9i0j1k": "Remote Command",
|
"agentmonitortsx.s8h9i0j1k": "Remote Command",
|
||||||
"agentmonitortsx.s9i0j1k2l": "Details",
|
"agentmonitortsx.s9i0j1k2l": "Details",
|
||||||
"agentmonitortsx.s0j1k2l3m": "Close",
|
"agentmonitortsx.s0j1k2l3m": "Close",
|
||||||
"agentwizardtsx.s1a2b3c4d": "Install Agent",
|
"wizard.wizard.title": "Deploy Agent",
|
||||||
"agentwizardtsx.s2b3c4d5e": "SSH One-Click Install",
|
"wizard.wizard.titleWithHost": "Deploy Agent → {{hostname}}",
|
||||||
"agentwizardtsx.s3c4d5e6f": "Manual Install",
|
"wizard.wizard.desc": "Execute the following command on the target host to install and register the Agent",
|
||||||
"agentwizardtsx.s4d5e6f7g": "Run the following command on the target host; Agent will download, install and start automatically:",
|
"wizard.wizard.descWithHost": "Target host {{hostname}} ({{ip}}), choose installation method:",
|
||||||
"agentwizardtsx.s5e6f7g8h": "Auto-copy failed. Click the input field, select all (Ctrl+A) and copy (Ctrl+C):",
|
"wizard.wizard.tabAuto": "Install Agent",
|
||||||
"agentwizardtsx.s6f7g8h9i": "Server address auto-detected - install script and Agent reporting both use {{origin}} (proxied via Nginx/Vite to backend).",
|
"wizard.wizard.tabSSH": "SSH One-Click Install",
|
||||||
"agentwizardtsx.s7g8h9i0j": "Remotely connect to target host via SSH, auto-download and install Agent, starts running immediately.",
|
"wizard.wizard.tabManual": "Manual Install",
|
||||||
"agentwizardtsx.s8h9i0j1k": "SSH connecting, installing...",
|
"wizard.wizard.tabPowerShell": "PowerShell Install",
|
||||||
"agentwizardtsx.s9i0j1k2l": "System will SSH connect to {{ip}} and run install script. Ensure SSH credentials are configured.",
|
"wizard.wizard.copySuccess": "Install command copied to clipboard, paste and execute on the target host",
|
||||||
"agentwizardtsx.s0j1k2l3m": "After completing the above steps, Agent will run as a systemd service and auto-report metrics.",
|
"wizard.wizard.copyFailed": "Auto-copy failed, please manually select all and copy below (Ctrl+A → Ctrl+C)",
|
||||||
"agentwizardtsx.s1k2l3m4n": "or",
|
"wizard.wizard.copyBtn": "Copy to Clipboard",
|
||||||
"agentwizardtsx.s2l3m4n5o": "Key",
|
"wizard.wizard.autoHint": "Run the following command on the target host; Agent will download, install and start automatically:",
|
||||||
"agentwizardtsx.s3m4n5o6p": "SSH Private Key (PEM format)",
|
"wizard.wizard.autoHintWindows": "Run the following command in an administrator PowerShell on the target Windows host.",
|
||||||
"agentwizardtsx.s4n5o6p7q": "Agent install task submitted, running in background..."
|
"wizard.wizard.manualCopyHint": "Auto-copy failed. Click the input field, select all (Ctrl+A) and copy (Ctrl+C):",
|
||||||
|
"wizard.wizard.addressDetected": "Server address auto-detected - install script and Agent reporting both use {{origin}} (proxied via Nginx/Vite to backend). After successful installation, the Agent will connect automatically and start reporting metrics.",
|
||||||
|
"wizard.wizard.noServer": "No target host selected",
|
||||||
|
"wizard.wizard.noServerHint": "Please check a host in the host list first, then click \"Install Agent\" to open this page",
|
||||||
|
"wizard.wizard.credsHint": "This server has no SSH credentials configured, please fill in the following (auto-saved after first successful connection)",
|
||||||
|
"wizard.wizard.credsRequired": "Please fill in SSH login credentials (password or key)",
|
||||||
|
"wizard.wizard.or": "or",
|
||||||
|
"wizard.wizard.keyAuth": "Key",
|
||||||
|
"wizard.wizard.privateKey": "SSH Private Key (PEM format)",
|
||||||
|
"wizard.wizard.sshHint": "Remotely connect to target host via SSH, auto-download and install Agent, starts running immediately.",
|
||||||
|
"wizard.wizard.sshInstalling": "SSH connecting, installing...",
|
||||||
|
"wizard.wizard.installWithCreds": "Connect and install Agent (credentials will be auto-saved)",
|
||||||
|
"wizard.wizard.installNow": "One-click Install Agent",
|
||||||
|
"wizard.wizard.sshConnectHint": "System will SSH connect to {{ip}} and run install script. Ensure SSH credentials are configured.",
|
||||||
|
"wizard.wizard.windowsSSHNotSupported": "For Windows Agent, please use the PowerShell install command. SSH one-click install only supports Linux/macOS",
|
||||||
|
"wizard.wizard.installSubmitted": "{{hostname}}: Agent install task submitted, running in background...",
|
||||||
|
"wizard.wizard.manualHint": "After completing the above steps, Agent will run as a systemd service and auto-report metrics.",
|
||||||
|
"wizard.wizard.stepDownload": "1. Download binary",
|
||||||
|
"wizard.wizard.stepDownloadWindows": "Download Windows Agent",
|
||||||
|
"wizard.wizard.stepChmod": "2. Set execute permission",
|
||||||
|
"wizard.wizard.stepService": "3. Create systemd service",
|
||||||
|
"wizard.wizard.stepRegisterWindows": "Register Windows Service",
|
||||||
|
"wizard.wizard.stepStart": "4. Start and enable on boot",
|
||||||
|
"wizard.wizard.stepStartCheck": "Start and Check"
|
||||||
},
|
},
|
||||||
"system": {
|
"system": {
|
||||||
"title": "System",
|
"title": "System",
|
||||||
|
|||||||
@@ -6851,21 +6851,6 @@
|
|||||||
"agentalertstsx.sddab4a17": "触发告警阈值",
|
"agentalertstsx.sddab4a17": "触发告警阈值",
|
||||||
"agentalertstsx.sbfdcf242": "指标:",
|
"agentalertstsx.sbfdcf242": "指标:",
|
||||||
"agentalertstsx.s2d13763b": "当前值:",
|
"agentalertstsx.s2d13763b": "当前值:",
|
||||||
"agentwizardtsx.s19ee0048": "安装命令已复制到剪贴板,粘贴到目标主机执行",
|
|
||||||
"agentwizardtsx.s7ac41b1c": "自动复制失败,请在下方手动全选复制 (Ctrl+A → Ctrl+C)",
|
|
||||||
"agentwizardtsx.s8c59e054": "1. 下载二进制",
|
|
||||||
"agentwizardtsx.s2f17bf61": "2. 赋予执行权限",
|
|
||||||
"agentwizardtsx.s03fa0002": "3. 创建 systemd 服务",
|
|
||||||
"agentwizardtsx.s84bd81f4": "4. 启动并设置开机自启",
|
|
||||||
"agentwizardtsx.s6cfe961c": "请填写 SSH 登录凭据(密码或密钥)",
|
|
||||||
"agentwizardtsx.s812cc1a5": "部署 Agent",
|
|
||||||
"agentwizardtsx.sed0c1b63": "在目标主机上执行以下命令即可完成 Agent 安装与注册",
|
|
||||||
"agentwizardtsx.s564be0b1": "复制到剪贴板",
|
|
||||||
"agentwizardtsx.sc9b7eec2": "未选择目标主机",
|
|
||||||
"agentwizardtsx.s12a11150": "请先在主机列表中勾选一台主机,再点击「安装 Agent」打开此页面",
|
|
||||||
"agentwizardtsx.seb55dff9": "该服务器未配置 SSH 凭据,请填写以下信息(首次连接成功后自动保存)",
|
|
||||||
"agentwizardtsx.sce2f5317": "连接并安装 Agent(凭据将自动保存)",
|
|
||||||
"agentwizardtsx.s9866eb4f": "一键安装 Agent",
|
|
||||||
"agentalerthelpe.sc1eec3e5": "CPU IO 等待",
|
"agentalerthelpe.sc1eec3e5": "CPU IO 等待",
|
||||||
"agentalerthelpe.sa2f9101c": "Swap 使用率",
|
"agentalerthelpe.sa2f9101c": "Swap 使用率",
|
||||||
"agentalerthelpe.sf23ce82f": "1分钟负载",
|
"agentalerthelpe.sf23ce82f": "1分钟负载",
|
||||||
@@ -6906,20 +6891,43 @@
|
|||||||
"agentmonitortsx.s8h9i0j1k": "远程命令",
|
"agentmonitortsx.s8h9i0j1k": "远程命令",
|
||||||
"agentmonitortsx.s9i0j1k2l": "详情",
|
"agentmonitortsx.s9i0j1k2l": "详情",
|
||||||
"agentmonitortsx.s0j1k2l3m": "关闭",
|
"agentmonitortsx.s0j1k2l3m": "关闭",
|
||||||
"agentwizardtsx.s1a2b3c4d": "安装Agent",
|
"wizard.wizard.title": "部署 Agent",
|
||||||
"agentwizardtsx.s2b3c4d5e": "SSH一键安装",
|
"wizard.wizard.titleWithHost": "部署 Agent → {{hostname}}",
|
||||||
"agentwizardtsx.s3c4d5e6f": "手动安装",
|
"wizard.wizard.desc": "在目标主机上执行以下命令即可完成 Agent 安装与注册",
|
||||||
"agentwizardtsx.s4d5e6f7g": "在目标主机执行以下命令,Agent 将自动下载、安装并启动:",
|
"wizard.wizard.descWithHost": "目标主机 {{hostname}} ({{ip}}),选择安装方式:",
|
||||||
"agentwizardtsx.s5e6f7g8h": "自动复制失败。请点击下方输入框全选 (Ctrl+A) 后复制 (Ctrl+C):",
|
"wizard.wizard.tabAuto": "安装 Agent",
|
||||||
"agentwizardtsx.s6f7g8h9i": "服务器地址已自动检测 — 安装脚本与 Agent 上报均使用 {{origin}}(通过 Nginx/Vite proxy 转发到后端)。安装成功后将自动连接并开始上报指标。",
|
"wizard.wizard.tabSSH": "SSH 一键安装",
|
||||||
"agentwizardtsx.s7g8h9i0j": "通过 SSH 远程连接到目标主机,自动下载并安装 Agent,完成后立即启动运行。",
|
"wizard.wizard.tabManual": "手动安装",
|
||||||
"agentwizardtsx.s8h9i0j1k": "SSH 连接中,正在安装...",
|
"wizard.wizard.tabPowerShell": "PowerShell 安装",
|
||||||
"agentwizardtsx.s9i0j1k2l": "系统将通过 SSH 连接 {{ip}},执行安装脚本。请确保服务器 SSH 凭据已正确配置(编辑服务器可修改密码/密钥)。",
|
"wizard.wizard.copySuccess": "安装命令已复制到剪贴板,粘贴到目标主机执行",
|
||||||
"agentwizardtsx.s0j1k2l3m": "完成上述步骤后,Agent 将作为 systemd 服务运行并自动上报指标。",
|
"wizard.wizard.copyFailed": "自动复制失败,请在下方手动全选复制 (Ctrl+A → Ctrl+C)",
|
||||||
"agentwizardtsx.s1k2l3m4n": "或",
|
"wizard.wizard.copyBtn": "复制到剪贴板",
|
||||||
"agentwizardtsx.s2l3m4n5o": "密钥",
|
"wizard.wizard.autoHint": "在目标主机执行以下命令,Agent 将自动下载、安装并启动:",
|
||||||
"agentwizardtsx.s3m4n5o6p": "SSH 私钥(PEM 格式)",
|
"wizard.wizard.autoHintWindows": "请在目标 Windows 主机的管理员 PowerShell 中执行以下命令。",
|
||||||
"agentwizardtsx.s4n5o6p7q": "已提交 Agent 安装任务,后台执行中…"
|
"wizard.wizard.manualCopyHint": "自动复制失败。请点击下方输入框全选 (Ctrl+A) 后复制 (Ctrl+C):",
|
||||||
|
"wizard.wizard.addressDetected": "服务器地址已自动检测 — 安装脚本与 Agent 上报均使用 {{origin}}(通过 Nginx/Vite proxy 转发到后端)。安装成功后将自动连接并开始上报指标。",
|
||||||
|
"wizard.wizard.noServer": "未选择目标主机",
|
||||||
|
"wizard.wizard.noServerHint": "请先在主机列表中勾选一台主机,再点击「安装 Agent」打开此页面",
|
||||||
|
"wizard.wizard.credsHint": "该服务器未配置 SSH 凭据,请填写以下信息(首次连接成功后自动保存)",
|
||||||
|
"wizard.wizard.credsRequired": "请填写 SSH 登录凭据(密码或密钥)",
|
||||||
|
"wizard.wizard.or": "或",
|
||||||
|
"wizard.wizard.keyAuth": "密钥",
|
||||||
|
"wizard.wizard.privateKey": "SSH 私钥(PEM 格式)",
|
||||||
|
"wizard.wizard.sshHint": "通过 SSH 远程连接到目标主机,自动下载并安装 Agent,完成后立即启动运行。",
|
||||||
|
"wizard.wizard.sshInstalling": "SSH 连接中,正在安装...",
|
||||||
|
"wizard.wizard.installWithCreds": "连接并安装 Agent(凭据将自动保存)",
|
||||||
|
"wizard.wizard.installNow": "一键安装 Agent",
|
||||||
|
"wizard.wizard.sshConnectHint": "系统将通过 SSH 连接 {{ip}},执行安装脚本。请确保服务器 SSH 凭据已正确配置(编辑服务器可修改密码/密钥)。",
|
||||||
|
"wizard.wizard.windowsSSHNotSupported": "Windows Agent 请使用 PowerShell 安装命令,SSH 一键安装仅支持 Linux/macOS",
|
||||||
|
"wizard.wizard.installSubmitted": "{{hostname}}: 已提交 Agent 安装任务,后台执行中…",
|
||||||
|
"wizard.wizard.manualHint": "完成上述步骤后,Agent 将作为 systemd 服务运行并自动上报指标。",
|
||||||
|
"wizard.wizard.stepDownload": "1. 下载二进制",
|
||||||
|
"wizard.wizard.stepDownloadWindows": "下载 Windows Agent",
|
||||||
|
"wizard.wizard.stepChmod": "2. 赋予执行权限",
|
||||||
|
"wizard.wizard.stepService": "3. 创建 systemd 服务",
|
||||||
|
"wizard.wizard.stepRegisterWindows": "注册 Windows 服务",
|
||||||
|
"wizard.wizard.stepStart": "4. 启动并设置开机自启",
|
||||||
|
"wizard.wizard.stepStartCheck": "启动并检查"
|
||||||
},
|
},
|
||||||
"system": {
|
"system": {
|
||||||
"title": "系统管理",
|
"title": "系统管理",
|
||||||
|
|||||||
Reference in new issue
Block a user