@@ -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 }),
|
||||
|
||||
Reference in New Issue
Block a user