about summary refs log tree commit diff
path: root/app/controllers/admin
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2020-04-03 13:06:34 +0200
committerGitHub <noreply@github.com>2020-04-03 13:06:34 +0200
commitf65568f1d400be2e101bd8b533a1b53807f5c757 (patch)
treeaaf08fac72a54d240555cfc0fc900f4e491111d2 /app/controllers/admin
parent69558d2fe5284d2b6168706bd7cbd8b7fb2b0847 (diff)
Add ability to filter audit log in admin UI (#13381)
Diffstat (limited to 'app/controllers/admin')
-rw-r--r--app/controllers/admin/action_logs_controller.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/app/controllers/admin/action_logs_controller.rb b/app/controllers/admin/action_logs_controller.rb
index e273dfeae..2d77620df 100644
--- a/app/controllers/admin/action_logs_controller.rb
+++ b/app/controllers/admin/action_logs_controller.rb
@@ -2,8 +2,18 @@
 
 module Admin
   class ActionLogsController < BaseController
-    def index
-      @action_logs = Admin::ActionLog.page(params[:page])
+    before_action :set_action_logs
+
+    def index; end
+
+    private
+
+    def set_action_logs
+      @action_logs = Admin::ActionLogFilter.new(filter_params).results.page(params[:page])
+    end
+
+    def filter_params
+      params.slice(:page, *Admin::ActionLogFilter::KEYS).permit(:page, *Admin::ActionLogFilter::KEYS)
     end
   end
 end