/* * ============LICENSE_START======================================================= * org.onap.aai * ================================================================================ * Copyright © 2017-2021 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. * ============LICENSE_END========================================================= */ import React, { Component } from 'react'; import BootstrapTable from 'react-bootstrap-table-next'; import filterFactory, { textFilter, customFilter } from 'react-bootstrap-table2-filter'; import PropTypes from 'prop-types'; import { Link } from 'react-router-dom'; import Label from 'react-bootstrap/lib/Label'; import {GlobalExtConstants} from 'utils/GlobalExtConstants.js'; import {ExportExcel} from 'utils/ExportExcel.js'; let buildAttrList = ExportExcel.buildAttrList; let INVLIST = GlobalExtConstants.INVLIST; class RelationshipList extends Component { constructor(props) { super(props); this.props = props; this.relationships = null; this.relativesArray = []; this.state = { filteron:false } } render() { let navigateByoq = null; this.nodeDisplay = this.props.nodeType + ' : ' + (this.props.nodeUrl).split(this.props.nodeType + '\/').pop(); this.historyClick = () => { this.props.openHistoryModal(this.nodeDisplay, this.props.nodeUrl,this.props.nodeType); } this.filter = (e) =>{ let filterValue = e.target.value; this.returnFilterList(filterValue); this.setState({filteron:true}); } this.returnFilterList = (filterValue) =>{ if (this.props.nodeRelatives && this.props.nodeRelatives.length > 0) { this.relationships = null; this.relationships = this.props.nodeRelatives.sort(function(a, b) { var compareA = (a['node-type'] + (a.url).split(a['node-type']+'\/').pop()).toLowerCase(); var compareB = (b['node-type'] + (b.url).split(a['node-type']+'\/').pop()).toLowerCase(); if(compareA < compareB) return -1; if(compareA > compareB) return 1; return 0; }).map((relative, idx) => { if (this.relativesArray.includes(relative['node-type']) === false) this.relativesArray.push(relative['node-type']); if(filterValue === '' || filterValue === ':' || relative['node-type'].toLowerCase().search(filterValue.toLowerCase()) != -1 || (decodeURI((relative.url).split(relative['node-type']+'\/').pop())).replace(/%2F/g,'/').toLowerCase().search(filterValue.toLowerCase()) != -1){ return (
Relationships
this.filter(e)}
/>
|
---|
|