nodeList.blade.php 6.1 KB

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