project_monitor/app/views/status.ejs
2022-09-07 09:33:23 +05:30

333 lines
13 KiB
Plaintext

<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script>
setInterval(function() {
window.location.reload();
}, 300000);
</script>
<style>
/* table, th, td {
border:1px solid rgb(20, 2, 2);
padding: 8px;
border-bottom: 1px solid #DDD;
text-align: center;
}
table {
border-collapse: collapse;
border: 2px solid #161614;
width: 87%;
}
th {
font-size: 20px;
}
th , h1 , td {
font-family: Arial, Helvetica, sans-serif;
} */
b {
font-family: Arial, Helvetica, sans-serif;
color: #3bd671 !important
}
.dot {
height: 25px;
width: 25px;
background-color: lightgreen;
border-radius: 90%;
display: inline-block;
cursor: pointer;
box-shadow: 0 0 0 rgba(204,169,44, 0.4);
animation: pulse 2s infinite;
}
.dot:hover {
animation: none;
}
.dot1 {
height: 25px;
width: 25px;
background-color: red;
border-radius: 90%;
display: inline-block;
cursor: pointer;
box-shadow: 0 0 0 rgba(204,169,44, 0.4);
animation: pulse 2s infinite;
}
.dot1:hover {
animation: none;
}
@-webkit-keyframes pulse {
0% {
-webkit-box-shadow: 0 0 0 0 rgba(204,169,44, 0.4);
}
70% {
-webkit-box-shadow: 0 0 0 10px rgba(204,169,44, 0);
}
100% {
-webkit-box-shadow: 0 0 0 0 rgba(204,169,44, 0);
}
}
@keyframes pulse {
0% {
-moz-box-shadow: 0 0 0 0 rgba(204,169,44, 0.4);
box-shadow: 0 0 0 0 rgba(204,169,44, 0.4);
}
70% {
-moz-box-shadow: 0 0 0 10px rgba(204,169,44, 0);
box-shadow: 0 0 0 10px rgba(204,169,44, 0);
}
100% {
-moz-box-shadow: 0 0 0 0 rgba(204,169,44, 0);
box-shadow: 0 0 0 0 rgba(204,169,44, 0);
}
}
.header {
background: rgb(3, 37, 37);
padding: 10px 0;
height: 20%;
width: 100%;
}
.with-in-header{
color: white;
text-align: right;
position: relative;
right: 70px;
padding-left: 2em;
}
.last-update{
color: white;
font-size: large;
text-align: right;
position: relative;
right: 70px;
padding-left: 2em;
}
.header1 {
background: white;
border-radius: 6px;
/* border: 2px solid #1f221c; */
text-align: left;
padding: 10px 0;
padding-top: 2em;
padding-left: 2em;
height: 40%;
width: 70%;
position: relative;
left: 220px;
top: 30px;
}
.header2 {
background: white;
text-align: left;
padding: 10px 0;
width: 80%;
position: relative;
left: 220px;
top: 100px;
}
.header3 {
background: white;
text-align: left;
padding: 10px 0;
width: 80%;
position: relative;
left: 220px;
top: 100px;
}
.header4 {
background: white;
text-align: left;
padding: 10px 0;
width: 80%;
position: relative;
left: 220px;
top: 100px;
}
.header5 {
background: white;
text-align: left;
padding: 10px 0;
width: 80%;
position: relative;
left: 220px;
top: 100px;
}
.uk-text-primary {
color: #3bd671 !important;
}
.uk-text-primary1 {
color: red;
font-family: Arial, Helvetica, sans-serif;
}
#tab-des {
font-family: Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 87%;
}
#tab-des td, #tab-des th {
border: 1px solid #ddd;
width: 0em;
padding: 8px;
}
#tab-des tr:nth-child(even){background-color: #f2f2f2;}
#tab-des tr:hover {background-color: #ddd;}
#tab-des th {
padding-top: 12px;
padding-bottom: 12px;
text-align: left;
background-color: #04AA6D;
color: white;
}
#tab-des-2 {
font-family: Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 87%;
top: 100px;
}
#tab-des-2 td, #tab-des-2 th {
border: 1px solid #ddd;
width: 0em;
padding: 8px;
}
#tab-des-2 tr:nth-child(even){background-color: #f2f2f2;}
#tab-des-2 tr:hover {background-color: #ddd;}
#tab-des-2 th {
padding-top: 12px;
padding-bottom: 12px;
text-align: left;
background-color: #04AA6D;
color: white;
}
</style>
<title class="bi-alarm">Status</title>
<% if ( down == 0) { %>
<link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yThc07Enyj9w12diQe+sDZ9Hf1P2/aTrk1WMgFu0+5onPfyK+JqgZszGhkAtEv4KiBXHk9HmIWr9AwA2C/wzyR6ZG0QF3wofWOuDg8MvLe/fYfTntL7Au4jzhd8dLx1KSxak0hxtBdoyAaQyyW7EuCcm6fGgmMlLIRBAH0ATlDcJ9oTkBmO5/A+2VHYJM2aw872R38tiwa4j7mI4OXMisQNkpvaEGI1xhPUbIQmhTdKwl8lYtBIlwH2F9MOu0WBwZmWhWcOj22Tl40At4irEViNLItTJv80TQkTFO+OomZgXJ2T8VX9zq+LpK54QfZg55JfXR/7tqwEuOxw3ZHN842vtqhDUhJTKW1soR+YV+7gO4t/6czotqe8BDiH+K+MP/y5a21e3jyS1EZLAzrebJGWN6znd+95dFvveCPKToBbxLXMUvW1CzxhHq3LD6KTpEqAd5L3LLr/vfjl8592tbYiBIxGhgvH5s4JrBbEKZ2XmwB31A0wcmw8ta+cD7jL94BrDm+cYXxvvgc0uThcWW1wcd6Vuk1v7bDp+fvyF134nPCpmAaMXXXdmc01GtI8Y9FiZGqjNpX8vWglS8/72Mvq9MylZ3rjXqCeFAJCQMqY9YeGG5geakXgTQ9oqz+5JF2Mjyhkse6+EKQBz/PODl7vvzCa4cUlcfIIGN2Ruzvc01eXyqcetrDNVHhxuiqeeRRAh9I25gbFfgW5S7bBuzT24lNc8G7c5BMwZnfuINWXt3UGqakEp4b1RYMad1y5253kR+BhSPAHADuQ9dPXp35YM5jkZvikhcEkErg1VhnT0QlzaQbMnHTfXYL5MNus6RdhOzsyQbn+LXLPNaAooso86Z6aQJmxFPW5BwQURdtnaNJ9rwH/A01X6IyC8LngAAAAAElFTkSuQmCC">
<% } %>
<!-- <% if ( down == 1) { %>
<link rel="stylesheet" type ="text/css" href="//static.zohocdn.com/chat/source/officechat/styles/loadingpage-min.243202ee25f1a5bb3db367d2338ab25e.css">
<% } %> -->
</head>
<body>
<div class = "header">
<div>
<h1 class="with-in-header">Service status</h1>
<div class="last-update">
Last updated <%=date %>
</div>
</div>
<div class = "header1">
<% if ( down == 0) { %>
<h1><i class="dot" aria-hidden = "true" style="font-size:26px;color:lightgreen"></i> <strong> All systems
<span class="uk-text-primary">operational</span></strong></h1>
<% } %>
<% if ( down == 1) { %>
<h1><i class="dot1" aria-hidden = "true" style="font-size:26px;color:red"></i> <strong> Some systems are
<span class="uk-text-primary1">down</span></strong></h1>
<% } %>
</div>
</div>
<div class = "header2"><h1><i style="font-size:18px;color:black"></i> <strong>Api Services</strong></h1></div>
<div class = "header3">
<table id="tab-des">
<thead>
<tr>
<th>Api</th>
<th>StatusCode</th>
<th>Status</th>
<th>Refresh</th>
</tr>
</thead>
<% data.forEach(function(status , index ) { %>
<tbody>
<tr class=index>
<td><%=status.Api %></td>
<td><%=status.StatusCode %></td>
<td>
<% if( status.Status == "Up") { %>
<i class="dot" style="font-size:14px;color: #3bd671 !important;height:15px;width:15px;"></i> <b><%=status.Status %></b>
<% } %>
<% if( status.Status == "Down") { %>
<i class="dot1" style="font-size:14px;color: red;height:15px;width:15px;"></i> <b1><%=status.Status %></b1>
<% } %>
</td>
<td><a href="#" class="btn btn-info btn-sm" style="color: white;background-color: #3bd671 !important;">Refresh</a></td>
</tr>
</tbody>
<% }) %>
</table>
</div>
<div class = "header4"><h1><i style="font-size:18px;color:black"></i> <strong>Server Services</strong></h1></div>
<div class = "header5">
<table id="tab-des-2">
<thead>
<tr>
<th>Server</th>
<th>StatusCode</th>
<th>Status</th>
<th>Refresh</th>
</tr>
</thead>
<% data1.forEach(function(status , index ) { %>
<tbody>
<tr class=index>
<td><%=status.Api %></td>
<td><%=status.StatusCode %></td>
<td>
<% if( status.Status == "Up") { %>
<i class="dot" style="font-size:14px;color: #3bd671 !important;height:15px;width:15px;"></i> <b><%=status.Status %></b>
<% } %>
<% if( status.Status == "Down") { %>
<i class="dot1" style="font-size:14px;color: red;height:15px;width:15px;"></i> <b1><%=status.Status %></b1>
<% } %>
</td>
<td><a href="#" class="btn btn-info btn-sm" style="color: white;background-color: #3bd671 !important;">Refresh</a></td>
</tr>
</tbody>
<% }) %>
</table>
</div>
</body>
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.4.1.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
<script>
$(".index").click(function (evt) {
var api = $(evt.target).parent().parent("tr").find("td:nth-child(1)").text();
$.ajax({
type: "post",
url: "http://localhost:8888/api/SingleApiStatus",
data: {api : api},
success: function(response) {
if (response.success == true)
{
alert(response.Api+" called");
if (response.Status == "Up")
{
var success = '<i class="dot" style="font-size:14px;color: #3bd671 !important;height:15px;width:15px;"></i> <b>'+response.Status+'</b>'
}
else
{
var success = '<i class="dot1" style="font-size:14px;color: #3bd671 !important;height:15px;width:15px;"></i> <b>'+response.Status+'</b>'
}
$(evt.target).parent().parent("tr").find("td:nth-child(2)").html(response.StatusCode);
$(evt.target).parent().parent("tr").find("td:nth-child(3)").html(success);
}
},
error: function(jqXHR, textStatus, err) {
alert('text status '+textStatus+', err '+err)
}
});
});
</script>
</html>