mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-01 11:47:16 +08:00
This commit implements a date-time range selector to staff action log in admin page, making it easier to filter and analyze the data. Additionally, it allows to apply the date-time picker to the exported file as well, reducing the exported file size.
50 lines
1.3 KiB
Ruby
50 lines
1.3 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
module PageObjects
|
|
module Pages
|
|
class AdminStaffActionLogs < PageObjects::Pages::Base
|
|
def visit
|
|
page.visit "admin/logs/staff_action_logs"
|
|
self
|
|
end
|
|
|
|
def log_row_selector(user_history)
|
|
".staff-logs tr[data-user-history-id='#{user_history.id}']"
|
|
end
|
|
|
|
def log_row(user_history)
|
|
find(log_row_selector(user_history))
|
|
end
|
|
|
|
def has_log_row?(user_history)
|
|
has_css?(log_row_selector(user_history))
|
|
end
|
|
|
|
def has_no_log_row?(user_history)
|
|
has_no_css?(log_row_selector(user_history))
|
|
end
|
|
|
|
def filter_by_action(action)
|
|
filter = PageObjects::Components::SelectKit.new("#staff-action-logs-action-filter")
|
|
filter.search(I18n.t("admin_js.admin.logs.staff_actions.actions.#{action}"))
|
|
filter.select_row_by_value(action.to_s)
|
|
end
|
|
|
|
def clear_filter
|
|
find(".clear-filters").click
|
|
end
|
|
|
|
def click_export_button
|
|
find(".export-staff-action-logs").click
|
|
end
|
|
|
|
def fill_date_filter_from(date)
|
|
find(".d-date-time-input.from .d-date-input input").set(date)
|
|
end
|
|
|
|
def fill_date_filter_to(date)
|
|
find(".d-date-time-input.to .d-date-input input").set(date)
|
|
end
|
|
end
|
|
end
|
|
end
|