From d62205b329929fac201ab8b390296a0958279472 Mon Sep 17 00:00:00 2001 From: NikitaTorbenko <2015nekitciti@gmail.com> Date: Sat, 4 Apr 2026 05:46:01 +0300 Subject: [PATCH] fix: add agent --- frontend/src/modules/agent/index.ts | 8 +++++ .../src/modules/agent/ui/SSHAgentForm.tsx | 31 +++++++++++++++++-- frontend/src/pages/add-agents.page.tsx | 6 ++-- 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/frontend/src/modules/agent/index.ts b/frontend/src/modules/agent/index.ts index 0dab406..3b4cdad 100644 --- a/frontend/src/modules/agent/index.ts +++ b/frontend/src/modules/agent/index.ts @@ -15,4 +15,12 @@ export type { InsertLogRequest, InsertLogsRequest, LogFilters, + TokenUpdate, + TokenUpdatePermissions, + TokenPasswordReset, + RegistrationRequest, + DeployResult, + DeployAgentsRequest, + AgentDeployConfig, + DeployResponse, } from "./types/agent.types"; diff --git a/frontend/src/modules/agent/ui/SSHAgentForm.tsx b/frontend/src/modules/agent/ui/SSHAgentForm.tsx index d53b187..d41fe1c 100644 --- a/frontend/src/modules/agent/ui/SSHAgentForm.tsx +++ b/frontend/src/modules/agent/ui/SSHAgentForm.tsx @@ -7,6 +7,7 @@ import { FiPlus, FiTrash2, FiSettings, + FiLink, } from "react-icons/fi"; import { SiDocker } from "react-icons/si"; import { FiPackage, FiUploadCloud } from "react-icons/fi"; @@ -22,6 +23,7 @@ interface ExtraField { export interface SSHAgentConfig { user: string; ip: string; + port: number; authMethod: AuthMethod; sshKey?: string; password?: string; @@ -193,7 +195,7 @@ export const SSHAgentForm: React.FC = ({
@@ -238,6 +240,31 @@ export const SSHAgentForm: React.FC = ({ placeholder="192.168.1.1" />
+ +
+ + + handleChange("port", parseInt(e.target.value) || 22) + } + required + min={1} + max={65535} + style={inputBaseStyle} + onFocus={handleFocus} + onBlur={handleBlur} + placeholder="22" + /> +
{/* Метод аутентификации */} @@ -457,7 +484,7 @@ export const SSHAgentForm: React.FC = ({
diff --git a/frontend/src/pages/add-agents.page.tsx b/frontend/src/pages/add-agents.page.tsx index ca439d1..94e7525 100644 --- a/frontend/src/pages/add-agents.page.tsx +++ b/frontend/src/pages/add-agents.page.tsx @@ -17,6 +17,7 @@ import { const createEmptyAgentConfig = (): SSHAgentConfig => ({ user: "", ip: "", + port: 22, authMethod: "key", sshKey: "", password: "", @@ -52,7 +53,8 @@ export const AddAgentsPage: React.FC = () => { // Валидация const isValid = agents.every((agent) => { - if (!agent.user || !agent.ip) return false; + if (!agent.user || !agent.ip || !agent.port) return false; + if (agent.port < 1 || agent.port > 65535) return false; if (agent.authMethod === "key" && !agent.sshKey) return false; if (agent.authMethod === "password" && !agent.password) return false; return true; @@ -74,11 +76,11 @@ export const AddAgentsPage: React.FC = () => { agentLabel: `${agent.ip}-${agent.user}`, ip: agent.ip, user: agent.user, + port: agent.port, authMethod: agent.authMethod as "key" | "password", deployType: (agent.deployType === "deploy" ? "docker" : agent.deployType) as "docker" | "binary", - port: 22, ...(agent.authMethod === "key" ? { sshKey: agent.sshKey } : { password: agent.password }),