lib/resque_bus/server/views/bus.erb in resque-bus-0.2.3 vs lib/resque_bus/server/views/bus.erb in resque-bus-0.2.4
- old
+ new
@@ -12,28 +12,38 @@
// -->
</script>
<%
app_hash = {}
+ class_hash = {}
event_hash = {}
# collect each differently
ResqueBus::Application.all.each do |app|
app_key = app.app_key
app_hash[app_key] ||= []
app.event_display_tuples.each do |tuple|
- event, queue = tuple
- app_hash[app_key] << [event, queue]
+ class_name, queue, filters = tuple
+ if filters["bus_event_type"]
+ event = filters["bus_event_type"]
+ else
+ event = "see filter"
+ end
+ app_hash[app_key] << [event, class_name, queue, filters]
+
+ class_hash[class_name] ||= []
+ class_hash[class_name] << [app_key, event, queue, filters]
+
event_hash[event] ||= []
- event_hash[event] << [app_key, queue]
+ event_hash[event] << [app_key, class_name, queue, filters]
end
end
# sort each list item by secondary label
- event_hash.each do |_, array|
+ class_hash.each do |_, array|
array.sort!{ |a,b| a.first <=> b.first }
end
event_hash.each do |_, array|
array.sort!{ |a,b| a.first <=> b.first }
end
@@ -47,12 +57,13 @@
end
if !val
out = "<td> </td><td> </td>"
else
- detail, queue = val
- out = "<td>#{h(detail)}</td><td><a href='#{u("queues/#{queue}")}'>#{h(queue)}</a></td>"
+ one, two, queue, filters = val
+ out = "<td>#{h(one)}</td><td>#{h(two)}</td><td><a href='#{u("queues/#{queue}")}'>#{h(queue)}</a></td>"
+ out << "<td>#{h(Resque.encode(filters).gsub(/\"bus_special_value_(\w+)\"/){ "(#{$1})" }).gsub(" ", " ").gsub('","', '", "')}</td>"
end
if first
"<tr><td>#{h(name)}#{form}</td>#{out}</tr>\n"
else
@@ -75,27 +86,48 @@
%>
<h1 class='wi'>Applications</h1>
-<p class='intro'>The apps below have registered the given event types and queues.</p>
+<p class='intro'>The apps below have registered the given classes and queues.</p>
<table class='queues'>
<tr>
<th>App Key</th>
<th>Event Type</th>
+ <th>Class Name</th>
<th>Queue</th>
+ <th>Filters</th>
</tr>
<%= output_hash(app_hash, ["Unsubscribe", "bus/unsubscribe"]) %>
</table>
<p> </p>
-
+
<h1 class='wi'>Events</h1>
-<p class='intro'>The event types below have been registered by the given applications and queues.</p>
+<p class='intro'>The events below have been registered by the given applications and queues.</p>
<table class='queues'>
<tr>
<th>Event Type</th>
<th>App Key</th>
+ <th>Class Name</th>
<th>Queue</th>
+ <th>Filters</th>
</tr>
<%= output_hash(event_hash, false) %>
+</table>
+
+
+
+<p> </p>
+
+<h1 class='wi'>Classes</h1>
+<p class='intro'>The classes below have been registered by the given applications and queues.</p>
+<table class='queues'>
+ <tr>
+ <th>Class Name</th>
+ <th>App Key</th>
+ <th>Event Type</th>
+ <th>Queue</th>
+ <th>Filters</th>
+ </tr>
+ <%= output_hash(class_hash, false) %>
</table>