1
This commit is contained in:
parent
e4816ed308
commit
5e80f9de10
@ -5,6 +5,8 @@ import type {DeploymentConfig, DeployConfigTemplate, CreateDeploymentConfigReque
|
|||||||
import {createDeploymentConfig, updateDeploymentConfig, getDeployConfigTemplates} from '../service';
|
import {createDeploymentConfig, updateDeploymentConfig, getDeployConfigTemplates} from '../service';
|
||||||
import {getApplicationList} from '../../../Application/List/service';
|
import {getApplicationList} from '../../../Application/List/service';
|
||||||
import type {Application} from '../../../Application/List/types';
|
import type {Application} from '../../../Application/List/types';
|
||||||
|
import {BetaSchemaForm} from '@ant-design/pro-form';
|
||||||
|
import {convertJsonSchemaToColumns} from '@/utils/jsonSchemaUtils';
|
||||||
import {Editor} from '@/components/Editor';
|
import {Editor} from '@/components/Editor';
|
||||||
import type {JsonNode} from '@/types/common';
|
import type {JsonNode} from '@/types/common';
|
||||||
import './styles.less';
|
import './styles.less';
|
||||||
@ -66,7 +68,7 @@ const DeploymentConfigModal: React.FC<DeploymentConfigModalProps> = ({
|
|||||||
}
|
}
|
||||||
}, [open, fetchApplications, fetchTemplates]);
|
}, [open, fetchApplications, fetchTemplates]);
|
||||||
|
|
||||||
// 初始化表单数据
|
// <EFBFBD><EFBFBD><EFBFBD>始化表单数据
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!open) return;
|
if (!open) return;
|
||||||
|
|
||||||
@ -117,7 +119,7 @@ const DeploymentConfigModal: React.FC<DeploymentConfigModalProps> = ({
|
|||||||
// 获取对应的模板
|
// 获取对应的模板
|
||||||
const template = templates.find(t => t.languageType === selectedApp.language);
|
const template = templates.find(t => t.languageType === selectedApp.language);
|
||||||
if (!template) {
|
if (!template) {
|
||||||
throw new Error('未找到匹配<EFBFBD><EFBFBD><EFBFBD>配置模板');
|
throw new Error('未找到匹配配置模板');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 构建提交数据
|
// 构建提交数据
|
||||||
@ -224,9 +226,11 @@ const DeploymentConfigModal: React.FC<DeploymentConfigModalProps> = ({
|
|||||||
|
|
||||||
{/* 动态构建配置 */}
|
{/* 动态构建配置 */}
|
||||||
{selectedTemplate?.buildVariablesSchema?.properties && (
|
{selectedTemplate?.buildVariablesSchema?.properties && (
|
||||||
Object.entries(selectedTemplate.buildVariablesSchema.properties).map(([key, property]) => {
|
<>
|
||||||
if (property.editorConfig) {
|
{/* 富文本编辑器字段 */}
|
||||||
return (
|
{Object.entries(selectedTemplate.buildVariablesSchema.properties)
|
||||||
|
.filter(([_, property]) => property.editorConfig)
|
||||||
|
.map(([key, property]) => (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
key={key}
|
key={key}
|
||||||
label={
|
label={
|
||||||
@ -282,24 +286,28 @@ const DeploymentConfigModal: React.FC<DeploymentConfigModalProps> = ({
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
);
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
{/* 普通字段 */}
|
||||||
<Form.Item
|
{Object.entries(selectedTemplate.buildVariablesSchema.properties)
|
||||||
key={key}
|
.filter(([_, property]) => !property.editorConfig)
|
||||||
label={property.title || key}
|
.map(([key, property]) => (
|
||||||
required={selectedTemplate.buildVariablesSchema.required?.includes(key)}
|
<Form.Item
|
||||||
tooltip={property.description}
|
key={key}
|
||||||
>
|
label={property.title || key}
|
||||||
<Input
|
required={selectedTemplate.buildVariablesSchema.required?.includes(key)}
|
||||||
value={buildVariables[key] || property.default || ''}
|
tooltip={property.description}
|
||||||
onChange={(e: React.ChangeEvent<HTMLInputElement>) => handleInputChange(key, e.target.value)}
|
>
|
||||||
placeholder={`请输入${property.title || key}`}
|
<Input
|
||||||
/>
|
value={buildVariables[key] || property.default || ''}
|
||||||
</Form.Item>
|
onChange={(e: React.ChangeEvent<HTMLInputElement>) => handleInputChange(key, e.target.value)}
|
||||||
);
|
placeholder={`请输入${property.title || key}`}
|
||||||
})
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* 状态和排序 */}
|
{/* 状态和排序 */}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user