mirror of
https://github.com/alice-lg/alice-lg.git
synced 2024-05-11 05:55:03 +00:00
naiive implementation done. ENHANCE!
This commit is contained in:
@ -4,5 +4,11 @@
|
||||
|
||||
.label-bgp-community {
|
||||
margin-right: 5px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.label-bgp-unknown {
|
||||
color: #333;
|
||||
background-color: #ddd;
|
||||
}
|
||||
|
||||
|
@ -5,15 +5,20 @@ import {connect} from 'react-redux'
|
||||
|
||||
class Label extends React.Component {
|
||||
render() {
|
||||
console.log(this.props.communities, this.props.community);
|
||||
// Lookup communities
|
||||
const readableCommunity = this.props.communities[this.props.community];
|
||||
let cls = 'label label-bgp-community ';
|
||||
if (!readableCommunity) {
|
||||
return null;
|
||||
cls += "label-bgp-unknown";
|
||||
// Default label
|
||||
return (
|
||||
<span className={cls}>{this.props.community}</span>
|
||||
);
|
||||
}
|
||||
|
||||
let cls = 'label label-success label-bgp-community ';
|
||||
return (<span className={cls}>{readableCommunity}</span>);
|
||||
cls += "label-success ";
|
||||
// Split community into components
|
||||
return (<span className={cls}>{readableCommunity} ({this.props.community})</span>);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,11 +72,6 @@ class BgpAttributesModal extends React.Component {
|
||||
{communities.length > 0 &&
|
||||
<tr>
|
||||
<th>Communities:</th>
|
||||
<td>{communities.join(' ')}</td>
|
||||
</tr>}
|
||||
{communities.length > 0 &&
|
||||
<tr>
|
||||
<th></th>
|
||||
<td>
|
||||
{communities.map((c) => <BgpCommunitiyLabel community={c} key={c} />)}
|
||||
</td>
|
||||
|
Reference in New Issue
Block a user