1
0
mirror of https://github.com/alice-lg/alice-lg.git synced 2024-05-11 05:55:03 +00:00

39 lines
1.0 KiB
React
Raw Normal View History

import React from 'react'
import {connect} from 'react-redux'
class NoExportReason extends React.Component {
render() {
const route = this.props.route;
2018-10-03 17:17:18 +02:00
if (!this.props.noexportReasons || !route || !route.bgp ||
!route.bgp.large_communities) {
return null;
}
const reason = route.bgp.large_communities.filter(elem =>
2018-10-03 17:17:18 +02:00
elem[0] == this.props.asn && elem[1] == this.props.rejectId
);
if (!reason.length) {
return null;
}
2018-10-03 17:17:18 +02:00
const noexportReason = this.props.noexportReasons[reason[0][2]];
const cls = `noexport-reason noexport-reason-${reason[0][2]}`;
2018-08-03 14:46:01 +02:00
return (
<p className={cls}>
2018-09-17 00:18:44 +02:00
<a href={`http://irrexplorer.nlnog.net/search/${route.network}`}
2018-10-03 17:17:18 +02:00
target="_blank" >{noexportReason}</a>
2018-08-03 14:46:01 +02:00
</p>);
}
}
export default connect(
state => {
return {
2018-10-03 17:17:18 +02:00
noexportReasons: state.routeservers.noexportReasons,
asn: state.routeservers.noexportAsn,
rejectId: state.routeservers.noexportId
}
2018-08-03 15:57:30 +02:00
}
)(NoExportReason);