This commit is contained in:
dengqichen 2025-01-17 17:39:48 +08:00
parent 00e166a4f3
commit 335e86c5be

View File

@ -92,78 +92,97 @@ const DeploymentConfigModal: React.FC<DeploymentConfigModalProps> = ({
const schema: ISchema = { const schema: ISchema = {
type: 'object', type: 'object',
properties: { properties: {
layout: { externalSystemId: {
type: 'void', type: 'string',
'x-component': 'FormGrid', title: '三方系统',
'x-component-props': { 'x-decorator': 'FormItem',
maxColumns: 2, 'x-decorator-props': {
minColumns: 2, labelCol: 24,
columnGap: 24 wrapperCol: 24,
}, layout: 'vertical',
properties: { colon: false,
externalSystemId: { labelAlign: 'left',
type: 'string', style: {
title: '三方系统', marginBottom: 24
'x-decorator': 'FormItem',
'x-component': 'Select',
'x-component-props': {
style: {
width: '100%'
},
placeholder: '请选择三方系统',
allowClear: true
},
'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-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-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}}"
} }
} },
'x-component': 'Select',
'x-component-props': {
style: {
width: '100%'
},
placeholder: '请选择三方系统',
allowClear: true
},
'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',
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()}}'
}
},
"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',
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()}}'
}
},
"description": "{{$self.dataSource && $self.value ? ($self.dataSource.find(item => item.value === $self.value)?.extra?.description) : undefined}}"
} }
} }
}; };
@ -171,24 +190,14 @@ const DeploymentConfigModal: React.FC<DeploymentConfigModalProps> = ({
return ( return (
<> <>
<Modal <Modal
title={`部署配置`} title="部署配置"
open={open} open={open}
width={800} onCancel={onCancel}
className="deployment-config-modal" onOk={() => form.submit(onSuccess)}
maskClosable={false} width={600}
destroyOnClose
style={{top: 50}}
styles={{
body: {
height: 'calc(100vh - 250px)',
overflowY: 'auto',
padding: '24px'
}
}}
> >
<FormProvider form={form}> <FormProvider form={form}>
<SchemaField schema={schema} scope={{useAsyncDataSource}}/> <SchemaField schema={schema}/>
</FormProvider> </FormProvider>
</Modal> </Modal>
</> </>