2023-01-09 17:36:26 +01:00
|
|
|
require "administrate/base_dashboard"
|
|
|
|
|
|
|
|
class EmailEventDashboard < Administrate::BaseDashboard
|
|
|
|
ATTRIBUTE_TYPES = {
|
|
|
|
id: Field::Number,
|
|
|
|
to: Field::String,
|
|
|
|
subject: Field::String,
|
|
|
|
method: Field::Enum,
|
|
|
|
status: Field::Enum,
|
|
|
|
processed_at: Field::DateTime.with_options(format: "%F %T")
|
|
|
|
}
|
|
|
|
COLLECTION_ATTRIBUTES = [:id, :to, :subject, :method, :status, :processed_at].freeze
|
|
|
|
SHOW_PAGE_ATTRIBUTES = [:id, :to, :subject, :method, :status, :processed_at].freeze
|
2023-01-10 15:56:50 +01:00
|
|
|
|
|
|
|
METHODS_FILTERS =
|
|
|
|
ActionMailer::Base.delivery_methods.keys.index_with do |method|
|
|
|
|
-> (resources) { resources.where(method: method) }
|
|
|
|
end
|
|
|
|
|
2023-01-09 17:36:26 +01:00
|
|
|
COLLECTION_FILTERS = {
|
|
|
|
dispatched: -> (resources) { resources.dispatched },
|
|
|
|
dispatch_error: -> (resources) { resources.dispatch_error }
|
2023-01-10 15:56:50 +01:00
|
|
|
}.merge(METHODS_FILTERS).freeze
|
2023-01-09 17:36:26 +01:00
|
|
|
end
|