<commit_before>class MiqEventController < ApplicationController
  before_action :check_privileges
  before_action :get_session_data
  after_action :cleanup_action
  after_action :set_session_data

  include Mixins::GenericListMixin
  include Mixins::GenericSessionMixin
  include Mixins::BreadcrumbsMixin
  include Mixins::PolicyMixin

  def title
    @title = _("Events")
  end

  def show_list
    if params[:ppsetting]                                             # User selected new per page value
      @items_per_page = params[:ppsetting].to_i                       # Set the new per page value
      @settings.store_path(:perpage, PERPAGE_TYPES['list'], @items_per_page) # Set the per page setting for this gtl type
    end
    @sortcol = session[:request_sortcol].nil? ? 0 : session[:request_sortcol].to_i
    @sortdir = session[:request_sortdir].nil? ? "ASC" : session[:request_sortdir]
    @no_checkboxes = true # Don't show checkboxes, read_only
    # @view, @pages = get_view(MiqEvent, {:filter => MiqPolicy.all_policy_events_filter}, true)
    @view, @pages = get_view(MiqEvent, :filter => MiqPolicy.all_policy_events_filter)
    @current_page = @pages[:current] unless @pages.nil? # save the current page number
    session[:request_sortcol] = @sortcol
    session[:request_sortdir] = @sortdir
    {:view => @view, :pages => @pages}
  end

  def show
    @display = params[:display] || "main" unless pagination_or_gtl_request?
    @lastaction = "show"
    @record = MiqEventDefinition.find_by(:id => params[:id])
  end

  private

  def get_session_data
    @title = _("Events")
    @layout = "miq_event"
    @lastaction = session[:miq_event_lastaction]
    @display = session[:miq_event_display]
    @current_page = session[:miq_event_current_page]
  end

  def set_session_data
    super
    session[:layout]                 = @layout
    session[:miq_event_current_page] = @current_page
  end

  def breadcrumbs_options
    {
      :breadcrumbs  => [
        {:title => _("Control")},<commit_msg>Fixed breadcrumbs to show link for `Events` on details screen<commit_after>class MiqEventController < ApplicationController
  before_action :check_privileges
  before_action :get_session_data
  after_action :cleanup_action
  after_action :set_session_data

  include Mixins::GenericListMixin
  include Mixins::GenericShowMixin
  include Mixins::GenericSessionMixin
  include Mixins::BreadcrumbsMixin
  include Mixins::PolicyMixin

  def title
    @title = _("Events")
  end

  def show_list
    @no_checkboxes = true # Don't show checkboxes, read_only
    process_show_list(:filter => MiqPolicy.all_policy_events_filter)
  end

  def init_show
    @record = identify_record(params[:id], MiqEventDefinition)
    return false if record_no_longer_exists?(@record)

    @lastaction = 'show'
    @gtl_url = gtl_url

    unless pagination_or_gtl_request?
      @display = params[:display] || default_display
    end
    true
  end

  private

  def get_session_data
    @title = _("Events")
    @layout = "miq_event"
    @lastaction = session[:miq_event_lastaction]
    @display = session[:miq_event_display]
    @current_page = session[:miq_event_current_page]
  end

  def set_session_data
    super
    session[:layout]                 = @layout
    session[:miq_event_current_page] = @current_page
  end

  def breadcrumbs_options
    {
      :breadcrumbs  => [
        {:title => _("Control")},
{'fraction_non_alphanumeric': 0.0948604992657856, 'fraction_numerical': 0.0002936857562408223, 'mean_word_length': 3.723994452149792, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6256753', 'n_tokens_mistral': 1088, 'n_tokens_neox': 1072, 'n_words': 231}