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 = {
type: 'object',
properties: {
externalSystemId: {
type: 'string',
title: '三方系统',
'x-decorator': 'FormItem',
'x-decorator-props': {
labelCol: 24,
wrapperCol: 24,
layout: 'vertical',
colon: false,
labelAlign: 'left',
style: {
marginBottom: 24
}
},
'x-component': 'Select',
layout: {
type: 'void',
'x-component': 'FormGrid',
'x-component-props': {
style: {
width: '100%'
},
placeholder: '请选择三方系统',
allowClear: true
maxColumns: 3,
minColumns: 3,
columnGap: 24
},
'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
properties: {
externalSystemId: {
type: 'string',
title: '三方系统',
'x-decorator': 'FormItem',
'x-decorator-props': {
labelCol: 24,
wrapperCol: 24,
layout: 'vertical',
colon: false,
labelAlign: 'left'
},
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
'x-component': 'Select',
'x-component-props': {
style: {
width: '100%'
},
placeholder: '请选择三方系统',
allowClear: true
},
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}
onCancel={onCancel}
onOk={() => form.submit(onSuccess)}
width={600}
width={800}
styles={{
body: {
padding: '32px'
},
header: {
marginBottom: '8px',
paddingInline: '32px'
}
}}
>
<FormProvider form={form}>
<SchemaField schema={schema}/>