Permalink
Browse files

Show a message box when the server can't be reached

  • Loading branch information...
1 parent f90d217 commit e2c4de92f34a14c3d258ffed3c8236d430f6715b @tibbe committed Jan 2, 2012
Showing with 27 additions and 0 deletions.
  1. BIN assets/cross-16-ns.png
  2. +5 −0 assets/index.html
  3. +16 −0 assets/monitor.css
  4. +6 −0 assets/monitor.js
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -28,7 +28,12 @@
</div>
<div class="container">
+ <div id="message-box" class="icon-alert span-24" style="display: none;">
+ Lost connection to server.
+ </div>
+
<div id="plots" class="span-16">
+
<div id="current-bytes-used-plot" class="plot-container">
<h3>Current residency</h3>
<div class="plot"></div>
View
@@ -47,6 +47,22 @@
}
/**
+ * Message box
+ *
+ * Taken from: http://woork.blogspot.com/2008/03/css-message-box-collection.html
+ */
+
+.icon-alert {
+ border: solid 1px #CB2026;
+ background: #F6CBCA url(cross-16-ns.png) 8px 6px no-repeat;
+ color: #D0282A;
+ padding: 4px 0;
+ text-align: center;
+ font-weight: bold;
+ margin-bottom: 10px;
+}
+
+/**
* Plots
*/
View
@@ -109,14 +109,20 @@ $(document).ready(function () {
function fetchData() {
function onDataReceived(stats) {
+ $("#message-box").hide();
for (var i = 0; i < listeners.length; i++) {
listeners[i](stats, stats.server_timestamp_millis);
}
}
+ function onError() {
+ $("#message-box").show();
+ }
+
$.ajax({
dataType: 'json',
success: onDataReceived,
+ error: onError,
cache: false
});

0 comments on commit e2c4de9

Please sign in to comment.