red and green observer status icons
diff --git a/planetstack/core/static/img/green-cloud.gif b/planetstack/core/static/img/green-cloud.gif
new file mode 100644
index 0000000..0a80d7d
--- /dev/null
+++ b/planetstack/core/static/img/green-cloud.gif
Binary files differ
diff --git a/planetstack/core/static/img/red-cloud.gif b/planetstack/core/static/img/red-cloud.gif
new file mode 100644
index 0000000..3025720
--- /dev/null
+++ b/planetstack/core/static/img/red-cloud.gif
Binary files differ
diff --git a/planetstack/core/static/observer_status.js b/planetstack/core/static/observer_status.js
new file mode 100644
index 0000000..56e9f09
--- /dev/null
+++ b/planetstack/core/static/observer_status.js
@@ -0,0 +1,25 @@
+function updateObserverStatus() {
+ var url="/observer";
+ console.log("fetching observer status url " + url);
+ $.ajax({ url: url,
+ dataType : 'json',
+ type : 'GET',
+ success: function(newData) {
+ console.log(newData);
+ if (newData.health==":-)") {
+ 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>';
+ } else {
+ html = '<span style="margin-left: 16px;" title="observer is offline"><img src="/static/img/red-cloud.gif"></span>';
+ }
+ $("#observer-status").html(html);
+ setTimeout(function() { updateObserverStatus(); }, 60000);
+ },
+ error: function() {
+ setTimeout(function() { updateObserverStatus(); }, 60000);
+ }
+});
+}
+
+$( document ).ready(function() {
+ updateObserverStatus();
+});
diff --git a/planetstack/templates/admin/base.html b/planetstack/templates/admin/base.html
index 49c6791..08d19d1 100644
--- a/planetstack/templates/admin/base.html
+++ b/planetstack/templates/admin/base.html
@@ -14,6 +14,7 @@
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script type="text/javascript" src="{% static 'log4javascript-1.4.6/log4javascript.js' %}"></script>
<script type="text/javascript" src="{% static 'uploadTextarea.js' %}"></script>
+ <script type="text/javascript" src="{% static 'observer_status.js' %}"></script>
<script type="text/javascript">var Suit = { $: $.noConflict() }; if (!$) $ = Suit.$; </script>
{% if 'SHOW_REQUIRED_ASTERISK'|suit_conf %}
@@ -84,6 +85,7 @@
<div id="user-tools">
{% trans 'Welcome,' %}
<a href="http://{{ request.get_host}}/admin/core/user/{{user.id}}">{{user.email}}</a>
+ <span id="observer-status"></span>
<span class="user-links">
{% block userlinks %}
{% url 'django-admindocs-docroot' as docsroot %}