nodeList.blade.php 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. @extends('admin.layouts')
  2. @section('css')
  3. <link rel="stylesheet" href="/assets/global/vendor/bootstrap-table/bootstrap-table.min.css">
  4. @endsection
  5. @section('content')
  6. <div class="page-content container-fluid">
  7. <div class="panel">
  8. <div class="panel-heading">
  9. <h3 class="panel-title">节点列表</h3>
  10. <div class="panel-actions">
  11. <button class="btn btn-primary" onclick="addNode()"><i class="icon wb-plus"></i> 添加节点</button>
  12. </div>
  13. </div>
  14. <div class="panel-body">
  15. <table class="text-center" data-toggle="table" data-mobile-responsive="true">
  16. <thead class="thead-default">
  17. <tr>
  18. <th> ID</th>
  19. <th> 类型</th>
  20. <th> 名称</th>
  21. <th> IP</th>
  22. <th> 域名</th>
  23. <th> 存活</th>
  24. <th> 状态</th>
  25. <th> 在线</th>
  26. <th>产生流量</th>
  27. <th> 流量比例</th>
  28. <th> 扩展</th>
  29. <th> 操作</th>
  30. </tr>
  31. </thead>
  32. <tbody>
  33. @if($nodeList->isEmpty())
  34. <tr>
  35. <td colspan="12">暂无数据</td>
  36. </tr>
  37. @else
  38. @foreach($nodeList as $node)
  39. <tr>
  40. <td>
  41. <span class="badge badge-lg {{$node->status ? 'badge-danger' : 'badge-default'}}"> {{$node->id}} </span>
  42. </td>
  43. <td>
  44. @if($node->is_transit)
  45. {{$node->is_transit ? '中转' : ''}}
  46. @else
  47. {{$node->type == 2 ? 'V2' : 'SSR'}}
  48. @endif
  49. </td>
  50. <td> {{$node->name}} </td>
  51. <td> {{$node->is_nat ? 'Nat' : $node->ip}} </td>
  52. <td> {{$node->server}} </td>
  53. <td> {{$node->is_transit ? '' : $node->uptime}} </td>
  54. <td> {{$node->is_transit ? '' : $node->load}} </td>
  55. <td> {{$node->is_transit ? '' : $node->online_users}} </td>
  56. <td> {{$node->is_transit ? '' : $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-info"><s>订</s></span> @endif
  63. </td>
  64. <td>
  65. <div class="btn-group">
  66. <a href="javascript:editNode('{{$node->id}}');" class="btn btn-primary"><i class="icon wb-edit"></i></a>
  67. <a href="javascript:delNode('{{$node->id}}');" class="btn btn-danger"><i class="icon wb-trash"></i></a>
  68. <a href="javascript:nodeMonitor('{{$node->id}}');" class="btn btn-primary"><i class="icon wb-stats-bars"></i></a>
  69. </div>
  70. </td>
  71. </tr>
  72. @endforeach
  73. @endif
  74. </tbody>
  75. </table>
  76. </div>
  77. <div class="panel-footer">
  78. <div class="row">
  79. <div class="col-sm-4">
  80. 共 {{$nodeList->total()}} 条线路
  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"></script>
  94. <script src="/assets/global/vendor/bootstrap-table/extensions/mobile/bootstrap-table-mobile.min.js"></script>
  95. <script type="text/javascript">
  96. // 添加节点
  97. function addNode() {
  98. window.location.href = '/admin/addNode';
  99. }
  100. // 编辑节点
  101. function editNode(id) {
  102. window.location.href = '/admin/editNode?id=' + id + '&page={{Request::get('page', 1)}}';
  103. }
  104. // 删除节点
  105. function delNode(id) {
  106. swal.fire({
  107. title: '警告',
  108. text: '确定删除节点?',
  109. type: 'warning',
  110. showCancelButton: true,
  111. cancelButtonText: '{{trans('home.ticket_close')}}',
  112. confirmButtonText: '{{trans('home.ticket_confirm')}}',
  113. }).then((result) => {
  114. if (result.value) {
  115. $.post("/admin/delNode", {id: id, _token: '{{csrf_token()}}'}, function (ret) {
  116. if (ret.status === 'success') {
  117. swal.fire({title: ret.message, type: 'success', timer: 1000, showConfirmButton: false})
  118. .then(() => window.location.reload())
  119. } else {
  120. swal.fire({title: ret.message, type: "error"}).then(() => window.location.reload())
  121. }
  122. });
  123. }
  124. });
  125. }
  126. // 节点流量监控
  127. function nodeMonitor(id) {
  128. window.location.href = '/admin/nodeMonitor?id=' + id;
  129. }
  130. // 显示提示
  131. function showIdTips() {
  132. swal.fire({
  133. title: '复制成功',
  134. type: 'success',
  135. timer: 1300,
  136. showConfirmButton: false,
  137. });
  138. }
  139. // 修正table的dropdown
  140. $('.table-scrollable').on('show.bs.dropdown', function () {
  141. $('.table-scrollable').css("overflow", "inherit");
  142. });
  143. $('.table-scrollable').on('hide.bs.dropdown', function () {
  144. $('.table-scrollable').css("overflow", "auto");
  145. });
  146. </script>
  147. @endsection