This commit is contained in:
asp_ly 2025-01-17 22:21:29 +08:00
parent fc47e693a2
commit 80aa81708b

View File

@ -126,27 +126,7 @@ const DeploymentConfigModal: React.FC<DeploymentConfigModalProps> = ({
}) })
// 创建表单实例 // 创建表单实例
const form = createForm({ const form = createForm()
validateFirst: true,
initialValues: {},
effects() {
onFormInit((form) => {
form.setFieldState('*', (state) => {
if (state.decorator[0] === 'FormItem') {
state.decoratorProps = {
labelWidth: 100,
labelAlign: 'right',
layout: 'horizontal',
labelCol: 8,
wrapperCol: 16,
colon: true,
...state.decoratorProps
}
}
})
})
}
})
const schema: ISchema = { const schema: ISchema = {
type: 'object', type: 'object',
@ -162,7 +142,8 @@ const DeploymentConfigModal: React.FC<DeploymentConfigModalProps> = ({
properties: { properties: {
externalSystemId: { externalSystemId: {
type: 'string', type: 'string',
title: '三方系统', title: 'Jenkins系统',
required: true,
'x-decorator': 'FormItem', 'x-decorator': 'FormItem',
'x-decorator-props': { 'x-decorator-props': {
labelCol: 24, labelCol: 24,
@ -184,6 +165,7 @@ const DeploymentConfigModal: React.FC<DeploymentConfigModalProps> = ({
viewId: { viewId: {
type: 'string', type: 'string',
title: 'Jenkins视图', title: 'Jenkins视图',
required: true,
'x-decorator': 'FormItem', 'x-decorator': 'FormItem',
'x-decorator-props': { 'x-decorator-props': {
labelCol: 24, labelCol: 24,
@ -209,12 +191,12 @@ const DeploymentConfigModal: React.FC<DeploymentConfigModalProps> = ({
}, },
run: '{{$deps[0] ? useAsyncDataSource(`/api/v1/jenkins-view/list?externalSystemId=${$deps[0]}`, { mapping: { label: "viewName", value: "id" } })($self) : ($self.dataSource = [])}}' run: '{{$deps[0] ? useAsyncDataSource(`/api/v1/jenkins-view/list?externalSystemId=${$deps[0]}`, { mapping: { label: "viewName", value: "id" } })($self) : ($self.dataSource = [])}}'
} }
}, }
"description": "{{$self.dataSource && $self.value ? ($self.dataSource.find(item => item.value === $self.value)?.extra?.description) : undefined}}"
}, },
jobId: { jobId: {
type: 'string', type: 'string',
title: 'Jenkins作业', title: 'Jenkins作业',
required: true,
'x-decorator': 'FormItem', 'x-decorator': 'FormItem',
'x-decorator-props': { 'x-decorator-props': {
labelCol: 24, labelCol: 24,
@ -240,8 +222,7 @@ const DeploymentConfigModal: React.FC<DeploymentConfigModalProps> = ({
}, },
run: '{{($deps[0] && $deps[1]) ? useAsyncDataSource(`/api/v1/jenkins-job/list?externalSystemId=${$deps[0]}&viewId=${$deps[1]}`, { mapping: { label: "jobName", value: "id" } })($self) : ($self.dataSource = [])}}' run: '{{($deps[0] && $deps[1]) ? useAsyncDataSource(`/api/v1/jenkins-job/list?externalSystemId=${$deps[0]}&viewId=${$deps[1]}`, { mapping: { label: "jobName", value: "id" } })($self) : ($self.dataSource = [])}}'
} }
}, }
"description": "{{$self.dataSource && $self.value ? ($self.dataSource.find(item => item.value === $self.value)?.extra?.description) : undefined}}"
}, },
} }
}, },
@ -255,8 +236,16 @@ const DeploymentConfigModal: React.FC<DeploymentConfigModalProps> = ({
properties: { properties: {
envs: { envs: {
type: 'array', type: 'array',
'x-component': 'ArrayTable', title: '环境变量',
'x-decorator': 'FormItem', 'x-decorator': 'FormItem',
'x-decorator-props': {
labelCol: 24,
wrapperCol: 24,
layout: 'vertical',
colon: false,
labelAlign: 'left'
},
'x-component': 'ArrayTable',
'x-component-props': { 'x-component-props': {
pagination: { pageSize: 10 }, pagination: { pageSize: 10 },
scroll: { x: '100%' }, scroll: { x: '100%' },
@ -295,7 +284,7 @@ const DeploymentConfigModal: React.FC<DeploymentConfigModalProps> = ({
} }
} }
}, },
action: { value: {
type: 'void', type: 'void',
'x-component': 'ArrayTable.Column', 'x-component': 'ArrayTable.Column',
'x-component-props': { title: '值', width: '40%' }, 'x-component-props': { title: '值', width: '40%' },