Commits

Chris Mutel committed 3f62c72

0.2; add some columns

Comments (0)

Files changed (3)

mpwebstatus/templates/index.html

 <script type="text/javascript">
 var get_status = function(j) {
     if (j.finished === true) {
-        return "Finished"
+        return "<span style=\"color: green\">Finished</span>"
     } else {
         return "Working"
     };
     $.get('/status', function(data){
         var json = jQuery.parseJSON(data);
         $(function () {
-            var content = '<thead><tr><th>Task</th><th>Status</th><th>ETA (seconds)</th><th>Elapsed (seconds)</th><th>Progress</th><th>Total</th></tr></thead>';
+            var content = '<thead><tr><th>Task</th><th>Status</th><th>ETA (seconds)</th><th>Last updated (seconds)</th><th>Elapsed (seconds)</th><th>Progress</th><th>Total</th></tr></thead>';
             //content += '<tbody>'; -- **superfluous**
             for (var i = 0; i < json.length; i++) {
-                content += '<tr><td>' + json[i].task + '</td><td>'
-                content += get_status(json[i]) + '</td><td>' + n(json[i].eta)
-                content += '</td><td>' + n(json[i].elapsed) + '</td><td>'
-                content += json[i].progress + '</td><td>' + json[i].total
+                content += '<tr><td>' + json[i].task 
+                content += '</td><td>' + get_status(json[i]) 
+                content += '</td><td>' + n(json[i].eta)
+                content += '</td><td>' + n(json[i].last_updated)
+                content += '</td><td>' + n(json[i].elapsed)
+                content += '</td><td>' + json[i].progress
+                content += '</td><td>' + json[i].total
                 content += '</td></tr>'
             }
              $('#jobs').html(content);

mpwebstatus/webapp.py

 
 @app.route("/status")
 def status():
-    print datastore
     d = [{
         "task": k,
         "eta": v.get("eta", 0),
-        "elapsed": time.time() - v.get("_born", 0),
-        "ping": v.get("_ping", 0),
+        "elapsed": (v.get("_ping", 0) if (v.get("finished", False) and v.get("_ping", 0)
+            ) else time.time()) - v.get("_born", 0),
+        "last_updated": time.time() - v.get("_ping", 0),
         "finished": v.get("finished", False),
         "progress": v.get("progress", 0),
         "total": v.get("total", 0),
 
 setup(
     name='mpwebstatus',
-    version='0.1',
+    version='0.2',
     author='Chris Mutel',
     author_email='cmutel@gmail.com',
     url='https://bitbucket.org/cmutel/mpwebstatus',