[SDC] Onboarding 1710 rebase.
[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>
28                                         <div className='vertical-flex'>
29                                                 <label key='label' className='control-label'>{i18n('OS Bit Size')}</label>
30                                                 <div className='radio-options-content-row'>
31                                                         {qgenericFieldInfo['compute/guestOS/bitSize'].enum.map(bitSize => (
32                                                         <Input
33                                                                 data-test-id='guestOS-bitSize'
34                                                                 type='radio'
35                                                                 key={bitSize.enum}
36                                                                 name={'compute/guestOS/bitSize'}
37                                                                 className='radio-field'
38                                                                 value={bitSize.enum}
39                                                                 label={bitSize.title}
40                                                                 onChange={(bit) => onQDataChanged({'compute/guestOS/bitSize' :  Number(bit)})}
41                                                                 isValid={qgenericFieldInfo['compute/guestOS/bitSize'].isValid}
42                                                                 errorText={qgenericFieldInfo['compute/guestOS/bitSize'].errorText}
43                                                                 checked={dataMap['compute/guestOS/bitSize'] === bitSize.enum} /> )) }
44                                                 </div>
45                                         </div>
46                                 </GridItem>
47                                 <GridItem colSpan={2}/>
48                                 <GridItem colSpan={2}>
49                                         <Input
50                                                 data-test-id='guestOS-name'
51                                                 label={i18n('Guest OS')}
52                                                 type='textarea'
53                                                 onChange={(tools) => onQDataChanged({'compute/guestOS/name' : tools})}
54                                                 isValid={qgenericFieldInfo['compute/guestOS/name'].isValid}
55                                                 errorText={qgenericFieldInfo['compute/guestOS/name'].errorText}
56                                                 value={dataMap['compute/guestOS/name']} />
57                                 </GridItem>
58                                 <GridItem colSpan={2}>
59                                         <Input
60                                                 data-test-id='guestOS-tools'
61                                                 type='textarea'
62                                                 label={i18n('Guest OS Tools:')}
63                                                 onChange={(tools) => onQDataChanged({'compute/guestOS/tools' : tools})}
64                                                 isValid={qgenericFieldInfo['compute/guestOS/tools'].isValid}
65                                                 errorText={qgenericFieldInfo['compute/guestOS/tools'].errorText}
66                                                 value={dataMap['compute/guestOS/tools']} />
67                                 </GridItem>
68                         </GridSection>
69
70
71                 </div>
72         );
73 };
74
75 export default GuestOs;