Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame^] | 1 | import React, {Component} from 'react'; |
| 2 | import i18n from 'nfvo-utils/i18n/i18n.js'; |
| 3 | import Input from 'nfvo-components/input/validation/ValidationInput.jsx'; |
| 4 | import Form from 'nfvo-components/input/validation/ValidationForm.jsx'; |
| 5 | |
| 6 | class FlowsEditorModalView extends Component { |
| 7 | |
| 8 | render() { |
| 9 | let {onCancel, onDataChanged, currentFlow} = this.props; |
| 10 | let {artifactName, description} = currentFlow; |
| 11 | return ( |
| 12 | <Form onSubmit={() => this.onSaveClicked()} onReset={onCancel}> |
| 13 | <Input |
| 14 | type='text' |
| 15 | name='name' |
| 16 | label={i18n('Name')} |
| 17 | validations={{required: true}} |
| 18 | value={artifactName} |
| 19 | onChange={artifactName => onDataChanged({artifactName})}/> |
| 20 | <Input |
| 21 | type='textarea' |
| 22 | name='description' |
| 23 | label={i18n('Description')} |
| 24 | validations={{required: true}} |
| 25 | value={description} |
| 26 | onChange={description => onDataChanged({description})}/> |
| 27 | </Form> |
| 28 | ); |
| 29 | } |
| 30 | |
| 31 | onSaveClicked() { |
| 32 | let {currentFlow, onSubmit} = this.props; |
| 33 | if (onSubmit) { |
| 34 | onSubmit(currentFlow); |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | } |
| 39 | |
| 40 | export default FlowsEditorModalView; |