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 i18n from 'nfvo-utils/i18n/i18n.js';
18 import Form from 'nfvo-components/input/validation/Form.jsx';
20 import ListEditorView from 'nfvo-components/listEditor/ListEditorView.jsx';
21 import ListEditorItemView from 'nfvo-components/listEditor/ListEditorItemView.jsx';
22 import ListEditorItemViewField from 'nfvo-components/listEditor/ListEditorItemViewField.jsx';
23 import Input from 'nfvo-components/input/validation/Input.jsx';
25 class SoftwareProductComponentsNetworkView extends React.Component {
39 <div className="vsp-components-network">
40 <div className="network-data">
42 {qgenericFieldInfo && (
46 onSubmit={() => this.save()}
47 isReadOnlyMode={isReadOnlyMode}
49 <h3 className="section-title">
50 {i18n('Network Capacity')}
52 <div className="rows-section">
53 <div className="row-flex-components">
54 <div className="single-col">
56 data-test-id="protocolWithHighestTrafficProfileAcrossAllNICs"
58 'Protocol with Highest Traffic Profile across all NICs'
61 groupClassName="bootstrap-input-options"
62 className="input-options-select"
65 'network/networkCapacity/protocolWithHighestTrafficProfileAcrossAllNICs'
70 'network/networkCapacity/protocolWithHighestTrafficProfileAcrossAllNICs'
75 'network/networkCapacity/protocolWithHighestTrafficProfileAcrossAllNICs'
80 e.target.selectedIndex;
86 'network/networkCapacity/protocolWithHighestTrafficProfileAcrossAllNICs': val
95 'network/networkCapacity/protocolWithHighestTrafficProfileAcrossAllNICs'
105 <div className="single-col add-line-break">
107 data-test-id="networkTransactionsPerSecond"
109 'Network Transactions per Second'
114 'network/networkCapacity/networkTransactionsPerSecond': ntps
119 'network/networkCapacity/networkTransactionsPerSecond'
124 'network/networkCapacity/networkTransactionsPerSecond'
129 'network/networkCapacity/networkTransactionsPerSecond'
134 <div className="empty-two-col" />
140 {this.renderNicList()}
147 const { localFilter } = this.state;
148 let { isReadOnlyMode, onAddNic, isManual } = this.props;
151 title={i18n('Interfaces')}
152 filterValue={localFilter}
153 placeholder={i18n('Filter NICs by Name')}
154 isReadOnlyMode={isReadOnlyMode}
155 onFilter={value => this.setState({ localFilter: value })}
156 onAdd={isManual ? onAddNic : null}
157 plusButtonTitle={i18n('Add NIC')}
159 {this.filterList().map(nic =>
160 this.renderNicListItem(nic, isReadOnlyMode)
166 renderNicListItem(nic, isReadOnlyMode) {
167 let { id, name, description, networkName = '' } = nic;
168 let { onEditNicClick, version, isManual, onDeleteNic } = this.props;
172 isReadOnlyMode={isReadOnlyMode}
173 onSelect={() => onEditNicClick(nic, version, isReadOnlyMode)}
174 onDelete={isManual ? () => onDeleteNic(nic, version) : null}>
175 <ListEditorItemViewField>
176 <div className="name">{name}</div>
177 </ListEditorItemViewField>
178 <ListEditorItemViewField>
179 <div className={isManual ? 'details-col' : 'details'}>
180 <div className={isManual ? 'manual-title' : 'title'}>
181 {i18n('Purpose of NIC')}
184 <div className={isManual ? 'description' : ''}>
190 <div className="details">
191 <div className="title">{i18n('Network')}</div>
192 <div className="artifact-name">{networkName}</div>
195 </ListEditorItemViewField>
196 </ListEditorItemView>
201 let { nicList } = this.props;
202 let { localFilter } = this.state;
203 if (localFilter.trim()) {
204 const filter = new RegExp(escape(localFilter), 'i');
205 return nicList.filter(({ name = '', description = '' }) => {
207 escape(name).match(filter) ||
208 escape(description).match(filter)
217 let { onSubmit, qdata, version } = this.props;
218 return onSubmit({ qdata, version });
222 export default SoftwareProductComponentsNetworkView;