Add 'all' column to admin dashboard counts

This commit is contained in:
Neil Lalonde 2013-03-21 13:27:53 -04:00
parent 38415f28da
commit 40962c84ca
17 changed files with 1346 additions and 1215 deletions

View File

@ -61,11 +61,6 @@
</div>
{{/if}}
<div class="dashboard-stats total-users">
{{i18n admin.dashboard.total_users}}: <strong>{{#unless loading}}{{ totalUsers }}{{/unless}}</strong><br/>
</div>
<div class="dashboard-stats trust-levels">
<table class="table table-condensed table-hover">
<thead>
@ -94,6 +89,7 @@
<th>{{i18n admin.dashboard.reports.yesterday}}</th>
<th>{{i18n admin.dashboard.reports.last_7_days}}</th>
<th>{{i18n admin.dashboard.reports.last_30_days}}</th>
<th>{{i18n admin.dashboard.reports.all}}</th>
</tr>
</thead>
{{#unless loading}}

View File

@ -4,4 +4,5 @@
<td class="value">{{valueAtDaysAgo data 1}}</td>
<td class="value">{{valueAtDaysAgo data 7}}</td>
<td class="value">{{valueAtDaysAgo data 30}}</td>
<td class="value">{{total}}</td>
</tr>

View File

@ -4,4 +4,5 @@
<td class="value">{{valueAtDaysAgo data 1}}</td>
<td class="value">{{sumLast data 7}}</td>
<td class="value">{{sumLast data 30}}</td>
<td class="value">{{total}}</td>
</tr>

View File

@ -9,7 +9,6 @@ class AdminDashboardData
def as_json
@json ||= {
reports: REPORTS.map { |type| Report.find(type) },
total_users: User.count,
problems: [rails_env_check, host_names_check, gc_checks].compact
}.merge(
SiteSetting.version_checks? ? {version_check: DiscourseUpdates.check_version} : {}

View File

@ -1,10 +1,11 @@
class Report
attr_accessor :type, :data
attr_accessor :type, :data, :total
def initialize(type)
@type = type
@data = nil
@total = nil
end
def as_json
@ -13,7 +14,8 @@ class Report
title: I18n.t("reports.#{self.type}.title"),
xaxis: I18n.t("reports.#{self.type}.xaxis"),
yaxis: I18n.t("reports.#{self.type}.yaxis"),
data: self.data
data: self.data,
total: self.total
}
end
@ -39,6 +41,7 @@ class Report
User.count_by_signup_date(30.days.ago).each do |date, count|
report.data << {x: date, y: count}
end
report.total = User.count
end
def self.report_topics(report)
@ -46,6 +49,7 @@ class Report
Topic.count_per_day(30.days.ago).each do |date, count|
report.data << {x: date, y: count}
end
report.total = Topic.count
end
def self.report_posts(report)
@ -53,6 +57,7 @@ class Report
Post.count_per_day(30.days.ago).each do |date, count|
report.data << {x: date, y: count}
end
report.total = Post.count
end
def self.report_flags(report)
@ -62,6 +67,7 @@ class Report
report.data << {x: i.days.ago.to_date.to_s, y: count}
end
end
report.total = PostAction.where(post_action_type_id: PostActionType.flag_types.values).count
end
def self.report_users_by_trust_level(report)
@ -76,6 +82,7 @@ class Report
PostAction.count_likes_per_day(30.days.ago).each do |date, count|
report.data << {x: date, y: count}
end
report.total = PostAction.where(post_action_type_id: PostActionType.types[:like]).count
end
def self.report_emails(report)
@ -83,6 +90,7 @@ class Report
EmailLog.count_per_day(30.days.ago).each do |date, count|
report.data << {x: date, y: count}
end
report.total = EmailLog.count
end
end

View File

@ -695,7 +695,6 @@ cs:
please_upgrade: "Prosím aktualizujte!"
latest_version: "Poslední verze"
update_often: 'Prosím aktualizujte často!'
total_users: "Celkem uživatelů"
moderator_short: "mod"
reports:

View File

@ -700,7 +700,6 @@ en:
installed_version: "Installed"
latest_version: "Latest"
update_often: 'Please update often!'
total_users: "Total Users"
moderator_short: "mod"
problems_found: "Some problems have been found with your installation of Discourse:"
@ -712,6 +711,7 @@ en:
all_time: "All Time"
7_days_ago: "7 Days Ago"
30_days_ago: "30 Days Ago"
all: "All"
commits:
latest_changes: "Latest changes."

View File

@ -701,7 +701,6 @@ fr:
installed_version: "Version installée"
latest_version: "Dernière version"
update_often: "Merci de mettre à jour régulièrement !"
total_users: "Total d'utilisateurs"
moderator_short: "mod"
problems_found: "Quelques problèmes ont été trouvés dans votre installation de Discourse :"

File diff suppressed because it is too large Load Diff

View File

@ -703,7 +703,6 @@ zh_CN:
installed_version: "已安装"
latest_version: "最新版本"
update_often: '请经常升级!'
total_users: "用户总数"
moderator_short: "版主"
reports:

View File

@ -703,7 +703,6 @@ zh_TW:
installed_version: "已安裝"
latest_version: "最新版本"
update_often: '請經常升級!'
total_users: "用戶總數"
moderator_short: "版主"
reports:

View File

@ -269,10 +269,6 @@ cs:
title: "Nová 'líbí se'"
xaxis: "Den"
yaxis: "Počet nových 'líbí se'"
total_users:
title: "Celkem uživatelů"
xaxis: "Den"
yaxis: "Celkový počet uživatelů"
flags:
title: "Nahlášení"
xaxis: "Den"

View File

@ -252,27 +252,23 @@ en:
xaxis: "Day"
yaxis: "Number of visits"
signups:
title: "New Users"
title: "Users"
xaxis: "Day"
yaxis: "Number of new users"
topics:
title: "New Topics"
title: "Topics"
xaxis: "Day"
yaxis: "Number of new topics"
posts:
title: "New Posts"
title: "Posts"
xaxis: "Day"
yaxis: "Number of new posts"
likes:
title: "New Likes"
title: "Likes"
xaxis: "Day"
yaxis: "Number of new likes"
total_users:
title: "Total Users"
xaxis: "Day"
yaxis: "Total number of users"
flags:
title: "New Flags"
title: "Flags"
xaxis: "Day"
yaxis: "Number of flags"
users_by_trust_level:

View File

@ -274,10 +274,6 @@ fr:
title: Nouveau Likes
xaxis: Jour
yaxis: Nombre de Likes
total_users:
title: "Total d'utilisateurs"
xaxis: Jour
yaxis: "Total d'utilisateurs"
flags:
title: Nouveaux Signalements
xaxis: Jour

File diff suppressed because it is too large Load Diff

View File

@ -266,10 +266,6 @@ zh_CN:
title: "新的赞"
xaxis: "天"
yaxis: "新的赞数"
total_users:
title: "用户总数"
xaxis: "天"
yaxis: "用户总数"
flags:
title: "投诉"
xaxis: "天"

View File

@ -266,10 +266,6 @@ zh_TW:
title: "新的贊"
xaxis: "天"
yaxis: "新的贊數"
total_users:
title: "用戶總數"
xaxis: "天"
yaxis: "用戶總數"
flags:
title: "投訴"
xaxis: "天"