monitor.blade.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. @extends('admin.layouts')
  2. @section('content')
  3. <div class="page-content container-fluid">
  4. <div class="panel">
  5. <div class="panel-heading">
  6. <h2 class="panel-title">节点流量</h2>
  7. </div>
  8. <div class="alert alert-info alert-dismissible">
  9. <button class="close" data-dismiss="alert" aria-label="Close">
  10. <span aria-hidden="true">&times;</span><span class="sr-only">{{trans('common.close')}}</span>
  11. </button>
  12. <h4 class="block">{{$nodeName}}
  13. <small class="pl-10">{{$nodeServer}}</small>
  14. </h4>
  15. <strong>提示:</strong> 如果无统计数据,请检查定时任务是否正常。
  16. </div>
  17. <div class="panel-body">
  18. <div class="row">
  19. <div class="col-md-6">
  20. <canvas id="dailyChart" aria-label="小时流量图" role="img"></canvas>
  21. </div>
  22. <div class="col-md-6">
  23. <canvas id="monthlyChart" aria-label="月流量图" role="img"></canvas>
  24. </div>
  25. </div>
  26. </div>
  27. </div>
  28. </div>
  29. @endsection
  30. @section('javascript')
  31. <script src="/assets/global/vendor/chart-js/Chart.min.js"></script>
  32. <script>
  33. const dailyChart = new Chart(document.getElementById('dailyChart').getContext('2d'), {
  34. type: 'line',
  35. data: {
  36. labels: {{$dayHours}},
  37. datasets: [
  38. {
  39. fill: true,
  40. backgroundColor: 'rgba(98, 168, 234, .1)',
  41. borderColor: Config.colors('primary', 600),
  42. pointRadius: 4,
  43. borderDashOffset: 2,
  44. pointBorderColor: '#fff',
  45. pointBackgroundColor: Config.colors('primary', 600),
  46. pointHoverBackgroundColor: '#fff',
  47. pointHoverBorderColor: Config.colors('primary', 600),
  48. data: {{$trafficHourly}},
  49. }],
  50. },
  51. options: {
  52. legend: {
  53. display: false,
  54. },
  55. responsive: true,
  56. scales: {
  57. xAxes: [
  58. {
  59. display: true,
  60. scaleLabel: {
  61. display: true,
  62. labelString: '小时',
  63. },
  64. }],
  65. yAxes: [
  66. {
  67. display: true,
  68. ticks: {
  69. beginAtZero: true,
  70. },
  71. scaleLabel: {
  72. display: true,
  73. labelString: '{{trans('user.traffic_logs.24hours')}}',
  74. },
  75. }],
  76. },
  77. },
  78. });
  79. const monthlyChart = new Chart(document.getElementById('monthlyChart').getContext('2d'), {
  80. type: 'line',
  81. data: {
  82. labels: {{$monthDays}},
  83. datasets: [
  84. {
  85. fill: true,
  86. backgroundColor: 'rgba(98, 168, 234, .1)',
  87. borderColor: Config.colors('primary', 600),
  88. pointRadius: 4,
  89. borderDashOffset: 2,
  90. pointBorderColor: '#fff',
  91. pointBackgroundColor: Config.colors('primary', 600),
  92. pointHoverBackgroundColor: '#fff',
  93. pointHoverBorderColor: Config.colors('primary', 600),
  94. data: {{$trafficDaily}},
  95. }],
  96. },
  97. options: {
  98. legend: {
  99. display: false,
  100. },
  101. responsive: true,
  102. scales: {
  103. xAxes: [
  104. {
  105. display: true,
  106. scaleLabel: {
  107. display: true,
  108. labelString: '天',
  109. },
  110. }],
  111. yAxes: [
  112. {
  113. display: true,
  114. ticks: {
  115. beginAtZero: true,
  116. },
  117. scaleLabel: {
  118. display: true,
  119. labelString: '{{trans('user.traffic_logs.30days')}}',
  120. },
  121. }],
  122. },
  123. },
  124. });
  125. </script>
  126. @endsection