fix: ServerForm 缺少 ssh_key/credential_id 字段, selIds.has→includes

This commit is contained in:
attacker committed 2026-06-19 01:27:31 +00:00
1 parent 29b3cd49a0
commit 346042a29c
2 files changed
+3 -1

No files matched your search

@@ -107,7 +107,7 @@ const AgentTab: React.FC = () => {
// 批量升级 Agent 到最新版本 // 批量升级 Agent 到最新版本
const [batchUpgrading, setBatchUpgrading] = useState(false); const [batchUpgrading, setBatchUpgrading] = useState(false);
const handleBatchUpgrade = async () => { const handleBatchUpgrade = async () => {
const online = hosts.filter((h: any) => selIds.has(h.server_id) && h.agent_status === 'online'); const online = hosts.filter((h: any) => selIds.includes(h.server_id) && h.agent_status === 'online');
if (online.length === 0) { toast.error('所选主机中没有在线 Agent'); return; } if (online.length === 0) { toast.error('所选主机中没有在线 Agent'); return; }
const ids = online.map((h: any) => h.server_id); const ids = online.map((h: any) => h.server_id);
const ok = await _confirm({ title: '批量升级 Agent', description: `确定升级选中的 ${ids.length} 台在线主机的 Agent 到最新版本?升级将在后台异步执行。`, confirmText: '升级', variant: 'default' }); const ok = await _confirm({ title: '批量升级 Agent', description: `确定升级选中的 ${ids.length} 台在线主机的 Agent 到最新版本?升级将在后台异步执行。`, confirmText: '升级', variant: 'default' });
@@ -268,6 +268,8 @@ export function ServerManager() {
username: server.username || 'root', username: server.username || 'root',
auth_type: server.auth_type || 'password', auth_type: server.auth_type || 'password',
password: '', password: '',
ssh_key: '',
credential_id: null as number | null,
os: server.os || '', os: server.os || '',
cpu: String(server.cpu || ''), cpu: String(server.cpu || ''),
memory: server.memory ? String(Math.round(server.memory / 1024)) : '', // MB → GB memory: server.memory ? String(Math.round(server.memory / 1024)) : '', // MB → GB