@@ -15,4 +15,12 @@ export type {
|
|||||||
InsertLogRequest,
|
InsertLogRequest,
|
||||||
InsertLogsRequest,
|
InsertLogsRequest,
|
||||||
LogFilters,
|
LogFilters,
|
||||||
|
TokenUpdate,
|
||||||
|
TokenUpdatePermissions,
|
||||||
|
TokenPasswordReset,
|
||||||
|
RegistrationRequest,
|
||||||
|
DeployResult,
|
||||||
|
DeployAgentsRequest,
|
||||||
|
AgentDeployConfig,
|
||||||
|
DeployResponse,
|
||||||
} from "./types/agent.types";
|
} from "./types/agent.types";
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import {
|
|||||||
FiPlus,
|
FiPlus,
|
||||||
FiTrash2,
|
FiTrash2,
|
||||||
FiSettings,
|
FiSettings,
|
||||||
|
FiLink,
|
||||||
} from "react-icons/fi";
|
} from "react-icons/fi";
|
||||||
import { SiDocker } from "react-icons/si";
|
import { SiDocker } from "react-icons/si";
|
||||||
import { FiPackage, FiUploadCloud } from "react-icons/fi";
|
import { FiPackage, FiUploadCloud } from "react-icons/fi";
|
||||||
@@ -22,6 +23,7 @@ interface ExtraField {
|
|||||||
export interface SSHAgentConfig {
|
export interface SSHAgentConfig {
|
||||||
user: string;
|
user: string;
|
||||||
ip: string;
|
ip: string;
|
||||||
|
port: number;
|
||||||
authMethod: AuthMethod;
|
authMethod: AuthMethod;
|
||||||
sshKey?: string;
|
sshKey?: string;
|
||||||
password?: string;
|
password?: string;
|
||||||
@@ -193,7 +195,7 @@ export const SSHAgentForm: React.FC<SSHAgentFormProps> = ({
|
|||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
display: "grid",
|
display: "grid",
|
||||||
gridTemplateColumns: "1fr 1fr",
|
gridTemplateColumns: "1fr 1fr 1fr",
|
||||||
gap: "16px",
|
gap: "16px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -238,6 +240,31 @@ export const SSHAgentForm: React.FC<SSHAgentFormProps> = ({
|
|||||||
placeholder="192.168.1.1"
|
placeholder="192.168.1.1"
|
||||||
/>
|
/>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
|
|
||||||
{/* Метод аутентификации */}
|
{/* Метод аутентификации */}
|
||||||
@@ -457,7 +484,7 @@ export const SSHAgentForm: React.FC<SSHAgentFormProps> = ({
|
|||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
display: "grid",
|
display: "grid",
|
||||||
gridTemplateColumns: "1fr 1fr 1fr",
|
gridTemplateColumns: "1fr 1fr",
|
||||||
gap: "8px",
|
gap: "8px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import {
|
|||||||
const createEmptyAgentConfig = (): SSHAgentConfig => ({
|
const createEmptyAgentConfig = (): SSHAgentConfig => ({
|
||||||
user: "",
|
user: "",
|
||||||
ip: "",
|
ip: "",
|
||||||
|
port: 22,
|
||||||
authMethod: "key",
|
authMethod: "key",
|
||||||
sshKey: "",
|
sshKey: "",
|
||||||
password: "",
|
password: "",
|
||||||
@@ -52,7 +53,8 @@ export const AddAgentsPage: React.FC = () => {
|
|||||||
|
|
||||||
// Валидация
|
// Валидация
|
||||||
const isValid = agents.every((agent) => {
|
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 === "key" && !agent.sshKey) return false;
|
||||||
if (agent.authMethod === "password" && !agent.password) return false;
|
if (agent.authMethod === "password" && !agent.password) return false;
|
||||||
return true;
|
return true;
|
||||||
@@ -74,11 +76,11 @@ export const AddAgentsPage: React.FC = () => {
|
|||||||
agentLabel: `${agent.ip}-${agent.user}`,
|
agentLabel: `${agent.ip}-${agent.user}`,
|
||||||
ip: agent.ip,
|
ip: agent.ip,
|
||||||
user: agent.user,
|
user: agent.user,
|
||||||
|
port: agent.port,
|
||||||
authMethod: agent.authMethod as "key" | "password",
|
authMethod: agent.authMethod as "key" | "password",
|
||||||
deployType: (agent.deployType === "deploy"
|
deployType: (agent.deployType === "deploy"
|
||||||
? "docker"
|
? "docker"
|
||||||
: agent.deployType) as "docker" | "binary",
|
: agent.deployType) as "docker" | "binary",
|
||||||
port: 22,
|
|
||||||
...(agent.authMethod === "key"
|
...(agent.authMethod === "key"
|
||||||
? { sshKey: agent.sshKey }
|
? { sshKey: agent.sshKey }
|
||||||
: { password: agent.password }),
|
: { password: agent.password }),
|
||||||
|
|||||||
Reference in New Issue
Block a user