7a730d6f94a3d8de9fd63ebf0b3fc175fb1fb2c7
[sdc.git] / openecomp-ui / src / sdc-app / onboarding / softwareProduct / components / compute / computeComponents / GuestOs.jsx
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 i18n from 'nfvo-utils/i18n/i18n.js';
18 import Input from 'nfvo-components/input/validation/Input.jsx';
19 import GridSection from 'nfvo-components/grid/GridSection.jsx';
20 import GridItem from 'nfvo-components/grid/GridItem.jsx';
21
22
23 const GuestOs = ({qgenericFieldInfo, dataMap, onQDataChanged}) => {
24         return(
25                 <div>
26                         <GridSection title={i18n('Guest OS')} >
27                                 <GridItem colSpan={2}>
28                                         <Input
29                                                 data-test-id='guestOS-name'
30                                                 label={i18n('Guest OS')}
31                                                 type='text'
32                                                 onChange={(tools) => onQDataChanged({'compute/guestOS/name' : tools})}
33                                                 isValid={qgenericFieldInfo['compute/guestOS/name'].isValid}
34                                                 errorText={qgenericFieldInfo['compute/guestOS/name'].errorText}
35                                                 value={dataMap['compute/guestOS/name']} />
36                                 </GridItem>
37                                 <GridItem colSpan={2}/>
38                                 <GridItem>
39                                         <div className='vertical-flex'>
40                                                 <label key='label' className='control-label'>{i18n('OS Bit Size')}</label>
41                                                 <div className='radio-options-content-row'>
42                                                         {qgenericFieldInfo['compute/guestOS/bitSize'].enum.map(bitSize => (
43                                                         <Input
44                                                                 data-test-id='guestOS-bitSize'
45                                                                 type='radio'
46                                                                 key={bitSize.enum}
47                                                                 name={'compute/guestOS/bitSize'}
48                                                                 className='radio-field'
49                                                                 value={bitSize.enum}
50                                                                 label={bitSize.title}
51                                                                 onChange={(bit) => onQDataChanged({'compute/guestOS/bitSize' :  Number(bit)})}
52                                                                 isValid={qgenericFieldInfo['compute/guestOS/bitSize'].isValid}
53                                                                 errorText={qgenericFieldInfo['compute/guestOS/bitSize'].errorText}
54                                                                 checked={dataMap['compute/guestOS/bitSize'] === bitSize.enum} /> )) }
55                                                 </div>
56                                         </div>
57                                 </GridItem>
58                                 <GridItem colSpan={2}/>
59                                 <GridItem colSpan={2}>
60                                         <Input
61                                                 data-test-id='guestOS-tools'
62                                                 type='textarea'
63                                                 label={i18n('Guest OS Tools:')}
64                                                 onChange={(tools) => onQDataChanged({'compute/guestOS/tools' : tools})}
65                                                 isValid={qgenericFieldInfo['compute/guestOS/tools'].isValid}
66                                                 errorText={qgenericFieldInfo['compute/guestOS/tools'].errorText}
67                                                 value={dataMap['compute/guestOS/tools']} />
68                                 </GridItem>
69                         </GridSection>
70
71
72                 </div>
73         );
74 };
75
76 export default GuestOs;