This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/whimsy.git

The following commit(s) were added to refs/heads/master by this push:
       new  8ff9b25   cleanup: initial load; empty list; whimsy check
8ff9b25 is described below

commit 8ff9b259bfbfe706cea1e713ab31d2e105ab28c2
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Sat Sep 17 12:35:38 2016 -0400

    cleanup: initial load; empty list; whimsy check
---
 www/secmail/models/mailbox.rb   |  2 +-
 www/secmail/server.rb           |  3 ++
 www/secmail/views/index.html.rb |  2 +-
 www/secmail/views/index.js.rb   | 63 ++++++++++++++++++++++-------------------
 4 files changed, 39 insertions(+), 31 deletions(-)

diff --git a/www/secmail/models/mailbox.rb b/www/secmail/models/mailbox.rb
index 766962e..aa3c595 100644
--- a/www/secmail/models/mailbox.rb
+++ b/www/secmail/models/mailbox.rb
@@ -1,4 +1,4 @@
-#
+
 # Encapsulate access to mailboxes
 #
 
diff --git a/www/secmail/server.rb b/www/secmail/server.rb
index 6a713c7..e1af792 100644
--- a/www/secmail/server.rb
+++ b/www/secmail/server.rb
@@ -25,6 +25,9 @@ get '/' do
   # determine latest month for which there are messages
   archives = Dir["#{ARCHIVE}/*.yml"].select {|name| name =~ %r{/\d{6}\.yml$}}
   @mbox = archives.empty? ? nil : File.basename(archives.sort.last, '.yml')
+  @messages = Mailbox.new(@mbox).client_headers.select do |message|
+    message[:status] != :deleted
+  end
   @cssmtime = File.mtime('public/secmail.css').to_i
   _html :index
 end
diff --git a/www/secmail/views/index.html.rb b/www/secmail/views/index.html.rb
index 965a574..d4dffd7 100644
--- a/www/secmail/views/index.html.rb
+++ b/www/secmail/views/index.html.rb
@@ -12,6 +12,6 @@ _html do
 
   _script src: 'app.js'
   _.render '#index' do
-    _Index mbox: @mbox
+    _Index mbox: @mbox, messages: @messages
   end
 end
diff --git a/www/secmail/views/index.js.rb b/www/secmail/views/index.js.rb
index 25c90a8..1cd1c43 100644
--- a/www/secmail/views/index.js.rb
+++ b/www/secmail/views/index.js.rb
@@ -10,34 +10,38 @@ class Index < React
   end
 
   def render
-    _table do
-      _thead do
-        _tr do
-          _th 'Timestamp'
-          _th 'From'
-          _th 'Subject'
-        end
-      end
-
-      _tbody do
-        @messages.each do |message|
-
-          # determine the 'color' to use for the row
-          color = nil
-          color = 'deleted' if message.status == :deletePending
-          color = 'hidden' if message.status == :deleted
-          color = 'selected' if message.href == @selected
-
-          time = Date.new(Date.parse(message.time)).toLocaleString()
-
-          _tr class: color, onClick: self.selectRow, onDoubleClick: self.nav do
-            _td do
-              _a time, href: "#{message.href}", title: message.time
-            end 
-            _td message.from
-            _td message.subject
-          end
-        end
+    if not @messages or @messages.all? {|message| message.status == :deleted}
+      _p 'No documents remain to be processed.'
+    else
+      _table do
+       _thead do
+         _tr do
+           _th 'Timestamp'
+           _th 'From'
+           _th 'Subject'
+         end
+       end
+
+       _tbody do
+         @messages.each do |message|
+
+           # determine the 'color' to use for the row
+           color = nil
+           color = 'deleted' if message.status == :deletePending
+           color = 'hidden' if message.status == :deleted
+           color = 'selected' if message.href == @selected
+
+           time = Date.new(Date.parse(message.time)).toLocaleString()
+
+           _tr class: color, onClick: self.selectRow, onDoubleClick: self.nav 
do
+             _td do
+               _a time, href: "#{message.href}", title: message.time
+             end 
+             _td message.from
+             _td message.subject
+           end
+         end
+       end
       end
     end
 
@@ -47,7 +51,7 @@ class Index < React
     end
 
     if defined? window
-      unless window.location.hostname =~ /^whimsy(-test)?\.apache\.org$/
+      unless window.location.hostname =~ /^whimsy.*\.apache\.org$/
         _button.btn.btn_success 'check for new mail', onClick: self.refresh,
           disabled: @checking
       end
@@ -61,6 +65,7 @@ class Index < React
   # initialize next mailbox (year+month)
   def componentWillMount()
     @nextmbox = @@mbox
+    self.merge @@messages if @@messages
   end
 
   # on initial load, fetch latest mailbox, subscribe to keyboard and

-- 
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <commits@whimsical.apache.org>'].

Reply via email to