/*! * 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 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'; const GeneralSection = ({ onDataChanged, displayName, vfcCode, nfcFunction, description, isReadOnlyMode, genericFieldInfo, isManual }) => ( {/* disabled until backend will be ready to implement it
{name}
*/} {!isManual && ( onDataChanged({ vfcCode })} disabled={isReadOnlyMode} type="text" /> )} onDataChanged({ nfcFunction })} disabled={isReadOnlyMode} type="text" /> onDataChanged({ description })} disabled={isReadOnlyMode} value={description} groupClassName="multi-line-textarea" data-test-id="description" type="textarea" />
); const HypervisorSection = ({ dataMap, onQDataChanged, qgenericFieldInfo }) => ( { const selectedIndex = e.target.selectedIndex; const val = e.target.options[selectedIndex].value; onQDataChanged({ 'general/hypervisor/hypervisor': val }); }}> {qgenericFieldInfo['general/hypervisor/hypervisor'].enum.map( hv => ( ) )} onQDataChanged({ 'general/hypervisor/drivers': driver }) } label={i18n('Hypervisor Drivers')} type="text" isValid={ qgenericFieldInfo['general/hypervisor/drivers'].isValid } errorText={ qgenericFieldInfo['general/hypervisor/drivers'].errorText } value={dataMap['general/hypervisor/drivers']} /> onQDataChanged({ 'general/hypervisor/containerFeaturesDescription': containerFeaturesDescription }) } isValid={ qgenericFieldInfo[ 'general/hypervisor/containerFeaturesDescription' ].isValid } errorText={ qgenericFieldInfo[ 'general/hypervisor/containerFeaturesDescription' ].errorText } value={ dataMap['general/hypervisor/containerFeaturesDescription'] } /> ); const ImageSection = ({ dataMap, onQDataChanged, qgenericFieldInfo }) => ( onQDataChanged({ 'general/disk/bootDiskSizePerVM': bootDiskSizePerVM }) } label={i18n('Size of boot disk per VM (GB)')} type="number" isValid={ qgenericFieldInfo['general/disk/bootDiskSizePerVM'].isValid } errorText={ qgenericFieldInfo['general/disk/bootDiskSizePerVM'] .errorText } value={dataMap['general/disk/bootDiskSizePerVM']} /> onQDataChanged({ 'general/disk/ephemeralDiskSizePerVM': ephemeralDiskSizePerVM }) } label={i18n('Size of ephemeral disk per VM (GB)')} type="number" isValid={ qgenericFieldInfo['general/disk/ephemeralDiskSizePerVM'] .isValid } errorText={ qgenericFieldInfo['general/disk/ephemeralDiskSizePerVM'] .errorText } value={dataMap['general/disk/ephemeralDiskSizePerVM']} /> ); const RecoverySection = ({ dataMap, onQDataChanged, qgenericFieldInfo }) => ( onQDataChanged({ 'general/recovery/pointObjective': pointObjective }) } isValid={ qgenericFieldInfo['general/recovery/pointObjective'].isValid } errorText={ qgenericFieldInfo['general/recovery/pointObjective'] .errorText } value={dataMap['general/recovery/pointObjective']} /> onQDataChanged({ 'general/recovery/timeObjective': timeObjective }) } isValid={ qgenericFieldInfo['general/recovery/timeObjective'].isValid } errorText={ qgenericFieldInfo['general/recovery/timeObjective'] .errorText } value={dataMap['general/recovery/timeObjective']} />
onQDataChanged({ 'general/recovery/vmProcessFailuresHandling': vmProcessFailuresHandling }) } isValid={ qgenericFieldInfo[ 'general/recovery/vmProcessFailuresHandling' ].isValid } errorText={ qgenericFieldInfo[ 'general/recovery/vmProcessFailuresHandling' ].errorText } value={dataMap['general/recovery/vmProcessFailuresHandling']} />
{/** disabled until backend will be ready to implement it
*/} ); const DNSConfigurationSection = ({ dataMap, onQDataChanged, qgenericFieldInfo }) => ( onQDataChanged({ 'general/dnsConfiguration': dnsConfiguration }) } isValid={qgenericFieldInfo['general/dnsConfiguration'].isValid} errorText={ qgenericFieldInfo['general/dnsConfiguration'].errorText } value={dataMap['general/dnsConfiguration']} /> ); const CloneSection = ({ dataMap, onQDataChanged, qgenericFieldInfo }) => ( onQDataChanged({ 'general/vmCloneUsage': vmCloneUsage }) } isValid={qgenericFieldInfo['general/vmCloneUsage'].isValid} errorText={qgenericFieldInfo['general/vmCloneUsage'].errorText} value={dataMap['general/vmCloneUsage']} /> ); class SoftwareProductComponentsGeneralView extends React.Component { render() { let { isManual, onQDataChanged, onDataChanged, genericFieldInfo, dataMap, qGenericFieldInfo, componentData: { displayName, vfcCode, nfcFunction, description }, isReadOnlyMode } = this.props; return (
{genericFieldInfo && qGenericFieldInfo && (
this.props.onValidityChanged(isValidityData) } hasButtons={false}> )}
); } save() { let { onSubmit, componentData, qdata } = this.props; return onSubmit({ componentData, qdata }); } } export default SoftwareProductComponentsGeneralView;