Merge pull request #7184 from betagouv/US/sentry#3144617191
fix(sentry#3144617191): in manager, rendering an archive#show was broken. fix and enhance ui to know how big our archives are
This commit is contained in:
commit
bbde926532
2 changed files with 6 additions and 12 deletions
|
@ -12,7 +12,7 @@ class ArchiveDashboard < Administrate::BaseDashboard
|
||||||
created_at: Field::DateTime,
|
created_at: Field::DateTime,
|
||||||
updated_at: Field::DateTime,
|
updated_at: Field::DateTime,
|
||||||
status: Field::String,
|
status: Field::String,
|
||||||
file: Field::HasOne
|
file: AttachmentField
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
# COLLECTION_ATTRIBUTES
|
# COLLECTION_ATTRIBUTES
|
||||||
|
@ -24,7 +24,8 @@ class ArchiveDashboard < Administrate::BaseDashboard
|
||||||
:id,
|
:id,
|
||||||
:created_at,
|
:created_at,
|
||||||
:updated_at,
|
:updated_at,
|
||||||
:status
|
:status,
|
||||||
|
:file
|
||||||
].freeze
|
].freeze
|
||||||
|
|
||||||
# SHOW_PAGE_ATTRIBUTES
|
# SHOW_PAGE_ATTRIBUTES
|
||||||
|
@ -33,14 +34,6 @@ class ArchiveDashboard < Administrate::BaseDashboard
|
||||||
:id,
|
:id,
|
||||||
:created_at,
|
:created_at,
|
||||||
:updated_at,
|
:updated_at,
|
||||||
:status,
|
:status
|
||||||
:file
|
|
||||||
].freeze
|
].freeze
|
||||||
|
|
||||||
# Overwrite this method to customize how users are displayed
|
|
||||||
# across all pages of the admin dashboard.
|
|
||||||
#
|
|
||||||
def display_resource(archive)
|
|
||||||
"Archive : #{archive&.file.&byte_size}"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
require "administrate/field/base"
|
require "administrate/field/base"
|
||||||
|
|
||||||
class AttachmentField < Administrate::Field::Base
|
class AttachmentField < Administrate::Field::Base
|
||||||
|
include ActionView::Helpers::NumberHelper
|
||||||
def to_s
|
def to_s
|
||||||
data.filename.to_s
|
"#{data.filename} (#{number_to_human_size(data.byte_size)})"
|
||||||
end
|
end
|
||||||
|
|
||||||
def blob_path
|
def blob_path
|
||||||
|
|
Loading…
Reference in a new issue