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.
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 Form from 'nfvo-components/input/validation/Form.jsx';
21 import GridSection from 'nfvo-components/grid/GridSection.jsx';
22 import GridItem from 'nfvo-components/grid/GridItem.jsx';
23 import classnames from 'classnames';
25 const BackupSection = ({
31 <GridSection title={i18n('Backup')}>
33 <div className="vertical-flex">
36 className={classnames('control-label', {
37 disabled: isReadOnlyMode
41 <div className="radio-options-content-row">
42 {qgenericFieldInfo['storage/backup/backupType'].enum.map(
45 data-test-id="backupType"
48 name={'compute/guestOS/bitSize'}
49 className="radio-field"
54 'storage/backup/backupType': site
59 'storage/backup/backupType'
64 'storage/backup/backupType'
68 dataMap['storage/backup/backupType'] ===
79 className="section-field"
80 data-test-id="backupSolution"
81 onChange={backupSolution =>
83 'storage/backup/backupSolution': backupSolution
86 label={i18n('Backup Solution')}
89 qgenericFieldInfo['storage/backup/backupSolution'].isValid
92 qgenericFieldInfo['storage/backup/backupSolution'].errorText
94 value={dataMap['storage/backup/backupSolution']}
99 className="section-field"
100 data-test-id="backupStorageSize"
101 onChange={backupStorageSize =>
103 'storage/backup/backupStorageSize': backupStorageSize
106 label={i18n('Backup Storage Size (GB)')}
109 qgenericFieldInfo['storage/backup/backupStorageSize']
113 qgenericFieldInfo['storage/backup/backupStorageSize']
116 value={dataMap['storage/backup/backupStorageSize']}
121 data-test-id="backupNIC"
122 label={i18n('Backup NIC')}
124 className="input-options-select section-field"
125 groupClassName="bootstrap-input-options"
126 isValid={qgenericFieldInfo['storage/backup/backupNIC'].isValid}
128 qgenericFieldInfo['storage/backup/backupNIC'].errorText
130 value={dataMap['storage/backup/backupNIC']}
132 const selectedIndex = e.target.selectedIndex;
133 const val = e.target.options[selectedIndex].value;
134 onQDataChanged({ 'storage/backup/backupNIC': val });
136 <option key="placeholder" value="">
139 {qgenericFieldInfo['storage/backup/backupNIC'].enum.map(hv => (
140 <option value={hv.enum} key={hv.enum}>
149 const SnapshotBackupSection = ({
154 <GridSection title={i18n('Snapshot Backup')}>
157 className="section-field"
158 data-test-id="snapshotFrequency"
159 onChange={snapshotFrequency =>
161 'storage/snapshotBackup/snapshotFrequency': snapshotFrequency
164 label={i18n('Backup Storage Size (GB)')}
168 'storage/snapshotBackup/snapshotFrequency'
173 'storage/snapshotBackup/snapshotFrequency'
176 value={dataMap['storage/snapshotBackup/snapshotFrequency']}
182 const LogBackupSection = ({ dataMap, onQDataChanged, qgenericFieldInfo }) => (
183 <GridSection title={i18n('Log Backup')}>
186 className="section-field"
187 data-test-id="sizeOfLogFiles"
188 onChange={sizeOfLogFiles =>
190 'storage/logBackup/sizeOfLogFiles': sizeOfLogFiles
193 label={i18n('Backup Storage Size (GB)')}
196 qgenericFieldInfo['storage/logBackup/sizeOfLogFiles']
200 qgenericFieldInfo['storage/logBackup/sizeOfLogFiles']
203 value={dataMap['storage/logBackup/sizeOfLogFiles']}
208 className="section-field"
209 label={i18n('Log Retention Period (days)')}
210 data-test-id="logRetentionPeriod"
211 onChange={logRetentionPeriod =>
213 'storage/logBackup/logRetentionPeriod': logRetentionPeriod
218 qgenericFieldInfo['storage/logBackup/logRetentionPeriod']
222 qgenericFieldInfo['storage/logBackup/logRetentionPeriod']
225 value={dataMap['storage/logBackup/logRetentionPeriod']}
230 className="section-field"
231 label={i18n('Log Backup Frequency (days)')}
232 data-test-id="logBackupFrequency"
233 onChange={logBackupFrequency =>
235 'storage/logBackup/logBackupFrequency': logBackupFrequency
240 qgenericFieldInfo['storage/logBackup/logBackupFrequency']
244 qgenericFieldInfo['storage/logBackup/logBackupFrequency']
247 value={dataMap['storage/logBackup/logBackupFrequency']}
252 className="section-field"
253 label={i18n('Log File Location')}
254 data-test-id="logFileLocation"
255 onChange={logFileLocation =>
257 'storage/logBackup/logFileLocation': logFileLocation
262 qgenericFieldInfo['storage/logBackup/logFileLocation']
266 qgenericFieldInfo['storage/logBackup/logFileLocation']
269 value={dataMap['storage/logBackup/logFileLocation']}
275 class SoftwareProductComponentStorageView extends React.Component {
277 componentId: PropTypes.string,
278 onQDataChanged: PropTypes.func,
279 onSubmit: PropTypes.func,
280 isReadOnlyMode: PropTypes.bool
294 <div className="vsp-component-questionnaire-view">
295 {qGenericFieldInfo && (
297 ref={form => (this.form = form)}
300 onSubmit={() => onSubmit({ qdata })}
301 className="component-questionnaire-validation-form"
302 isReadOnlyMode={isReadOnlyMode}
305 isReadOnlyMode={isReadOnlyMode}
306 onQDataChanged={onQDataChanged}
308 qgenericFieldInfo={qGenericFieldInfo}
310 <SnapshotBackupSection
311 onQDataChanged={onQDataChanged}
313 qgenericFieldInfo={qGenericFieldInfo}
316 onQDataChanged={onQDataChanged}
318 qgenericFieldInfo={qGenericFieldInfo}
327 const { qdata, onSubmit } = this.props;
328 return onSubmit({ qdata });
332 export default SoftwareProductComponentStorageView;