whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sam Ruby <ru...@apache.org>
Subject [whimsy.git] [2/3] Commit 769a3a5: reorder columns, localize times
Date Tue, 19 Jan 2016 17:48:53 GMT
Commit 769a3a599f33e6df324ab0cb5be80e950a1726fd:
    reorder columns, localize times


Branch: refs/heads/master
Author: Sam Ruby <rubys@intertwingly.net>
Committer: Sam Ruby <rubys@intertwingly.net>
Pusher: rubys <rubys@apache.org>

------------------------------------------------------------
www/status/errors.cgi                                        | ++++++++++ --
------------------------------------------------------------
12 changes: 10 additions, 2 deletions.
------------------------------------------------------------


diff --git a/www/status/errors.cgi b/www/status/errors.cgi
index f98b3f1..36374d2 100755
--- a/www/status/errors.cgi
+++ b/www/status/errors.cgi
@@ -30,8 +30,8 @@ _html do
 
   _table.table do
     _tr_ do
-      _th 'Time'
       _th 'Pinger'
+      _th 'Time'
       _th 'Status'
       _th 'Error'
     end
@@ -39,11 +39,11 @@ _html do
     exceptions.sort.reverse.each do |time, pinger, text|
       color = (text.include?('HTTP/1.1 3') ? 'warning' : 'danger')
       _tr_ class: color do
-        _td time.iso8601
         _td align: 'right' do
           _a pinger, href:
             "https://www.pingmybox.com/pings?location=470&pinger=#{pinger}"
         end
+        _td.time time.iso8601
         _td text[/^HTTP\/1.1 (\d+)/, 1] 
         _td text.sub(/^HTTP\/1.1 \d+/, '')
       end
@@ -53,6 +53,14 @@ _html do
   _p do
     _a 'raw log', href: uri.to_s
   end
+
+  _script %{
+    Array.from(document.querySelectorAll('.time')).forEach(function(time) {
+      var date = new Date(Date.parse(time.textContent));
+      time.setAttribute('title', time.textContent);
+      time.textContent = date.toLocaleString();
+    });
+  }
 end
 
 

Mime
View raw message