javaApi.jsp
4.85 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
<%@page language="java" contentType="text/html;charset=utf-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<div id="breadcrumb">
<a href="#" title="Go to Home" class="tip-bottom"><i
class="icon-home"></i> Java服务</a> <a href="#" class="current">服务信息</a>
</div>
<div class="container-fluid">
<div class="widget-box">
<div class="widget-title">
<h5>Java服务 DashBoard<a href="?page_url=jsp/javaapi/javaApiList.jsp&page_type=javaApi">详细</a></h5>
</div>
<div class="widget-content">
<div class="row api_info_container">
<%--<div class="api_info_item col-xs-3 ">--%>
<%--<div class="panel panel-default">--%>
<%--<div class="panel-heading">gateway</div>--%>
<%--<div class="panel-body">--%>
<%--<h3><span class="label label-default">AWS状态</span>--%>
<%--<span class="label label-default">Gcloud状态</span>--%>
<%--</h3>--%>
<%--<span>更新时间</span>--%>
<%--</div>--%>
<%--</div>--%>
<%--</div>--%>
</div>
</div>
</div>
</div>
<script type="text/javascript">
var getJavaAppType = function () {
$.ajax({
url: contextPath + "/type/queryJavaApiType",
type: 'get',
success: function (data) {
if (!data || data.code != 200) {
$.toaster('获取java服务类型失败', '警告', 'warning');
return;
}
console.info(data.data);
initDashBoard(data.data);
},
error: function (data) {
$.toaster('获取java服务类型失败', '警告', 'warning');
}
});
};
var initDashBoard = function (data) {
var div_dash = $(".api_info_container");
$.each(data, function (idx, val) {
var api_info_item = $('<div class="api_info_item col-xs-3 ">');
var api_info_item_panel = $(' <div class="panel panel-default">');
var api_info_item_panel_title = $('<div class="panel-heading">' + val.typeName + '</div>');
var api_info_item_panel_body = $('<div class="panel-body">');
api_info_item_panel_body.append('<h5 >更新时间:</h5>');
api_info_item_panel_body.append('<button class="btn_java_api btn btn-lg btn-default" id="btn_1_' + val.typeId + '">AWS <span class="badge"></span></button>');
api_info_item_panel_body.append('<button class="btn_java_api btn btn-lg btn-default" id="btn_2_' + val.typeId + '">QCloud <span class="badge"></span></button>');
api_info_item_panel_body.append('<button class="btn_java_api btn btn-lg btn-default" id="btn_3_' + val.typeId + '">其他 <span class="badge"></span></button>');
api_info_item_panel.append(api_info_item_panel_title)
.append(api_info_item_panel_body);
api_info_item.append(api_info_item_panel);
div_dash.append(api_info_item);
});
$(".btn_java_api").on("click", function () {
console.info(this);
var url = contextPath + "?page_url=jsp/javaapi/javaApiList.jsp&page_type=javaApi";
var api_type = $(this).attr("id").split("_")[2];
url += "&api_type=" + api_type;
window.location.href = url;
});
timer();
};
var refreshDashBoard = function () {
$.ajax({
url: contextPath + "/javaApi/allStatus",
type: 'get',
success: function (data) {
if (!data || data.code != 200) {
$.toaster('获取java服务类型失败', '警告', 'warning');
return;
}
console.info(data.data);
$.each(data.data, function (idx, val) {
console.log($("#btn_" + val.cloudType + "_" + val.serviceType));
var btn = $("#btn_" + val.cloudType + "_" + val.serviceType);
if (val.errNum > 0) {
$(btn.children("span")[0]).html(val.errNum)
btn.removeClass("btn-success");
btn.addClass("btn-danger");
} else {
$(btn.children("span")[0]).html()
btn.removeClass("btn-danger");
btn.addClass("btn-success");
}
});
},
error: function (data) {
$.toaster('获取java服务类型失败', '警告', 'warning');
}
});
};
function timer() {
refreshDashBoard();
setTimeout("timer()", 30000);
};
$(function () {
getJavaAppType();
});
</script>