blob: 4dccc9e1c42e2e151137e12ac7aebbd55ad15f44 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
import React from 'react';
import i18n from 'nfvo-utils/i18n/i18n.js';
import ValidationInput from 'nfvo-components/input/validation/ValidationInput.jsx';
import ValidationForm from 'nfvo-components/input/validation/ValidationForm.jsx';
const LicenseModelPropType = React.PropTypes.shape({
id: React.PropTypes.string,
vendorName: React.PropTypes.string,
description: React.PropTypes.string
});
class LicenseModelCreationView extends React.Component {
static propTypes = {
data: LicenseModelPropType,
onDataChanged: React.PropTypes.func.isRequired,
onSubmit: React.PropTypes.func.isRequired,
onCancel: React.PropTypes.func.isRequired
};
render() {
let {data = {}, onDataChanged} = this.props;
let {vendorName, description} = data;
return (
<div>
<ValidationForm
ref='validationForm'
hasButtons={true}
onSubmit={ () => this.submit() }
onReset={ () => this.props.onCancel() }
labledButtons={true}>
<ValidationInput
value={vendorName}
label={i18n('Vendor Name')}
ref='vendor-name'
onChange={vendorName => onDataChanged({vendorName})}
validations={{maxLength: 25, required: true}}
type='text'
className='field-section'/>
<ValidationInput
value={description}
label={i18n('Description')}
ref='description'
onChange={description => onDataChanged({description})}
validations={{maxLength: 1000, required: true}}
type='textarea'
className='field-section'/>
</ValidationForm>
</div>
);
}
submit() {
const {data:licenseModel} = this.props;
this.props.onSubmit(licenseModel);
}
}
export default LicenseModelCreationView;
|