967c6f7aef1af7ab44cfcad3e24e5a1986740c5a
[sdc.git] /
1 /*!
2  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16 import React from 'react';
17 import PropTypes from 'prop-types';
18 import i18n from 'nfvo-utils/i18n/i18n.js';
19 import Input from 'nfvo-components/input/validation/Input.jsx';
20 import GridSection from 'nfvo-components/grid/GridSection.jsx';
21 import GridItem from 'nfvo-components/grid/GridItem.jsx';
22
23
24 const NumberOfVms = ({qgenericFieldInfo, dataMap, onQDataChanged, qValidateData, customValidations}) => {
25         return(
26                 <GridSection titleClassName='software-product-compute-number-of-vms' title={i18n('NUMBER OF VMs')}>
27                         <GridItem>
28                                 <Input
29                                         data-test-id='numOfVMs-minimum'
30                                         type='number'
31                                         label={i18n('Minimum')}
32                                         onChange={(tools) => { onQDataChanged({'compute/numOfVMs/minimum' : tools}, customValidations);
33                                                 qValidateData({'compute/numOfVMs/maximum' : dataMap['compute/numOfVMs/maximum']}, customValidations); } }
34                                         isValid={qgenericFieldInfo['compute/numOfVMs/minimum'].isValid}
35                                         errorText={qgenericFieldInfo['compute/numOfVMs/minimum'].errorText}
36                                         value={dataMap['compute/numOfVMs/minimum']} />
37                         </GridItem>
38                         <GridItem>
39                                 <Input
40                                         data-test-id='numOfVMs-maximum'
41                                         type='number'
42                                         label={i18n('Maximum')}
43                                         onChange={(tools) => { onQDataChanged({'compute/numOfVMs/maximum' : tools}, customValidations);
44                                                 qValidateData({'compute/numOfVMs/minimum' : dataMap['compute/numOfVMs/minimum']}, customValidations); } }
45                                         isValid={qgenericFieldInfo['compute/numOfVMs/maximum'].isValid}
46                                         errorText={qgenericFieldInfo['compute/numOfVMs/maximum'].errorText}
47                                         value={dataMap['compute/numOfVMs/maximum']} />
48                         </GridItem>
49                 </GridSection>
50         );
51 };
52
53 NumberOfVms.propTypes = {
54         minNumberOfVMsSelectedByUser: PropTypes.number
55 };
56
57 export default NumberOfVms;