nodeMonitor.blade.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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"><span
  10. aria-hidden="true">&times;</span><span class="sr-only">{{trans('home.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('script')
  31. <script src="/assets/global/vendor/chart-js/Chart.min.js" type="text/javascript"></script>
  32. <script type="text/javascript">
  33. const dailyChart = new Chart(document.getElementById('dailyChart').getContext('2d'), {
  34. type: 'line',
  35. data: {
  36. labels: {{$dayHours}},
  37. datasets: [{
  38. fill: true,
  39. backgroundColor: "rgba(98, 168, 234, .1)",
  40. borderColor: Config.colors("primary", 600),
  41. pointRadius: 4,
  42. borderDashOffset: 2,
  43. pointBorderColor: "#fff",
  44. pointBackgroundColor: Config.colors("primary", 600),
  45. pointHoverBackgroundColor: "#fff",
  46. pointHoverBorderColor: Config.colors("primary", 600),
  47. data: {{$trafficHourly['hourlyData']}},
  48. }]
  49. },
  50. options: {
  51. legend: {
  52. display: false
  53. },
  54. responsive: true,
  55. scales: {
  56. xAxes: [{
  57. display: true,
  58. scaleLabel: {
  59. display: true,
  60. labelString: '小时'
  61. }
  62. }],
  63. yAxes: [{
  64. display: true,
  65. ticks: {
  66. beginAtZero: true,
  67. },
  68. scaleLabel: {
  69. display: true,
  70. labelString: '{{trans('home.traffic_log_24hours')}}'
  71. }
  72. }]
  73. }
  74. }
  75. });
  76. const monthlyChart = new Chart(document.getElementById('monthlyChart').getContext('2d'), {
  77. type: 'line',
  78. data: {
  79. labels: {{$monthDays}},
  80. datasets: [{
  81. fill: true,
  82. backgroundColor: "rgba(98, 168, 234, .1)",
  83. borderColor: Config.colors("primary", 600),
  84. pointRadius: 4,
  85. borderDashOffset: 2,
  86. pointBorderColor: "#fff",
  87. pointBackgroundColor: Config.colors("primary", 600),
  88. pointHoverBackgroundColor: "#fff",
  89. pointHoverBorderColor: Config.colors("primary", 600),
  90. data: {{$trafficDaily['dailyData']}},
  91. }]
  92. },
  93. options: {
  94. legend: {
  95. display: false
  96. },
  97. responsive: true,
  98. scales: {
  99. xAxes: [{
  100. display: true,
  101. scaleLabel: {
  102. display: true,
  103. labelString: '天'
  104. }
  105. }],
  106. yAxes: [{
  107. display: true,
  108. ticks: {
  109. beginAtZero: true,
  110. },
  111. scaleLabel: {
  112. display: true,
  113. labelString: '{{trans('home.traffic_log_30days')}}'
  114. }
  115. }]
  116. }
  117. }
  118. });
  119. </script>
  120. @endsection