ZeroTierNetwork.jsx 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. var ZeroTierNetwork = React.createClass({
  2. getInitialState: function() {
  3. return {};
  4. },
  5. leaveNetwork: function(event) {
  6. Ajax.call({
  7. url: 'network/'+this.props.nwid+'?auth='+this.props.authToken,
  8. cache: false,
  9. type: 'DELETE',
  10. success: function(data) {
  11. if (this.props.onNetworkDeleted)
  12. this.props.onNetworkDeleted(this.props.nwid);
  13. }.bind(this),
  14. error: function(error) {
  15. }.bind(this)
  16. });
  17. event.preventDefault();
  18. },
  19. render: function() {
  20. return (
  21. <div className="zeroTierNetwork">
  22. <div className="networkInfo">
  23. <span className="networkId">{this.props.nwid}</span>&nbsp;
  24. <span className="networkName">{this.props.name}</span>
  25. </div>
  26. <div className="networkProps">
  27. <div className="row">
  28. <div className="name">Status</div>
  29. <div className="value">{this.props['status']}</div>
  30. </div>
  31. <div className="row">
  32. <div className="name">Type</div>
  33. <div className="value">{this.props['type']}</div>
  34. </div>
  35. <div className="row">
  36. <div className="name">MAC</div>
  37. <div className="value zeroTierAddress">{this.props['mac']}</div>
  38. </div>
  39. <div className="row">
  40. <div className="name">MTU</div>
  41. <div className="value">{this.props['mtu']}</div>
  42. </div>
  43. <div className="row">
  44. <div className="name">Broadcast</div>
  45. <div className="value">{(this.props['broadcastEnabled']) ? 'ENABLED' : 'DISABLED'}</div>
  46. </div>
  47. <div className="row">
  48. <div className="name">Bridging</div>
  49. <div className="value">{(this.props['bridge']) ? 'ACTIVE' : 'DISABLED'}</div>
  50. </div>
  51. <div className="row">
  52. <div className="name">Device</div>
  53. <div className="value">{(this.props['portDeviceName']) ? this.props['portDeviceName'] : '(none)'}</div>
  54. </div>
  55. <div className="row">
  56. <div className="name">Managed&nbsp;IPs</div>
  57. <div className="value ipList">
  58. {
  59. this.props['assignedAddresses'].map(function(ipAssignment) {
  60. return (
  61. <div key={ipAssignment} className="ipAddress">{ipAssignment}</div>
  62. );
  63. })
  64. }
  65. </div>
  66. </div>
  67. </div>
  68. <button type="button" className="leaveNetworkButton" onClick={this.leaveNetwork}>Leave&nbsp;Network</button>
  69. </div>
  70. );
  71. }
  72. });