/*! * 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 Form from 'nfvo-components/input/validation/Form.jsx'; import ListEditorView from 'nfvo-components/listEditor/ListEditorView.jsx'; import ListEditorItemView from 'nfvo-components/listEditor/ListEditorItemView.jsx'; import ListEditorItemViewField from 'nfvo-components/listEditor/ListEditorItemViewField.jsx'; import Input from'nfvo-components/input/validation/Input.jsx'; import Modal from 'nfvo-components/modal/Modal.jsx'; import SoftwareProductComponentsNICEditor from './SoftwareProductComponentsNICEditor.js'; class SoftwareProductComponentsNetworkView extends React.Component { state = { localFilter: '' }; render() { let {dataMap, qgenericFieldInfo, onQDataChanged, isModalInEditMode, isDisplayModal, softwareProductId, componentId, isReadOnlyMode} = this.props; return(
{ qgenericFieldInfo &&
this.save()} isReadOnlyMode={isReadOnlyMode} hasButtons={false}>

{i18n('Network Capacity')}

{ const selectedIndex = e.target.selectedIndex; const val = e.target.options[selectedIndex].value; onQDataChanged({'network/networkCapacity/protocolWithHighestTrafficProfileAcrossAllNICs' : val});} }> { qgenericFieldInfo['network/networkCapacity/protocolWithHighestTrafficProfileAcrossAllNICs'].enum.map(proto => ) }
onQDataChanged({'network/networkCapacity/networkTransactionsPerSecond' : ntps})} isValid={qgenericFieldInfo['network/networkCapacity/networkTransactionsPerSecond'].isValid} errorText={qgenericFieldInfo['network/networkCapacity/networkTransactionsPerSecond'].errorText} value={dataMap['network/networkCapacity/networkTransactionsPerSecond']} />
}
{this.renderNicList()}
{isModalInEditMode ? i18n('Edit NIC') : i18n('Create New NIC')} { }
); } renderNicList() { const {localFilter} = this.state; let {isReadOnlyMode} = this.props; return ( this.setState({localFilter: value})} twoColumns> {this.filterList().map(nic => this.renderNicListItem(nic, isReadOnlyMode))} ); } renderNicListItem(nic, isReadOnlyMode) { let {id, name, description, networkName = ''} = nic; let {onEditNicClick, version} = this.props; return ( onEditNicClick(nic, version)}>
{name}
{i18n('Purpose of NIC')}
{description}
{i18n('Network')}
{networkName}
); } filterList() { let {nicList} = this.props; let {localFilter} = this.state; if (localFilter.trim()) { const filter = new RegExp(escape(localFilter), 'i'); return nicList.filter(({name = '', description = ''}) => { return escape(name).match(filter) || escape(description).match(filter); }); } else { return nicList; } } save() { let {onSubmit, qdata, version} = this.props; return onSubmit({qdata, version}); } } export default SoftwareProductComponentsNetworkView;