Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #60 from pazustep/status-details

Enhances status page to show all keys in status hash
  • Loading branch information...
commit 2ff504d4b7f6cd5fc0bd0549583e2b77c1a3ad4e 2 parents 93d315a + ba08fba
@quirkey authored
Showing with 32 additions and 0 deletions.
  1. +32 −0 lib/resque/server/views/status.erb
View
32 lib/resque/server/views/status.erb
@@ -10,6 +10,19 @@
</div>
<div class="status-message"><%= @status.message %></div>
<div class="status-time"><%= @status.time? ? @status.time : 'Not started' %></div>
+ <h2>Details</h2>
+ <div class="status-details">
+ <table>
+ <thead>
+ <tr>
+ <th>Key</th>
+ <th>Value</th>
+ </tr>
+ </thead>
+ <tbody class="status-details-body">
+ </tbody>
+ </table>
+ </div>
</div>
<script type="text/javascript" charset="utf-8">
@@ -43,6 +56,15 @@
if (json.time) {
$status.find('.status-time').text(new Date(json.time * 1000).toString())
}
+
+ var $details = $status.find('.status-details-body');
+ $details.empty();
+
+ for (key in json) {
+ var $row = $("<tr>").appendTo($details);
+ $("<td>").text(key).appendTo($row);
+ $("<td>").text(printValue(key, json[key])).appendTo($row);
+ }
};
var status = $status.attr('rel');
if (status == 'working' || status == 'queued' || status == "") {
@@ -53,5 +75,15 @@
});
};
+ function printValue(key, value) {
+ if (/(^|_)time$/.test(key) && typeof value == 'number') {
+ var time = new Date();
+ time.setTime(value * 1000);
+ return time.toUTCString();
+ } else {
+ return JSON.stringify(value);
+ }
+ }
+
});
</script>
Please sign in to comment.
Something went wrong with that request. Please try again.