nodeMonitor.blade.php 4.4 KB

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