-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
display Min copies / node tag / disk tag in bi table
Signed-off-by: andy.lee <andy.lee@suse.com>
- Loading branch information
Showing
13 changed files
with
266 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import { Form, InputNumber } from 'antd' | ||
import { ModalBlur } from '../../components' | ||
|
||
const FormItem = Form.Item | ||
|
||
const formItemLayout = { | ||
labelCol: { | ||
span: 12, | ||
}, | ||
wrapperCol: { | ||
span: 12, | ||
}, | ||
} | ||
|
||
const modal = ({ | ||
item, | ||
defaultNumberOfReplicas, | ||
visible, | ||
onCancel, | ||
onOk, | ||
form: { | ||
getFieldDecorator, | ||
validateFields, | ||
getFieldValue, | ||
}, | ||
}) => { | ||
function handleOk() { | ||
validateFields((errors) => { | ||
if (errors) { | ||
return | ||
} | ||
const minNumberOfCopies = getFieldValue('minNumberOfCopies') | ||
onOk(item, minNumberOfCopies) | ||
}) | ||
} | ||
|
||
const modalOpts = { | ||
title: 'Update Minimum Copies Count', | ||
visible, | ||
onCancel, | ||
onOk: handleOk, | ||
} | ||
if (!item) { | ||
return null | ||
} | ||
return ( | ||
<ModalBlur {...modalOpts}> | ||
<Form layout="horizontal"> | ||
<FormItem label="Minimum Number of Copies" hasFeedback {...formItemLayout}> | ||
{getFieldDecorator('minNumberOfCopies', { | ||
initialValue: item.minNumberOfCopies || defaultNumberOfReplicas, | ||
rules: [ | ||
{ | ||
required: true, | ||
message: 'Please input the copies number', | ||
}, | ||
], | ||
})(<InputNumber min={1} />)} | ||
</FormItem> | ||
</Form> | ||
</ModalBlur> | ||
) | ||
} | ||
|
||
modal.propTypes = { | ||
defaultNumberOfReplicas: PropTypes.number, | ||
form: PropTypes.object.isRequired, | ||
visible: PropTypes.bool, | ||
onCancel: PropTypes.func, | ||
item: PropTypes.object, | ||
onOk: PropTypes.func, | ||
} | ||
|
||
export default Form.create()(modal) |
Oops, something went wrong.