mirror of
https://github.com/alice-lg/alice-lg.git
synced 2024-05-11 05:55:03 +00:00
31 lines
706 B
JavaScript
31 lines
706 B
JavaScript
|
|
import React from 'react'
|
|
import {connect} from 'react-redux'
|
|
|
|
|
|
class Label extends React.Component {
|
|
render() {
|
|
// Lookup communities
|
|
const readableCommunity = this.props.communities[this.props.community];
|
|
let cls = 'label label-bgp-community ';
|
|
if (!readableCommunity) {
|
|
cls += "label-bgp-unknown";
|
|
// Default label
|
|
return (
|
|
<span className={cls}>{this.props.community}</span>
|
|
);
|
|
}
|
|
|
|
cls += "label-success ";
|
|
// Split community into components
|
|
return (<span className={cls}>{readableCommunity} ({this.props.community})</span>);
|
|
}
|
|
}
|
|
|
|
export default connect(
|
|
(state) => ({
|
|
communities: state.config.bgp_communities,
|
|
})
|
|
)(Label);
|
|
|