优化批量执行模板可取消已选择的主机

pull/605/head
vapao 2023-03-29 18:38:09 +08:00
parent 5e87b8763d
commit 393e36e0cf
2 changed files with 3 additions and 2 deletions

View File

@ -135,7 +135,7 @@ export default observer(function () {
<Button type="link" style={{padding: 0}} onClick={() => setParameter({})}>添加参数</Button> <Button type="link" style={{padding: 0}} onClick={() => setParameter({})}>添加参数</Button>
</Form.Item> </Form.Item>
<Form.Item label="目标主机"> <Form.Item label="目标主机">
<HostSelector value={info.host_ids} onChange={ids => info.host_ids = ids}/> <HostSelector nullable value={info.host_ids} onChange={ids => info.host_ids = ids}/>
</Form.Item> </Form.Item>
<Form.Item name="desc" label="备注信息"> <Form.Item name="desc" label="备注信息">
<Input.TextArea placeholder="请输入模板备注信息"/> <Input.TextArea placeholder="请输入模板备注信息"/>

View File

@ -146,7 +146,7 @@ function HostSelector(props) {
className={styles.modal} className={styles.modal}
title={props.title || '主机列表'} title={props.title || '主机列表'}
onOk={handleSubmit} onOk={handleSubmit}
okButtonProps={{disabled: selectedRowKeys.length === 0}} okButtonProps={{disabled: selectedRowKeys.length === 0 && !props.nullable}}
confirmLoading={loading} confirmLoading={loading}
onCancel={handleClose}> onCancel={handleClose}>
<Row> <Row>
@ -209,6 +209,7 @@ HostSelector.defaultProps = {
value: [], value: [],
type: 'text', type: 'text',
mode: 'ids', mode: 'ids',
nullable: false,
onChange: () => null onChange: () => null
} }