watcher: sort index of listener listing
authorEric Wong <normalperson@yhbt.net>
Mon, 18 Jun 2012 20:45:13 +0000 (18 13:45 -0700)
committerEric Wong <normalperson@yhbt.net>
Mon, 18 Jun 2012 20:49:47 +0000 (18 13:49 -0700)
For hosts with many listeners, it should be easier to read the
index page if the results are shown in a consistent order.

Requested privately via email to raindrops@bogomips.org

lib/raindrops/watcher.rb

index 869fa17..5493374 100644 (file)
@@ -337,7 +337,9 @@ class Raindrops::Watcher
       "<table><tr>" \
         "<th>address</th><th>active</th><th>queued</th><th>reset</th>" \
       "</tr>" <<
-      all.map do |addr,stats|
+      all.sort do |a,b|
+        a[0] <=> b[0] # sort by addr
+      end.map do |addr,stats|
         e_addr = escape addr
         "<tr>" \
           "<td><a href='/tail/#{e_addr}.txt' " \