2015-05-07 00:28:11 +00:00
|
|
|
var ZeroTierNetwork = React.createClass({
|
2015-05-07 02:39:45 +00:00
|
|
|
getInitialState: function() {
|
2015-05-08 16:39:07 +00:00
|
|
|
return {};
|
2015-05-07 02:39:45 +00:00
|
|
|
},
|
|
|
|
|
2015-05-07 00:28:11 +00:00
|
|
|
leaveNetwork: function(event) {
|
2015-05-07 02:39:45 +00:00
|
|
|
Ajax.call({
|
|
|
|
url: 'network/'+this.props.nwid+'?auth='+this.props.authToken,
|
|
|
|
cache: false,
|
|
|
|
type: 'DELETE',
|
|
|
|
success: function(data) {
|
2015-05-08 16:39:07 +00:00
|
|
|
if (this.props.onNetworkDeleted)
|
|
|
|
this.props.onNetworkDeleted(this.props.nwid);
|
2015-05-07 02:39:45 +00:00
|
|
|
}.bind(this),
|
|
|
|
error: function(error) {
|
|
|
|
}.bind(this)
|
|
|
|
});
|
2015-05-07 00:28:11 +00:00
|
|
|
event.preventDefault();
|
|
|
|
},
|
|
|
|
|
|
|
|
render: function() {
|
|
|
|
return (
|
|
|
|
<div className="zeroTierNetwork">
|
2015-05-07 02:39:45 +00:00
|
|
|
<div className="networkInfo">
|
2015-05-08 16:39:07 +00:00
|
|
|
<span className="networkId">{this.props.nwid}</span>
|
2015-05-07 02:39:45 +00:00
|
|
|
<span className="networkName">{this.props.name}</span>
|
|
|
|
</div>
|
2015-05-07 00:28:11 +00:00
|
|
|
<div className="networkProps">
|
|
|
|
<div className="row">
|
|
|
|
<div className="name">Status</div>
|
|
|
|
<div className="value">{this.props['status']}</div>
|
|
|
|
</div>
|
|
|
|
<div className="row">
|
|
|
|
<div className="name">Type</div>
|
|
|
|
<div className="value">{this.props['type']}</div>
|
|
|
|
</div>
|
|
|
|
<div className="row">
|
|
|
|
<div className="name">MAC</div>
|
|
|
|
<div className="value zeroTierAddress">{this.props['mac']}</div>
|
|
|
|
</div>
|
|
|
|
<div className="row">
|
|
|
|
<div className="name">MTU</div>
|
|
|
|
<div className="value">{this.props['mtu']}</div>
|
|
|
|
</div>
|
|
|
|
<div className="row">
|
|
|
|
<div className="name">Broadcast</div>
|
|
|
|
<div className="value">{(this.props['broadcastEnabled']) ? 'ENABLED' : 'DISABLED'}</div>
|
|
|
|
</div>
|
|
|
|
<div className="row">
|
|
|
|
<div className="name">Bridging</div>
|
|
|
|
<div className="value">{(this.props['bridge']) ? 'ACTIVE' : 'DISABLED'}</div>
|
|
|
|
</div>
|
|
|
|
<div className="row">
|
|
|
|
<div className="name">Device</div>
|
|
|
|
<div className="value">{(this.props['portDeviceName']) ? this.props['portDeviceName'] : '(none)'}</div>
|
|
|
|
</div>
|
|
|
|
<div className="row">
|
|
|
|
<div className="name">Managed IPs</div>
|
|
|
|
<div className="value ipList">
|
|
|
|
{
|
|
|
|
this.props['assignedAddresses'].map(function(ipAssignment) {
|
|
|
|
return (
|
|
|
|
<div className="ipAddress">{ipAssignment}</div>
|
|
|
|
);
|
|
|
|
})
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<button className="leaveNetworkButton" onClick={this.leaveNetwork}>Leave Network</button>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|