This commit is contained in:
dengqichen 2025-01-17 17:47:17 +08:00
parent 335e86c5be
commit c5c353a9a6

View File

@ -92,97 +92,99 @@ const DeploymentConfigModal: React.FC<DeploymentConfigModalProps> = ({
const schema: ISchema = { const schema: ISchema = {
type: 'object', type: 'object',
properties: { properties: {
externalSystemId: { layout: {
type: 'string', type: 'void',
title: '三方系统', 'x-component': 'FormGrid',
'x-decorator': 'FormItem',
'x-decorator-props': {
labelCol: 24,
wrapperCol: 24,
layout: 'vertical',
colon: false,
labelAlign: 'left',
style: {
marginBottom: 24
}
},
'x-component': 'Select',
'x-component-props': { 'x-component-props': {
style: { maxColumns: 3,
width: '100%' minColumns: 3,
}, columnGap: 24
placeholder: '请选择三方系统',
allowClear: true
}, },
'x-reactions': ["{{useAsyncDataSource('/api/v1/external-system/list', { params: { type: 'JENKINS' }, mapping: { label: 'name', value: 'id' } })}}"], properties: {
}, externalSystemId: {
viewId: { type: 'string',
type: 'string', title: '三方系统',
title: 'Jenkins视图', 'x-decorator': 'FormItem',
'x-decorator': 'FormItem', 'x-decorator-props': {
'x-decorator-props': { labelCol: 24,
labelCol: 24, wrapperCol: 24,
wrapperCol: 24, layout: 'vertical',
layout: 'vertical', colon: false,
colon: false, labelAlign: 'left'
labelAlign: 'left',
style: {
marginBottom: 24
}
},
'x-component': 'Select',
'x-component-props': {
style: {
width: '100%'
},
placeholder: '请选择Jenkins视图',
disabled: '{{!$form.values.externalSystemId}}',
allowClear: true
},
'x-reactions': {
dependencies: ['externalSystemId'],
fulfill: {
state: {
value: undefined
}, },
run: '{{function runEffect(){if($deps[0]){useAsyncDataSource("/api/v1/jenkins-view/list", { params: { externalSystemId: $deps[0] }, mapping: { label: "viewName", value: "id" } })($self)}else{$self.dataSource=[];}};runEffect()}}' 'x-component': 'Select',
} 'x-component-props': {
}, style: {
"description": "{{$self.dataSource && $self.value ? ($self.dataSource.find(item => item.value === $self.value)?.extra?.description) : undefined}}" width: '100%'
}, },
jobId: { placeholder: '请选择三方系统',
type: 'string', allowClear: true
title: 'Jenkins作业',
'x-decorator': 'FormItem',
'x-decorator-props': {
labelCol: 24,
wrapperCol: 24,
layout: 'vertical',
colon: false,
labelAlign: 'left',
style: {
marginBottom: 24
}
},
'x-component': 'Select',
'x-component-props': {
style: {
width: '100%'
},
placeholder: '请选择Jenkins作业',
disabled: '{{!$form.values.viewId}}',
allowClear: true
},
'x-reactions': {
dependencies: ['externalSystemId', 'viewId'],
fulfill: {
state: {
value: undefined
}, },
run: '{{function runEffect(){if($deps[0] && $deps[1]){useAsyncDataSource("/api/v1/jenkins-job/list", { params: { externalSystemId: $deps[0], viewId: $deps[1] }, mapping: { label: "jobName", value: "id" } })($self)}else{$self.dataSource=[];}};runEffect()}}' 'x-reactions': ["{{useAsyncDataSource('/api/v1/external-system/list', { params: { type: 'JENKINS' }, mapping: { label: 'name', value: 'id' } })}}"],
},
viewId: {
type: 'string',
title: 'Jenkins视图',
'x-decorator': 'FormItem',
'x-decorator-props': {
labelCol: 24,
wrapperCol: 24,
layout: 'vertical',
colon: false,
labelAlign: 'left'
},
'x-component': 'Select',
'x-component-props': {
style: {
width: '100%'
},
placeholder: '请选择Jenkins视图',
disabled: '{{!$form.values.externalSystemId}}',
allowClear: true
},
'x-reactions': {
dependencies: ['externalSystemId'],
fulfill: {
state: {
value: undefined
},
run: '{{function runEffect(){if($deps[0]){useAsyncDataSource("/api/v1/jenkins-view/list", { params: { externalSystemId: $deps[0] }, mapping: { label: "viewName", value: "id" } })($self)}else{$self.dataSource=[];}};runEffect()}}'
}
},
"description": "{{$self.dataSource && $self.value ? ($self.dataSource.find(item => item.value === $self.value)?.extra?.description) : undefined}}"
},
jobId: {
type: 'string',
title: 'Jenkins作业',
'x-decorator': 'FormItem',
'x-decorator-props': {
labelCol: 24,
wrapperCol: 24,
layout: 'vertical',
colon: false,
labelAlign: 'left'
},
'x-component': 'Select',
'x-component-props': {
style: {
width: '100%'
},
placeholder: '请选择Jenkins作业',
disabled: '{{!$form.values.viewId}}',
allowClear: true
},
'x-reactions': {
dependencies: ['externalSystemId', 'viewId'],
fulfill: {
state: {
value: undefined
},
run: '{{function runEffect(){if($deps[0] && $deps[1]){useAsyncDataSource("/api/v1/jenkins-job/list", { params: { externalSystemId: $deps[0], viewId: $deps[1] }, mapping: { label: "jobName", value: "id" } })($self)}else{$self.dataSource=[];}};runEffect()}}'
}
},
"description": "{{$self.dataSource && $self.value ? ($self.dataSource.find(item => item.value === $self.value)?.extra?.description) : undefined}}"
} }
}, }
"description": "{{$self.dataSource && $self.value ? ($self.dataSource.find(item => item.value === $self.value)?.extra?.description) : undefined}}"
} }
} }
}; };
@ -194,7 +196,16 @@ const DeploymentConfigModal: React.FC<DeploymentConfigModalProps> = ({
open={open} open={open}
onCancel={onCancel} onCancel={onCancel}
onOk={() => form.submit(onSuccess)} onOk={() => form.submit(onSuccess)}
width={600} width={800}
styles={{
body: {
padding: '32px'
},
header: {
marginBottom: '8px',
paddingInline: '32px'
}
}}
> >
<FormProvider form={form}> <FormProvider form={form}>
<SchemaField schema={schema}/> <SchemaField schema={schema}/>