增加服务器监控的对应 js 也 demo 页面
This commit is contained in:
56
static/src/js/app/admin/monitor/monitor.js
Normal file
56
static/src/js/app/admin/monitor/monitor.js
Normal file
@@ -0,0 +1,56 @@
|
||||
require(["jquery", "chart"], function ($, Chart) {
|
||||
var data = {
|
||||
labels: ["January", "February", "March", "April", "May", "June", "July",
|
||||
"January", "February", "March", "April", "January", "February", "March", "April"],
|
||||
datasets: [
|
||||
{
|
||||
label: "11111111",
|
||||
fillColor: "rgba(220,220,220,0.2)",
|
||||
strokeColor: "rgba(220,220,220,1)",
|
||||
pointColor: "rgba(220,220,220,1)",
|
||||
pointStrokeColor: "#fff",
|
||||
pointHighlightFill: "#fff",
|
||||
pointHighlightStroke: "rgba(220,220,220,1)",
|
||||
data: [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]
|
||||
},
|
||||
{
|
||||
label: "2222222",
|
||||
fillColor: "rgba(151,187,205,0.2)",
|
||||
strokeColor: "rgba(151,187,205,1)",
|
||||
pointColor: "rgba(151,187,205,1)",
|
||||
pointStrokeColor: "#fff",
|
||||
pointHighlightFill: "#fff",
|
||||
pointHighlightStroke: "rgba(151,187,205,1)",
|
||||
data: [3, 7, 8, 9, 1, 4, 10, 10, 9, 8, 7, 10, 10, 10, 10]
|
||||
}
|
||||
]
|
||||
};
|
||||
Chart.defaults.global.responsive = true;
|
||||
var myLineChart = new Chart($("#myChart").get(0).getContext("2d")).Line(data);
|
||||
|
||||
var data1 = [
|
||||
{
|
||||
value: 300,
|
||||
color:"#F7464A",
|
||||
highlight: "#FF5A5E",
|
||||
label: "Red"
|
||||
},
|
||||
{
|
||||
value: 50,
|
||||
color: "#46BFBD",
|
||||
highlight: "#5AD3D1",
|
||||
label: "Green"
|
||||
},
|
||||
{
|
||||
value: 100,
|
||||
color: "#FDB45C",
|
||||
highlight: "#FFC870",
|
||||
label: "Yellow"
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
new Chart($("#c1").get(0).getContext("2d")).Pie(data1);
|
||||
new Chart($("#c2").get(0).getContext("2d")).Pie(data1);
|
||||
|
||||
});
|
||||
@@ -16,6 +16,7 @@ var require = {
|
||||
contest: "app/admin/contest/contest",
|
||||
csrf: "utils/csrf",
|
||||
admin: "app/admin/admin",
|
||||
chart: "lib/chart/Chart",
|
||||
|
||||
//formValidation 不要在代码中单独使用,而是使用和修改utils/validation
|
||||
base: "lib/formValidation/base",
|
||||
|
||||
21
template/admin/monitor/monitor.html
Normal file
21
template/admin/monitor/monitor.html
Normal file
@@ -0,0 +1,21 @@
|
||||
<div ms-controller="monitor" class="col-lg-9">
|
||||
<h1>服务器监控</h1>
|
||||
|
||||
<div>
|
||||
<h3>判题实例数量</h3>
|
||||
<div>
|
||||
<canvas id="myChart" style="min-width:100%;max-height: 300px;"></canvas>
|
||||
<div style="text-align: center;">判题实例数量变化</div>
|
||||
</div>
|
||||
<div style="width: 50%;float: left;">
|
||||
<canvas id="c1" width="250" height="125"></canvas>
|
||||
<div style="text-align: center;">内存</div>
|
||||
</div>
|
||||
<div style="width: 50%;float: left;">
|
||||
<canvas id="c2" width="250" height="125"></canvas>
|
||||
<div style="text-align: center"> cpu</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/static/js/app/admin/monitor/monitor.js"></script>
|
||||
</div>
|
||||
Reference in New Issue
Block a user