nodeList.blade.php 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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. @forelse($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. @empty
  74. <tr>
  75. <td colspan="12">暂无数据</td>
  76. </tr>
  77. @endforelse
  78. </tbody>
  79. </table>
  80. </div>
  81. <div class="panel-footer">
  82. <div class="row">
  83. <div class="col-sm-4">
  84. 共 <code>{{$nodeList->total()}}</code> 条线路
  85. </div>
  86. <div class="col-sm-8">
  87. <nav class="Page navigation float-right">
  88. {{$nodeList->links()}}
  89. </nav>
  90. </div>
  91. </div>
  92. </div>
  93. </div>
  94. </div>
  95. @endsection
  96. @section('script')
  97. <script src="/assets/global/vendor/bootstrap-table/bootstrap-table.min.js" type="text/javascript"></script>
  98. <script src="/assets/global/vendor/bootstrap-table/extensions/mobile/bootstrap-table-mobile.min.js" type="text/javascript"></script>
  99. <script type="text/javascript">
  100. //节点连通性测试
  101. function testNode(id) {
  102. $.ajax({
  103. type: "POST",
  104. url: '/admin/nodeList',
  105. data: {_token: '{{csrf_token()}}', id: id},
  106. beforeSend: function () {
  107. $("#node" + id).removeClass("wb-signal").addClass("wb-loop icon-spin");
  108. },
  109. success: function (ret) {
  110. if (ret.status === 'success') {
  111. 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})
  112. } else {
  113. swal.fire({title: ret.title, type: "error"})
  114. }
  115. },
  116. complete: function () {
  117. $("#node" + id).removeClass("wb-loop icon-spin").addClass("wb-signal");
  118. }
  119. });
  120. }
  121. //Ping 节点获取延迟
  122. function pingNode(id) {
  123. $.ajax({
  124. type: "POST",
  125. url: '/admin/pingNode',
  126. data: {_token: '{{csrf_token()}}', id: id},
  127. beforeSend: function () {
  128. $("#ping" + id).removeClass("wb-order").addClass("wb-loop icon-spin");
  129. },
  130. success: function (ret) {
  131. if (ret.status === 'success') {
  132. 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})
  133. } else {
  134. swal.fire({title: ret.title, type: "error"})
  135. }
  136. },
  137. complete: function () {
  138. $("#ping" + id).removeClass("wb-loop icon-spin").addClass("wb-order");
  139. }
  140. });
  141. }
  142. // 删除节点
  143. function delNode(id, name) {
  144. swal.fire({
  145. title: '警告',
  146. text: '确定删除节点 【' + name + '】 ?',
  147. type: 'warning',
  148. showCancelButton: true,
  149. cancelButtonText: '{{trans('home.ticket_close')}}',
  150. confirmButtonText: '{{trans('home.ticket_confirm')}}',
  151. }).then((result) => {
  152. if (result.value) {
  153. $.post("/admin/delNode", {id: id, _token: '{{csrf_token()}}'}, function (ret) {
  154. if (ret.status === 'success') {
  155. swal.fire({title: ret.message, type: 'success', timer: 1000, showConfirmButton: false})
  156. .then(() => window.location.reload())
  157. } else {
  158. swal.fire({title: ret.message, type: "error"}).then(() => window.location.reload())
  159. }
  160. });
  161. }
  162. });
  163. }
  164. // 显示提示
  165. function showIdTips() {
  166. swal.fire({
  167. title: '复制成功',
  168. type: 'success',
  169. timer: 1300,
  170. showConfirmButton: false,
  171. });
  172. }
  173. </script>
  174. @endsection