nodeList.blade.php 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. @extends('admin.layouts')
  2. @section('css')
  3. <link href="/assets/global/vendor/bootstrap-table/bootstrap-table.min.css" type="text/css" rel="stylesheet">
  4. <style>
  5. #swal2-content {
  6. display: grid !important;
  7. }
  8. </style>
  9. @endsection
  10. @section('content')
  11. <div class="page-content container-fluid">
  12. <div class="panel">
  13. <div class="panel-heading">
  14. <h3 class="panel-title">节点列表</h3>
  15. <div class="panel-actions">
  16. <a href="/admin/addNode" class="btn btn-primary"><i class="icon wb-plus"></i> 添加节点</a>
  17. </div>
  18. </div>
  19. <div class="panel-body">
  20. <table class="text-md-center" data-toggle="table" data-mobile-responsive="true">
  21. <thead class="thead-default">
  22. <tr>
  23. <th> ID</th>
  24. <th> 类型</th>
  25. <th> 名称</th>
  26. <th> IP</th>
  27. <th> 域名</th>
  28. <th> 存活</th>
  29. <th> 状态</th>
  30. <th> 在线</th>
  31. <th>产生流量</th>
  32. <th> 流量比例</th>
  33. <th> 扩展</th>
  34. <th> 操作</th>
  35. </tr>
  36. </thead>
  37. <tbody>
  38. @foreach($nodeList as $node)
  39. <tr class="{{!$node->isOnline && $node->status ? 'table-danger' : ''}}">
  40. <td>
  41. {{$node->id}}
  42. </td>
  43. <td>
  44. @if($node->is_transit)
  45. 中转
  46. @else
  47. {{$node->type == 2 ? 'V2' : 'SSR'}}
  48. @endif
  49. </td>
  50. <td> {{$node->name}} </td>
  51. <td> {{$node->is_ddns ? 'DDNS' : $node->ip}} </td>
  52. <td> {{$node->server}} </td>
  53. <td> {{$node->uptime}} </td>
  54. <td> {{$node->status? $node->load : '维护'}} </td>
  55. <td> {{$node->online_users}} </td>
  56. <td> {{$node->transfer}} </td>
  57. <td> {{$node->traffic_rate}} </td>
  58. <td>
  59. @if($node->compatible) <span class="badge badge-lg badge-info">兼</span> @endif
  60. @if($node->single) <span class="badge badge-lg badge-info">单</span> @endif
  61. @if(!$node->is_subscribe) <span class="badge badge-lg badge-danger"><s>订</s></span> @endif
  62. </td>
  63. <td>
  64. <div class="btn-group">
  65. <a href="javascript:pingNode('{{$node->id}}')" class="btn btn-primary"><i id="ping{{$node->id}}" class="icon wb-order"></i></a>
  66. <a href="javascript:testNode('{{$node->id}}')" class="btn btn-primary"><i id="node{{$node->id}}" class="icon wb-signal"></i></a>
  67. <a href="/admin/editNode?id={{$node->id}}&page={{Request::get('page', 1)}}" class="btn btn-primary"><i class="icon wb-edit"></i></a>
  68. <a href="javascript:delNode('{{$node->id}}','{{$node->name}}')" class="btn btn-danger"><i class="icon wb-trash"></i></a>
  69. <a href="/admin/nodeMonitor/{{$node->id}})" class="btn btn-primary"><i class="icon wb-stats-bars"></i></a>
  70. </div>
  71. </td>
  72. </tr>
  73. @endforeach
  74. </tbody>
  75. </table>
  76. </div>
  77. <div class="panel-footer">
  78. <div class="row">
  79. <div class="col-sm-4">
  80. 共 <code>{{$nodeList->total()}}</code> 条线路
  81. </div>
  82. <div class="col-sm-8">
  83. <nav class="Page navigation float-right">
  84. {{$nodeList->links()}}
  85. </nav>
  86. </div>
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. @endsection
  92. @section('script')
  93. <script src="/assets/global/vendor/bootstrap-table/bootstrap-table.min.js" type="text/javascript"></script>
  94. <script src="/assets/global/vendor/bootstrap-table/extensions/mobile/bootstrap-table-mobile.min.js" type="text/javascript"></script>
  95. <script type="text/javascript">
  96. //节点连通性测试
  97. function testNode(id) {
  98. $.ajax({
  99. type: "POST",
  100. url: '/admin/nodeList',
  101. data: {_token: '{{csrf_token()}}', id: id},
  102. beforeSend: function () {
  103. $("#node" + id).removeClass("wb-signal").addClass("wb-loop icon-spin");
  104. },
  105. success: function (ret) {
  106. if (ret.status === 'success') {
  107. swal.fire({title: ret.title, type: 'info', html: '<table class="my-20"><thead class="thead-default"><tr><th> ICMP </th> <th> TCP </th></thead><tbody><tr><td>' + ret.message[0] + '</td><td>' + ret.message[1] + '</td></tr></tbody></table>', showConfirmButton: false})
  108. } else {
  109. swal.fire({title: ret.title, type: "error"})
  110. }
  111. },
  112. complete: function () {
  113. $("#node" + id).removeClass("wb-loop icon-spin").addClass("wb-signal");
  114. }
  115. });
  116. }
  117. //Ping 节点获取延迟
  118. function pingNode(id) {
  119. $.ajax({
  120. type: "POST",
  121. url: '/admin/pingNode',
  122. data: {_token: '{{csrf_token()}}', id: id},
  123. beforeSend: function () {
  124. $("#ping" + id).removeClass("wb-order").addClass("wb-loop icon-spin");
  125. },
  126. success: function (ret) {
  127. if (ret.status === 'success') {
  128. swal.fire({type: 'info', html: '<table class="my-20"><thead class="thead-default"><tr><th> 电信 </th> <th> 联通 </th> <th> 移动 </th> <th> 香港 </th></thead><tbody><tr><td>' + ret.message[0] + '</td><td>' + ret.message[1] + '</td><td>' + ret.message[2] + '</td><td>' + ret.message[3] + '</td></tr></tbody></table>', showConfirmButton: false})
  129. } else {
  130. swal.fire({title: ret.title, type: "error"})
  131. }
  132. },
  133. complete: function () {
  134. $("#ping" + id).removeClass("wb-loop icon-spin").addClass("wb-order");
  135. }
  136. });
  137. }
  138. // 删除节点
  139. function delNode(id, name) {
  140. swal.fire({
  141. title: '警告',
  142. text: '确定删除节点 【' + name + '】 ?',
  143. type: 'warning',
  144. showCancelButton: true,
  145. cancelButtonText: '{{trans('home.ticket_close')}}',
  146. confirmButtonText: '{{trans('home.ticket_confirm')}}',
  147. }).then((result) => {
  148. if (result.value) {
  149. $.post("/admin/delNode", {id: id, _token: '{{csrf_token()}}'}, function (ret) {
  150. if (ret.status === 'success') {
  151. swal.fire({title: ret.message, type: 'success', timer: 1000, showConfirmButton: false})
  152. .then(() => window.location.reload())
  153. } else {
  154. swal.fire({title: ret.message, type: "error"}).then(() => window.location.reload())
  155. }
  156. });
  157. }
  158. });
  159. }
  160. // 显示提示
  161. function showIdTips() {
  162. swal.fire({
  163. title: '复制成功',
  164. type: 'success',
  165. timer: 1300,
  166. showConfirmButton: false,
  167. });
  168. }
  169. </script>
  170. @endsection