diff --git a/frontend/src/pages/Deploy/Deployment/List/components/DeploymentConfigModal.tsx b/frontend/src/pages/Deploy/Deployment/List/components/DeploymentConfigModal.tsx index 009c5d04..08aaf7be 100644 --- a/frontend/src/pages/Deploy/Deployment/List/components/DeploymentConfigModal.tsx +++ b/frontend/src/pages/Deploy/Deployment/List/components/DeploymentConfigModal.tsx @@ -1,5 +1,5 @@ import React, {useEffect, useState, useCallback} from 'react'; -import {Modal, Form, Select, message, Switch, InputNumber, Input, Space, Button} from 'antd'; +import {Modal, Form, Select, message, Switch, Space, Button} from 'antd'; import {FullscreenOutlined} from '@ant-design/icons'; import type {DeploymentConfig, DeployConfigTemplate, CreateDeploymentConfigRequest} from '../types'; import {createDeploymentConfig, updateDeploymentConfig, getDeployConfigTemplates} from '../service'; @@ -68,12 +68,11 @@ const DeploymentConfigModal: React.FC = ({ } }, [open, fetchApplications, fetchTemplates]); - // ���始化表单数据 + // 初始化表单数据 useEffect(() => { if (!open) return; if (initialValues) { - // 设置基础字段 form.setFieldsValue({ applicationId: initialValues.applicationId, enabled: initialValues.enabled @@ -162,14 +161,6 @@ const DeploymentConfigModal: React.FC = ({ })); }; - // 处理普通输入框的值变化 - const handleInputChange = (key: string, value: string) => { - setBuildVariables(prev => ({ - ...prev, - [key]: value - })); - }; - return ( <> = ({ layout="vertical" initialValues={{ enabled: true, - sort: 0, }} > {/* 应用选择 */} @@ -271,46 +261,54 @@ const DeploymentConfigModal: React.FC = ({ suggestOnTriggerCharacters: property.editorConfig.autoComplete ?? true, renderWhitespace: 'boundary', }} - loading={ -
- 编辑器加载中... -
- } /> )) } {/* 普通字段 */} - {Object.entries(selectedTemplate.buildVariablesSchema.properties) - .filter(([_, property]) => !property.editorConfig) - .map(([key, property]) => ( - - ) => handleInputChange(key, e.target.value)} - placeholder={`请输入${property.title || key}`} - /> - - )) - } + !prop.editorConfig) + .map(([key, prop]) => [ + key, + { + type: prop.type || 'string', + title: prop.title, + description: prop.description, + default: prop.default, + enum: prop.enum, + enumNames: prop.enumNames, + format: prop.format, + minimum: prop.minimum, + maximum: prop.maximum, + minLength: prop.minLength, + maxLength: prop.maxLength, + pattern: prop.pattern, + items: prop.items && { + type: prop.items.type || 'string', + enum: prop.items.enum, + enumNames: prop.items.enumNames + } + } + ]) + ), + required: selectedTemplate.buildVariablesSchema.required || [] + })} + initialValues={buildVariables} + onValuesChange={(_, values) => setBuildVariables(prev => ({ + ...prev, + ...values + }))} + /> )} - {/* 状态和排序 */} + {/* 状态 */}