Class: LatoStorage::ApplicationController

Inherits:
Lato::ApplicationController
  • Object
show all
Defined in:
app/controllers/lato_storage/application_controller.rb

Instance Method Summary collapse

Instance Method Details

#cleanerObject



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/controllers/lato_storage/application_controller.rb', line 24

def cleaner
  @operation = Lato::Operation.generate('Lato::ActiveStorageCleanerJob', {}, @session.user_id)

  respond_to do |format|
    if @operation.start
      format.html { redirect_to lato.operation_path(@operation) }
      format.json { render json: @operation }
    else
      format.html { render :index, status: :unprocessable_entity }
      format.json { render json: @operation.errors, status: :unprocessable_entity }
    end
  end
end

#indexObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/lato_storage/application_controller.rb', line 8

def index
  # @blobs_count = ActiveStorage::Blob.count
  # @attachments_count = ActiveStorage::Attachment.count
  # @variant_records_count = defined?(ActiveStorage::VariantRecord) ? ActiveStorage::VariantRecord.count : 0
  # @deletable_blobs_count = ActiveStorage::Blob.unattached.where('active_storage_blobs.created_at < ?', 12.hours.ago).count
  
  # @total_storage = ActiveStorage::Blob.sum(:byte_size)
  # @avg_storage = @total_storage / @blobs_count if @blobs_count.positive?

  # @content_types = ActiveStorage::Blob.group(:content_type).count.sort_by { |_, count| -count }.first(5)

  # @largest_blobs = ActiveStorage::Blob.order(byte_size: :desc).limit(3)
  
  @data = LatoStorage::PreloadDashboardDataJob.perform_now
end