diff --git a/app/assets/javascripts/admin/templates/dashboard.hbs b/app/assets/javascripts/admin/templates/dashboard.hbs
index 7c9aecd5f..706af4059 100644
--- a/app/assets/javascripts/admin/templates/dashboard.hbs
+++ b/app/assets/javascripts/admin/templates/dashboard.hbs
@@ -62,6 +62,27 @@
+
+
+
+
+ {{i18n 'admin.dashboard.traffic_short'}} |
+ {{i18n 'admin.dashboard.reports.today'}} |
+ {{i18n 'admin.dashboard.reports.yesterday'}} |
+ {{i18n 'admin.dashboard.reports.last_7_days'}} |
+ {{i18n 'admin.dashboard.reports.last_30_days'}} |
+ {{i18n 'admin.dashboard.reports.all'}} |
+
+
+ {{#unless loading}}
+ {{ render 'admin_report_counts' anon_reqs }}
+ {{ render 'admin_report_counts' logged_in_reqs }}
+ {{ render 'admin_report_counts' crawler_reqs}}
+ {{ render 'admin_report_counts' total_reqs}}
+ {{/unless}}
+
+
+
diff --git a/app/models/admin_dashboard_data.rb b/app/models/admin_dashboard_data.rb
index ccb1db1d6..8da275115 100644
--- a/app/models/admin_dashboard_data.rb
+++ b/app/models/admin_dashboard_data.rb
@@ -16,7 +16,11 @@ class AdminDashboardData
'system_private_messages',
'moderator_warning_private_messages',
'notify_moderators_private_messages',
- 'notify_user_private_messages'
+ 'notify_user_private_messages',
+ 'anon_reqs',
+ 'crawler_reqs',
+ 'logged_in_reqs',
+ 'total_reqs'
]
def problems
diff --git a/app/models/report.rb b/app/models/report.rb
index 3cabe4349..7ce3e7fcb 100644
--- a/app/models/report.rb
+++ b/app/models/report.rb
@@ -45,6 +45,44 @@ class Report
report
end
+ def self.req_report(report, filter=nil)
+ data = ApplicationRequest.all
+
+ if mapped = ApplicationRequest.req_types[filter]
+ data = data.where(req_type: mapped)
+ end
+
+ filtered_results = data.where('date >= ? AND date <= ?', report.start_date.to_date, report.end_date.to_date)
+
+
+ report.data = []
+ filtered_results.group(:date)
+ .sum(:count)
+ .each do |date, count|
+
+ report.data << {x: date, y: count}
+ end
+
+ report.total = data.sum(:count)
+ report.prev30Days = filtered_results.sum(:count)
+ end
+
+ def self.report_anon_reqs(report)
+ req_report(report, :anon)
+ end
+
+ def self.report_crawler_reqs(report)
+ req_report(report, :crawler)
+ end
+
+ def self.report_logged_in_reqs(report)
+ req_report(report, :logged_in)
+ end
+
+ def self.report_total_reqs(report)
+ req_report(report)
+ end
+
def self.report_visits(report)
basic_report_about report, UserVisit, :by_day, report.start_date, report.end_date
end
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 9f6238d13..158d0081a 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -1535,6 +1535,8 @@ en:
space_free: "{{size}} free"
uploads: "uploads"
backups: "backups"
+ traffic_short: "Application Traffic"
+ traffic: "Application web requests"
reports:
today: "Today"
diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index a75be34e8..7d8575f5f 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -588,6 +588,22 @@ en:
title: "Top Referred Topics"
xaxis: "Topic"
num_clicks: "Clicks"
+ anon_reqs:
+ title: "Anonymous"
+ xaxis: "Day"
+ yaxis: "Anonymous application requests"
+ logged_in_reqs:
+ title: "Logged In"
+ xaxis: "Day"
+ yaxis: "Logged In application requests"
+ crawler_reqs:
+ title: "Crawler"
+ xaxis: "Day"
+ yaxis: "Crawler application requests"
+ total_reqs:
+ title: "Total"
+ xaxis: "Day"
+ yaxis: "Total application requests"
dashboard:
rails_env_warning: "Your server is running in %{env} mode."