nodeList.blade.php 6.0 KB

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