Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 1 | import React, {Component, PropTypes} from 'react'; |
| 2 | import Button from 'react-bootstrap/lib/Button.js'; |
| 3 | import Sequencer from 'dox-sequence-diagram-ui'; |
| 4 | |
| 5 | import i18n from 'nfvo-utils/i18n/i18n.js'; |
| 6 | |
| 7 | class SequenceDiagram extends Component { |
| 8 | |
| 9 | static propTypes = { |
| 10 | onSave: PropTypes.func.isRequired, |
| 11 | onClose: PropTypes.func.isRequired, |
| 12 | model: PropTypes.object.isRequired |
| 13 | }; |
| 14 | |
| 15 | onSave() { |
| 16 | this.props.onSave(this.refs.sequencer.getModel()); |
| 17 | } |
| 18 | |
| 19 | render() { |
| 20 | return ( |
| 21 | <div className='sequence-diagram'> |
| 22 | <div className='sequence-diagram-sequencer'> |
| 23 | <Sequencer ref='sequencer' options={{useHtmlSelect: true}} model={this.props.model} /> |
| 24 | </div> |
| 25 | <div className='sequence-diagram-action-buttons'> |
| 26 | <Button className='primary-btn' onClick={() => this.onSave()}>{i18n('Save')}</Button> |
| 27 | <Button className='primary-btn' onClick={this.props.onClose}>{i18n('Close')}</Button> |
| 28 | </div> |
| 29 | </div> |
| 30 | ); |
| 31 | } |
| 32 | |
| 33 | } |
| 34 | |
| 35 | export default SequenceDiagram; |