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

38 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;
if (!this.props.noexport_reasons || !route || !route.bgp ||
!route.bgp.large_communities) {
return null;
}
const reason = route.bgp.large_communities.filter(elem =>
elem[0] == this.props.asn && elem[1] == this.props.reject_id
);
if (!reason.length) {
return null;
}
const noexport_reason = this.props.noexport_reasons[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-08-03 14:46:01 +02:00
target="_blank" >{noexport_reason}</a>
</p>);
}
}
export default connect(
state => {
return {
noexport_reasons: state.routeservers.noexport_reasons,
asn: state.routeservers.noexport_asn,
2017-05-24 11:41:54 +02:00
reject_id: state.routeservers.noexport_id
}
2018-08-03 15:57:30 +02:00
}
)(NoExportReason);