rabbitview.js
2.69 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
$(
updateView()
);
function updateView() {
$.ajax({
url: getUrlBasePath() + "/rabbitmq/allRabbitMq",
type: "post",
dataType: "json",
data: {
moType: "aws"
},
success: function (response) {
var awsView = document.getElementById("aws_rabbit_row");
updateRabbitView(awsView, response.data, "aws");
},
error: function (e) {
}
});
$.ajax({
url: getUrlBasePath() + "/rabbitmq/allRabbitMq",
type: "post",
dataType: "json",
data: {
moType: "qc"
},
success: function (response) {
var qcView = document.getElementById("qcloud_rabbit_row");
updateRabbitView(qcView, response.data, "qcloud")
},
error: function (e) {
}
});
}
function updateRabbitView(view, data, type) {
for (var i = 0; i < data.length; i++) {
var col = $("<div class='col-md-4' id='" + data[i].moId + "' onclick='ok(id)'>");
col.appendTo(view);
var panel = $("<div>");
if (data[i].moState == 0) {
panel.addClass("panel panel-fail-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/rabbit.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].moName);
tile.append(tile_value);
media_body.append(tile);
var tile_info = $("<h1 class='mt5'>").html(data[i].moHostIp);
media_body.append(tile_info);
var hr = $("<hr>");
panel_head.append(hr);
var parameters = $("<div class='clearfix mt20'>");
panel_head.append(parameters);
var queuePara = $("<div class='pull-left'>");
queuePara.append($("<h5 class='md-title nomargin'>").html("Queues"));
queuePara.append($("<h4 class='nomargin'>").html(data[i].moQueues));
parameters.append(queuePara);
var msgPara = $("<div class='pull-right'>");
msgPara.append($("<h5 class='md-title nomargin'>").html("Messages"));
msgPara.append($("<h4 class='nomargin'>").html(data[i].moMsgs));
parameters.append(msgPara);
}
}
function ok(id) {
window.location.href = "toRabbitmqInfo?moId=" + id;
}