[#4604] Add the last cache timestamps to the caching admin panel

This commit is contained in:
Eric Davis
2010-10-13 11:50:24 -07:00
parent 073dfe1177
commit 7824eadc94
4 changed files with 57 additions and 3 deletions

View File

@@ -6,5 +6,17 @@ class RateCachesController < ApplicationController
before_filter :require_admin
def index
@last_caching_run = if Setting.plugin_redmine_rate['last_caching_run'].present? && Setting.plugin_redmine_rate['last_caching_run'].to_date
format_time(Setting.plugin_redmine_rate['last_caching_run'])
else
l(:text_no_cache_run)
end
@last_cache_clearing_run = if Setting.plugin_redmine_rate['last_cache_clearing_run'].present? && Setting.plugin_redmine_rate['last_cache_clearing_run'].to_date
format_time(Setting.plugin_redmine_rate['last_cache_clearing_run'])
else
l(:text_no_cache_run)
end
end
end

View File

@@ -1 +1,13 @@
<h2><%= l(:text_rate_caches_panel) %></h2>
<div id="caching-run">
<p>
<%= l(:text_last_caching_run) %><%= h(@last_caching_run) %>
</p>
</div>
<div id="cache-clearing-run">
<p>
<%= l(:text_last_cache_clearing_run) %><%= h(@last_cache_clearing_run) %>
</p>
</div>

View File

@@ -9,4 +9,6 @@ en:
rate_label_default: Default Rate
rate_cost: Cost
text_rate_caches_panel: "Rate Caches"
text_no_cache_run: "no cache run found"
text_last_caching_run: "Last caching run at: "
text_last_cache_clearing_run: "Last cache clearing run at: "

View File

@@ -1,7 +1,17 @@
require 'test_helper'
class AdminPanelTest < ActionController::IntegrationTest
include Redmine::I18n
def setup
@last_caching_run = 4.days.ago.to_s
@last_cache_clearing_run = 7.days.ago.to_s
Setting.plugin_redmine_rate = {
'last_caching_run' => @last_caching_run,
'last_cache_clearing_run' => @last_cache_clearing_run
}
@user = User.generate!(:admin => true, :password => 'rates', :password_confirmation => 'rates')
login_as(@user.login, 'rates')
@@ -18,8 +28,26 @@ class AdminPanelTest < ActionController::IntegrationTest
end
should "show the last run timestamp for the last caching run"
should "show the last run timestamp for the last cache clearing run"
should "show the last run timestamp for the last caching run" do
click_link "Administration"
click_link "Rate Caches"
assert_select '#caching-run' do
assert_select 'p', :text => /#{format_time(@last_caching_run)}/
end
end
should "show the last run timestamp for the last cache clearing run" do
click_link "Administration"
click_link "Rate Caches"
assert_select '#cache-clearing-run' do
assert_select 'p', :text => /#{format_time(@last_cache_clearing_run)}/
end
end
should "have a button to force a caching run"
should "have a button to force a cache clearing run"
end