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

42 lines
1000 B
React
Raw Normal View History

import React from 'react'
import {connect} from 'react-redux'
2018-10-03 20:01:25 +02:00
import {resolveCommunities} from './utils'
class NoExportReason extends React.Component {
render() {
const route = this.props.route;
2018-10-03 20:01:25 +02:00
2018-10-03 17:17:18 +02:00
if (!this.props.noexportReasons || !route || !route.bgp ||
!route.bgp.large_communities) {
return null;
}
2018-10-03 20:01:25 +02:00
const reasons = resolveCommunities(
this.props.noexportReasons, route.bgp.large_communities,
);
2018-10-03 20:01:25 +02:00
const reasonsView = reasons.map(([community, reason], key) => {
const cls = `noexport-reason noexport-reason-${community[2]}`;
return (
<p key={key} className={cls}>
<a href={`http://irrexplorer.nlnog.net/search/${route.network}`}
target="_blank" >{reason}</a>
</p>
);
});
return (<div className="reject-reasons">{reasonsView}</div>);
}
}
export default connect(
state => {
return {
2018-10-03 17:17:18 +02:00
noexportReasons: state.routeservers.noexportReasons,
}
2018-08-03 15:57:30 +02:00
}
)(NoExportReason);
2018-10-03 20:01:25 +02:00