blob: 3dafae4458097e320504381db01b860508f6e908 [file] [log] [blame]
Scott Bakerac543a72015-01-27 15:29:41 -08001function 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==":-)") {
Scott Baker9edfdc02015-02-11 15:54:44 -080010 tooltip = 'last observer run time = ' + Math.floor(newData.last_duration) + ' seconds';
11 icon = "/static/img/green-cloud.gif";
Scott Bakerac543a72015-01-27 15:29:41 -080012 } else {
Scott Baker9edfdc02015-02-11 15:54:44 -080013 tooltip = "observer is offline";
14 icon = "/static/img/red-cloud.gif";
Scott Bakerac543a72015-01-27 15:29:41 -080015 }
Scott Baker9edfdc02015-02-11 15:54:44 -080016
17 html = '<span style="margin-left: 16px; cursor: pointer;" title="' + tooltip + '"><img src="' + icon +
18 '" width=16 height=16 onClick="showObserverCalendar();"></span>';
19
Scott Bakerac543a72015-01-27 15:29:41 -080020 $("#observer-status").html(html);
21 setTimeout(function() { updateObserverStatus(); }, 60000);
22 },
23 error: function() {
24 setTimeout(function() { updateObserverStatus(); }, 60000);
25 }
26});
27}
28
Scott Baker9edfdc02015-02-11 15:54:44 -080029function showObserverCalendar() {
30 $("#dialog-placeholder").html('<iframe src="https://www.google.com/calendar/embed?src=qlnr1b3rsquq702nbns42l88s4%40group.calendar.google.com&ctz=America/New_York" style="border: 0" width="800" height="600" frameborder="0" scrolling="no"></iframe>');
31 $("#dialog-placeholder").dialog({
32 autoOpen: false,
33 modal: true,
34 width: 850,
35 buttons : {
36 "Ok" : function() {
37 $(this).dialog("close");
38 }
39 }
40 });
41 $("#dialog-placeholder").dialog("open");
42}
43
Scott Bakerac543a72015-01-27 15:29:41 -080044$( document ).ready(function() {
45 updateObserverStatus();
46});