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';
19 import ListEditorView from 'nfvo-components/listEditor/ListEditorView.jsx';
20 import ListEditorItemView from 'nfvo-components/listEditor/ListEditorItemView.jsx';
21 import ListEditorItemViewField from 'nfvo-components/listEditor/ListEditorItemViewField.jsx';
23 class SoftwareProductNetworksView extends React.Component {
26 networksList: React.PropTypes.arrayOf(React.PropTypes.shape({
27 id: React.PropTypes.string.isRequired,
28 name: React.PropTypes.string.isRequired,
29 dhcp: React.PropTypes.bool.isRequired
38 const {localFilter} = this.state;
41 <div className='vsp-networks-page'>
43 title={i18n('Networks')}
44 filterValue={localFilter}
45 placeholder={i18n('Filter Networks')}
46 onFilter={value => this.setState({localFilter: value})}
48 {this.filterList().map(network => this.renderNetworksListItem(network))}
54 renderNetworksListItem(network) {
55 let {id, name, dhcp} = network;
59 className='list-editor-item-view'
60 isReadOnlyMode={true}>
62 <ListEditorItemViewField>
63 <div className='name'>{name}</div>
64 </ListEditorItemViewField>
65 <ListEditorItemViewField>
66 <div className='details'>
67 <div className='title'>{i18n('DHCP')}</div>
68 <div className='artifact-name'>{dhcp ? i18n('YES') : i18n('NO')}</div>
70 </ListEditorItemViewField>
76 let {networksList} = this.props;
78 let {localFilter} = this.state;
79 if (localFilter.trim()) {
80 const filter = new RegExp(escape(localFilter), 'i');
81 return networksList.filter(({name = ''}) => {
82 return escape(name).match(filter);
91 export default SoftwareProductNetworksView;