Sha256: f580bde3584f74afdc628b96c5252b36bfd343da4c7c28c132ea7e1995a05764

Contents?: true

Size: 716 Bytes

Versions: 2

Compression:

Stored size: 716 Bytes

Contents

require 'time'

class LogViewController < ApplicationController

  before_action :valid_user
  before_action :load_options
  before_action :load_log

  def index
    @options.max_records = 50
  end

  private

  def valid_user
    authorize! true
  end

  def load_options
    @options = BarkestCore::LogViewOptions.new(
        params.include?(:barkest_core_log_view_options) ?
            params.require(:barkest_core_log_view_options).permit(:min_severity, :start_time, :end_time, :search) :
            { start_time: 7.days.ago }
    )
  end

  def load_log
    # load, filter, and reverse sort.
    @log = BarkestCore::LogEntry.read_log.keep_if{ |r| @options.keep_log_entry? r }.sort{ |a,b| b <=> a }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
barkest_core-1.5.4.0 app/controllers/log_view_controller.rb
barkest_core-1.5.3.0 app/controllers/log_view_controller.rb