Sha256: 288fedf6eb4abd03896d539b879485f536a6dc05a24fbe1da6399fa8bbf871a5

Contents?: true

Size: 1.82 KB

Versions: 8

Compression:

Stored size: 1.82 KB

Contents

# frozen_string_literal: true
# Controller for Check Status header menu item
module QaServer
  class CheckStatusController < ApplicationController
    layout 'qa_server'

    include QaServer::AuthorityValidationBehavior

    ALL_AUTHORITIES = '__all__'

    class_attribute :presenter_class
    self.presenter_class = QaServer::CheckStatusPresenter

    # Sets up presenter with data to display in the UI
    def index
      log_header
      validate(authorities_to_validate, validation_type)
      @presenter = presenter_class.new(authorities_list: authorities_list,
                                       connection_status_data: connection_status_data_from_log,
                                       accuracy_status_data: accuracy_status_data_from_log)
    end

    private

      def connection_status_data_from_log
        status_log.filter(type: validator_class::VALIDATE_CONNECTIONS)
      end

      def accuracy_status_data_from_log
        status_log.filter(type: validator_class::VALIDATE_ACCURACY)
      end

      def authorities_to_validate
        return [] unless authority_name.present?
        authority_name == ALL_AUTHORITIES ? authorities_list : [authority_name]
      end

      def authority_name
        return @authority_name if @authority_name.present?
        @authority_name = params.key?(:authority) ? params[:authority].downcase : nil
      end

      def log_header
        QaServer.config.performance_cache_logger.debug("----------------------  check status (max_cache_size = #{max_cache_size}) ----------------------")
        QaServer.config.performance_cache_logger.debug("(#{self.class}##{__method__}) check status page request (authority_name # #{authority_name})")
      end

      def max_cache_size
        ActiveSupport::NumberHelper.number_to_human_size(QaServer.config.max_performance_cache_size)
      end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
qa_server-7.4.0 app/controllers/qa_server/check_status_controller.rb
qa_server-7.3.0 app/controllers/qa_server/check_status_controller.rb
qa_server-7.2.1 app/controllers/qa_server/check_status_controller.rb
qa_server-7.2.0 app/controllers/qa_server/check_status_controller.rb
qa_server-7.1.3 app/controllers/qa_server/check_status_controller.rb
qa_server-7.1.2 app/controllers/qa_server/check_status_controller.rb
qa_server-7.1.1 app/controllers/qa_server/check_status_controller.rb
qa_server-7.1.0 app/controllers/qa_server/check_status_controller.rb