nginxview.js
3.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
$(
updateView()
);
function updateView() {
$.ajax({
url: contextPath + "nginx/allNginx",
type: "post",
dataType: "json",
data: {
type: "aws"
},
success: function (response) {
var awsView = document.getElementById("aws_nginx_row");
updateNginxView(awsView, response.data, "aws");
},
error: function (e) {
}
});
$.ajax({
url: contextPath + "nginx/allNginx",
type: "post",
dataType: "json",
data: {
type: "qc"
},
success: function (response) {
var qcView = document.getElementById("qcloud_nginx_row");
updateNginxView(qcView, response.data, "qcloud")
},
error: function (e) {
}
});
}
function updateNginxView(awsView, data, type) {
for (var i = 0; i < data.length; i++) {
var col = $("<div class='col-md-4' id='" + type + "' onclick='ok(id)'>");
col.appendTo(awsView);
var panel = $("<div>");
if (data[i].error>5000 || data[i].apiU200>5000 || data[i].serviceU200>5000) {
panel.addClass("panel panel-fail-alt noborder");
}
else {
if (data[i].error>1000 || data[i].apiU2000>1000 || data[i].serviceU200>1000)
{
panel.addClass("panel panel-alarm-alt noborder")
}
else
{
panel.addClass("panel panel-success-alt noborder");
}
}
col.append(panel);
var panel_head = $("<div class='panel-heading noborder'>")
panel.append(panel_head);
var panel_icon = $("<div class='panel-icon' style='background-image:url(\""+ contextPath + "img/nginx.png\"); width:60px;height:60px;' >");
panel_head.append(panel_icon);
var media_body = $("<div class='media-body'>");
panel_head.append(media_body);
var tile = $("<h5 class='md-title nomargin'>");
var tile_value = $("<strong>").html(data[i].name);
tile.append(tile_value);
media_body.append(tile);
var tile_info = $("<h1 class='mt5'>").html(data[i].ip);
media_body.append(tile_info);
var hr = $("<hr>");
panel_head.append(hr);
var parameters = $("<div class='clearfix mt20'>");
panel_head.append(parameters);
var apiPara = $("<div class='pull-left'>");
apiPara.append($("<h5 class='md-title nomargin'>").html("Api 非200响应"));
apiPara.append($("<h4 class='nomargin' style='margin-left: 20px'>").html(data[i].apiU200));
parameters.append(apiPara);
var servicePara = $("<div class='pull-left' style='margin-left: 135px'>");
servicePara.append($("<h5 class='md-title nomargin'>").html("Service 非200响应"));
servicePara.append($("<h4 class='nomargin' style='margin-left: 20px'>").html(data[i].serviceU200));
parameters.append(servicePara);
var errorPara = $("<div class='pull-right'>");
errorPara.append($("<h5 class='md-title nomargin'>").html("Error 总计"));
errorPara.append($("<h4 class='nomargin' style='margin-left: 20px'>").html(data[i].error));
parameters.append(errorPara);
}
}
function ok(id) {
if (id == "aws") {
window.location.href="toNginxaws"
}
else
{
window.location.href="toNginxqc"
}
}