1
0
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:
Matthias Hannig
2018-09-06 16:58:00 +02:00
parent 46e07046eb
commit f1920b5c26
3 changed files with 15 additions and 9 deletions

View File

@ -4,5 +4,11 @@
.label-bgp-community {
margin-right: 5px;
display: inline-block;
}
.label-bgp-unknown {
color: #333;
background-color: #ddd;
}

View File

@ -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>);
}
}

View File

@ -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>