2 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
13 * or implied. See the License for the specific language governing
14 * permissions and limitations under the License.
17 import React from 'react';
18 import i18n from 'nfvo-utils/i18n/i18n.js';
20 import Form from 'nfvo-components/input/validation/Form.jsx';
21 import Input from 'nfvo-components/input/validation/Input.jsx';
22 import GridSection from 'nfvo-components/grid/GridSection.jsx';
23 import GridItem from 'nfvo-components/grid/GridItem.jsx';
24 import {forms} from '../SoftwareProductComponentsConstants.js';
26 class ComponentCreationView extends React.Component {
28 let {data = {}, onDataChanged, onCancel, genericFieldInfo} = this.props;
29 let {displayName, description} = data;
33 genericFieldInfo && <Form
36 onSubmit={ () => this.submit() }
37 onReset={ () => onCancel() }
38 submitButtonText={i18n('Create')}
40 isValid={this.props.isFormValid}
41 formReady={this.props.formReady}
42 onValidateForm={() => this.props.onValidateForm(forms.CREATE_FORM) }
43 className='entitlement-pools-form'>
44 <GridSection hasLastColSet>
45 <GridItem colSpan={4} lastColInRow>
48 onChange={displayName => onDataChanged({displayName})}
51 isValid={genericFieldInfo.displayName.isValid}
52 errorText={genericFieldInfo.displayName.errorText}
56 <GridItem colSpan={4} lastColInRow>
58 label={i18n('Description')}
59 onChange={description => onDataChanged({description})}
61 isValid={genericFieldInfo.description.isValid}
62 errorText={genericFieldInfo.description.errorText}
63 data-test-id='description'
74 const {onSubmit, data} = this.props;
79 export default ComponentCreationView;