-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstatus.html
153 lines (137 loc) · 5.3 KB
/
status.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
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
141
142
143
144
145
146
147
148
149
150
151
152
153
<html>
<head>
<title>Status of Web Services | NUMUN</title>
<meta name="viewport" content="width=device-width, initial-scale=1, minimal-ui">
<link href='https://fonts.googleapis.com/css?family=Raleway:400,700,300|Lato:700,300' rel='stylesheet' type='text/css'>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet">
<link href="assets/css/adviser-style.min.css" rel="stylesheet" type="text/css" />
<style type="text/css">
h3, p {
font-family: 'Lato';
}
</style>
</head>
<body data-spy="scroll" data-offset="0" data-target="#navbar-main">
<div class="container">
<div class="row">
<h2>Northwestern University Model United Nations</h2>
</div>
<div class="row">
<div class="col-sm-12">
<div class="alert hidden" id="weather-alert-1">
<h3 class="weather-alert-heading"></h3>
<p class="lead weather-alert-title"></p>
<p class="weather-alert-description"></p>
</div>
<div class="alert hidden" id="weather-alert-2">
<h3 class="weather-alert-heading"></h3>
<p class="lead weather-alert-title"></p>
<p class="weather-alert-description"></p>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<p class="lead">Status of NUMUN Web Services</p>
<h3><i id="web-status-icon" class="fa fa-circle fa-lg"></i> Public Website</h3>
<h3><i id="portal-status-icon" class="fa fa-circle fa-lg"></i> Portals</h3>
</div>
<div class="col-sm-6">
<p class="lead">Status of Other Services</p>
<h3><i id="slack-status-icon" class="fa fa-circle fa-lg"></i> <i id="slack-status-icon" class="fa fa-slack"></i> Slack <small>Communications</small></h3>
<h3><i id="mandrill-status-icon" class="fa fa-circle fa-lg"></i> Mandrill <small>Email Service</small></h3>
</div>
</div>
</div>
</div><!-- /.footer -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script type="text/javascript" src="assets/js/custom.js"></script>
<script type="text/javascript">
$(document).ready(function(){
//get NUMUN Portal Status
$.ajax('https://portal.numun.org/pages/jsonp.php', { dataType: 'jsonp' }).done(function(e){
if(e.status == 'success'){
//success, page is available
//console.log('Portal works.');
$('#portal-status-icon').addClass('text-success');
}
})
.fail(function(){
$('#portal-status-icon').addClass('text-danger');
});
//get NUMUN Website Status
$.ajax('http://numun.org/jsonp.php', { dataType: 'jsonp' }).done(function(e){
if(e.status == 'success'){
//success, page is available
//console.log('Portal works.');
$('#web-status-icon').addClass('text-success');
}
})
.fail(function(){
$('#web-status-icon').addClass('text-danger');
});
//Get Slack API status
$.ajax('https://slack.com/api/api.test').done(function(e){
//console.log(e.ok);
if(e.ok == true){
//success, page is available
$('#slack-status-icon').addClass('text-success');
}else{
$('#slack-status-icon').addClass('text-warning');
}
})
.fail(function(){
$('#slack-status-icon').addClass('text-danger');
});
//Get Mandrill API status
$.ajax('https://mandrillapp.com/api/1.0/test').done(function(){
$('#mandrill-status-icon').addClass('text-success');
})
.error(function(e){
if(e.status == 500){
//"success" API is available - we haven't supplied a proper arg.
$('#mandrill-status-icon').addClass('text-success');
}else{
//API throws non-server error
$('#mandrill-status-icon').addClass('text-warning');
}
});
//Get weather alerts for Cook County
$.ajax({
type: "GET",
url: "https://portal.numun.org/pages/weather.php",
dataType: "jsonp",
callback: "callback"
}).done(function(result){
//$.parseJSON(result);
if(result[0].status == 'Actual'){
$("#weather-alert-1").removeClass('hidden');
if(result[0].type == 'Alert' || result[0].type == 'Update'){
$("#weather-alert-1").addClass('alert-danger');
$("#weather-alert-1").children(".weather-alert-heading").html('<i class="fa fa-exclamation-triangle fa-lg"></i> Weather Alert');
}else if(result[0].type == 'Cancel'){
$("#weather-alert-1").addClass('alert-info');
$("#weather-alert-1").children(".weather-alert-heading").html('<i class="fa fa-info-circle fa-lg"></i> Weather Alert Cancelled');
}
$("#weather-alert-1").children(".weather-alert-title").text(result[0].title);
$("#weather-alert-1").children(".weather-alert-description").text(result[0].summary);
}
if(result[1].status == 'Actual'){
$("#weather-alert-2").removeClass('hidden');
if(result[1].type == 'Alert' || result[1].type == 'Update'){
$("#weather-alert-2").addClass('alert-danger');
$("#weather-alert-2").children(".weather-alert-heading").html('<i class="fa fa-exclamation-triangle fa-lg"></i> Weather Alert');
}else if(result[1].type == 'Cancel'){
$("#weather-alert-2").addClass('alert-info');
$("#weather-alert-2").children(".weather-alert-heading").html('<i class="fa fa-info-circle fa-lg"></i> Weather Alert Cancelled');
}
$("#weather-alert-2").children(".weather-alert-title").text(result[1].title);
$("#weather-alert-2").children(".weather-alert-description").text(result[1].summary);
}
}).fail(function(){
});
});
</script>
</body>
</html>