/*! * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing * permissions and limitations under the License. */ import React from 'react'; import PropTypes from 'prop-types'; import i18n from 'nfvo-utils/i18n/i18n.js'; import Input from 'nfvo-components/input/validation/Input.jsx'; import Form from 'nfvo-components/input/validation/Form.jsx'; import GridSection from 'nfvo-components/grid/GridSection.jsx'; import GridItem from 'nfvo-components/grid/GridItem.jsx'; import classnames from 'classnames'; const BackupSection = ({isReadOnlyMode,dataMap, onQDataChanged, qgenericFieldInfo}) => (
{qgenericFieldInfo['storage/backup/backupType'].enum.map(onSite => ( onQDataChanged({'storage/backup/backupType' : site})} isValid={qgenericFieldInfo['storage/backup/backupType'].isValid} errorText={qgenericFieldInfo['storage/backup/backupType'].errorText} checked={dataMap['storage/backup/backupType'] === onSite.enum} /> )) }
onQDataChanged({'storage/backup/backupSolution' : backupSolution})} label={i18n('Backup Solution')} type='text' isValid={qgenericFieldInfo['storage/backup/backupSolution'].isValid} errorText={qgenericFieldInfo['storage/backup/backupSolution'].errorText} value={dataMap['storage/backup/backupSolution']}/> onQDataChanged({'storage/backup/backupStorageSize' : backupStorageSize})} label={i18n('Backup Storage Size (GB)')} type='number' isValid={qgenericFieldInfo['storage/backup/backupStorageSize'].isValid} errorText={qgenericFieldInfo['storage/backup/backupStorageSize'].errorText} value={dataMap['storage/backup/backupStorageSize']}/> { const selectedIndex = e.target.selectedIndex; const val = e.target.options[selectedIndex].value; onQDataChanged({'storage/backup/backupNIC' : val});} }> {qgenericFieldInfo['storage/backup/backupNIC'].enum.map(hv => )}
); const SnapshotBackupSection = ({dataMap, onQDataChanged, qgenericFieldInfo}) => ( onQDataChanged({'storage/snapshotBackup/snapshotFrequency' : snapshotFrequency})} label={i18n('Backup Storage Size (GB)')} type='number' isValid={qgenericFieldInfo['storage/snapshotBackup/snapshotFrequency'].isValid} errorText={qgenericFieldInfo['storage/snapshotBackup/snapshotFrequency'].errorText} value={dataMap['storage/snapshotBackup/snapshotFrequency']}/> ); const LogBackupSection = ({dataMap, onQDataChanged, qgenericFieldInfo}) => ( onQDataChanged({'storage/logBackup/sizeOfLogFiles' : sizeOfLogFiles})} label={i18n('Backup Storage Size (GB)')} type='number' isValid={qgenericFieldInfo['storage/logBackup/sizeOfLogFiles'].isValid} errorText={qgenericFieldInfo['storage/logBackup/sizeOfLogFiles'].errorText} value={dataMap['storage/logBackup/sizeOfLogFiles']}/> onQDataChanged({'storage/logBackup/logRetentionPeriod' : logRetentionPeriod})} type='number' isValid={qgenericFieldInfo['storage/logBackup/logRetentionPeriod'].isValid} errorText={qgenericFieldInfo['storage/logBackup/logRetentionPeriod'].errorText} value={dataMap['storage/logBackup/logRetentionPeriod']}/> onQDataChanged({'storage/logBackup/logBackupFrequency' : logBackupFrequency})} type='number' isValid={qgenericFieldInfo['storage/logBackup/logBackupFrequency'].isValid} errorText={qgenericFieldInfo['storage/logBackup/logBackupFrequency'].errorText} value={dataMap['storage/logBackup/logBackupFrequency']}/> onQDataChanged({'storage/logBackup/logFileLocation' : logFileLocation})} type='text' isValid={qgenericFieldInfo['storage/logBackup/logFileLocation'].isValid} errorText={qgenericFieldInfo['storage/logBackup/logFileLocation'].errorText} value={dataMap['storage/logBackup/logFileLocation']}/> ); class SoftwareProductComponentStorageView extends React.Component { static propTypes = { componentId: PropTypes.string, onQDataChanged: PropTypes.func, onSubmit: PropTypes.func, isReadOnlyMode: PropTypes.bool }; render() { let {onQDataChanged, dataMap, qGenericFieldInfo, isReadOnlyMode, onSubmit, qdata} = this.props; return(
{qGenericFieldInfo &&
this.form = form } isValid={true} formReady={null} onSubmit={() => onSubmit({qdata})} className='component-questionnaire-validation-form' isReadOnlyMode={isReadOnlyMode} hasButtons={false}> }
); } save(){ const {qdata, onSubmit} = this.props; return onSubmit({qdata}); } } export default SoftwareProductComponentStorageView;