Scott Baker | e3d6faf | 2015-01-27 15:29:41 -0800 | [diff] [blame] | 1 | function updateObserverStatus() { |
| 2 | var url="/observer"; |
| 3 | console.log("fetching observer status url " + url); |
| 4 | $.ajax({ url: url, |
| 5 | dataType : 'json', |
| 6 | type : 'GET', |
| 7 | success: function(newData) { |
| 8 | console.log(newData); |
| 9 | if (newData.health==":-)") { |
| 10 | html = '<span style="margin-left: 16px;" title="last observer run time = ' + Math.floor(newData.last_duration) + ' seconds"><img src="/static/img/green-cloud.gif" width=16 height=16></span>'; |
| 11 | } else { |
Scott Baker | 9d0595c | 2015-01-29 14:46:14 -0800 | [diff] [blame] | 12 | html = '<span style="margin-left: 16px;" title="observer is offline"><img src="/static/img/red-cloud.gif" width=16 height=16></span>'; |
Scott Baker | e3d6faf | 2015-01-27 15:29:41 -0800 | [diff] [blame] | 13 | } |
| 14 | $("#observer-status").html(html); |
| 15 | setTimeout(function() { updateObserverStatus(); }, 60000); |
| 16 | }, |
| 17 | error: function() { |
| 18 | setTimeout(function() { updateObserverStatus(); }, 60000); |
| 19 | } |
| 20 | }); |
| 21 | } |
| 22 | |
| 23 | $( document ).ready(function() { |
| 24 | updateObserverStatus(); |
| 25 | }); |