blob: 2e46a164160bbbbcd2196617fcbbeb76117d8e5d [file] [log] [blame]
Scott Bakerac543a72015-01-27 15:29:41 -08001function updateObserverStatus() {
2 var url="/observer";
Scott Bakerac543a72015-01-27 15:29:41 -08003 $.ajax({ url: url,
4 dataType : 'json',
5 type : 'GET',
6 success: function(newData) {
7 console.log(newData);
8 if (newData.health==":-)") {
Sapan Bhatiabfb1a892016-03-25 16:51:49 +01009 tooltip = 'last synchronizer run time = ' + Math.floor(newData.last_duration) + ' seconds';
Scott Baker9edfdc02015-02-11 15:54:44 -080010 icon = "/static/img/green-cloud.gif";
Scott Bakerac543a72015-01-27 15:29:41 -080011 } else {
Sapan Bhatiabfb1a892016-03-25 16:51:49 +010012 tooltip = "synchronizer is offline";
Matteo Scandolo2500e392016-03-25 17:20:27 -070013 icon = "/static/img/red-cloud.gif";
Scott Bakerac543a72015-01-27 15:29:41 -080014 }
Scott Baker9edfdc02015-02-11 15:54:44 -080015
16 html = '<span style="margin-left: 16px; cursor: pointer;" title="' + tooltip + '"><img src="' + icon +
17 '" width=16 height=16 onClick="showObserverCalendar();"></span>';
18
Scott Bakerac543a72015-01-27 15:29:41 -080019 $("#observer-status").html(html);
20 setTimeout(function() { updateObserverStatus(); }, 60000);
21 },
22 error: function() {
23 setTimeout(function() { updateObserverStatus(); }, 60000);
24 }
25});
26}
27
Scott Baker9edfdc02015-02-11 15:54:44 -080028function showObserverCalendar() {
29 $("#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>');
30 $("#dialog-placeholder").dialog({
31 autoOpen: false,
32 modal: true,
33 width: 850,
34 buttons : {
35 "Ok" : function() {
36 $(this).dialog("close");
37 }
38 }
39 });
40 $("#dialog-placeholder").dialog("open");
41}
42
Scott Bakerac543a72015-01-27 15:29:41 -080043$( document ).ready(function() {
44 updateObserverStatus();
45});