Skip to content

Commit

Permalink
Adjust time format in maintenance listing table to include year (#364)
Browse files Browse the repository at this point in the history
  • Loading branch information
samudary committed Mar 12, 2021
1 parent 048bb39 commit b87a064
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions app/helpers/pg_hero/home_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,15 @@ def pghero_remove_index(query)
ret << ", column: #{columns.inspect}" if columns
ret
end

def pghero_formatted_vacuum_times(time)
content_tag(:span, title: pghero_formatted_date_time(time)) do
"#{time_ago_in_words(time.in_time_zone(@time_zone))} ago"
end
end

def pghero_formatted_date_time(time)
l time.in_time_zone(@time_zone), format: :long
end
end
end
4 changes: 2 additions & 2 deletions app/views/pg_hero/home/maintenance.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
<td>
<% time = [table[:last_autovacuum], table[:last_vacuum]].compact.max %>
<% if time %>
<%= l time.in_time_zone(@time_zone), format: :short %>
<%= pghero_formatted_vacuum_times(time) %>
<% else %>
<span class="text-muted">Unknown</span>
<% end %>
</td>
<td>
<% time = [table[:last_autoanalyze], table[:last_analyze]].compact.max %>
<% if time %>
<%= l time.in_time_zone(@time_zone), format: :short %>
<%= pghero_formatted_vacuum_times(time) %>
<% else %>
<span class="text-muted">Unknown</span>
<% end %>
Expand Down

0 comments on commit b87a064

Please sign in to comment.