/
restpretty.html
72 lines (65 loc) · 2.21 KB
/
restpretty.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Apache Ignite Teamcity Bot</title>
<link rel="icon" href="img/leaf-icon-png-7066.png">
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
</head>
<body>
<pre id="ciResponseText"></pre>
<div id="loadStatus"></div>
<script>
function findGetParameter(parameterName) {
var result = null,
tmp = [];
location.search
.substr(1)
.split("&")
.forEach(function (item) {
tmp = item.split("=");
if (tmp[0] === parameterName) result = decodeURIComponent(tmp[1]);
});
return result;
}
$(document).ready(function() {
$( document ).tooltip();
loadData();
//todo fix setInterval(loadData, 60000)
});
function loadData() {
$("#loadStatus").html("⌛ Please wait");
$.ajax({
url: "rest/" + findGetParameter("url"),
success: function(result) {
$("#loadStatus").html("");
showData(result);
},
error: function(jqXHR, exception) {
if (jqXHR.status === 0) {
$("#loadStatus").html('Not connect.\n Verify Network.');
} else if (jqXHR.status === 404) {
$("#loadStatus").html('Requested page not found. [404]');
} else if (jqXHR.status === 500) {
$("#loadStatus").html('Internal Server Error [500].');
} else if (exception === 'parsererror') {
$("#loadStatus").html('Requested JSON parse failed.');
} else if (exception === 'timeout') {
$("#loadStatus").html('Time out error.');
} else if (exception === 'abort') {
$("#loadStatus").html('Ajax request aborted.');
} else {
$("#loadStatus").html('Uncaught Error.\n' + jqXHR.responseText);
}
}
}, );
}
function showData(result) {
var ciResponseText = document.getElementById('ciResponseText');
ciResponseText.innerHTML = JSON.stringify(result, null, '\t');
}
</script>
</body>
</html>