fix: add agent
ci-front / build (push) Successful in 2m28s

This commit is contained in:
2026-04-04 05:46:01 +03:00
parent 11cef95929
commit d62205b329
3 changed files with 41 additions and 4 deletions
+8
View File
@@ -15,4 +15,12 @@ export type {
InsertLogRequest,
InsertLogsRequest,
LogFilters,
TokenUpdate,
TokenUpdatePermissions,
TokenPasswordReset,
RegistrationRequest,
DeployResult,
DeployAgentsRequest,
AgentDeployConfig,
DeployResponse,
} from "./types/agent.types";
+29 -2
View File
@@ -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<SSHAgentFormProps> = ({
<div
style={{
display: "grid",
gridTemplateColumns: "1fr 1fr",
gridTemplateColumns: "1fr 1fr 1fr",
gap: "16px",
}}
>
@@ -238,6 +240,31 @@ export const SSHAgentForm: React.FC<SSHAgentFormProps> = ({
placeholder="192.168.1.1"
/>
</div>
<div>
<label style={labelStyle}>
<span
style={{ display: "flex", alignItems: "center", gap: "6px" }}
>
<FiLink size={14} />
Порт *
</span>
</label>
<input
type="number"
value={config.port}
onChange={(e) =>
handleChange("port", parseInt(e.target.value) || 22)
}
required
min={1}
max={65535}
style={inputBaseStyle}
onFocus={handleFocus}
onBlur={handleBlur}
placeholder="22"
/>
</div>
</div>
{/* Метод аутентификации */}
@@ -457,7 +484,7 @@ export const SSHAgentForm: React.FC<SSHAgentFormProps> = ({
<div
style={{
display: "grid",
gridTemplateColumns: "1fr 1fr 1fr",
gridTemplateColumns: "1fr 1fr",
gap: "8px",
}}
>
+4 -2
View File
@@ -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 }),