Skip to content

Commit

Permalink
Merge pull request #7569 from h-kataria/event_de-explorization
Browse files Browse the repository at this point in the history
Event Explorer De-Explorization
  • Loading branch information
gtanzillo authored Feb 8, 2021
2 parents a4d5676 + fbc1f7f commit 6118b83
Show file tree
Hide file tree
Showing 18 changed files with 120 additions and 519 deletions.
9 changes: 9 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1134,6 +1134,13 @@ def perpage_key(dbname)
end
end

def sanitize_filter(filter)
return filter if filter.kind_of?(MiqExpression)
# when react list view is being rendered,
# that sends up filter as hash in params, need to convert that back to an expression
MiqExpression.new(filter["exp"].permit!.to_h.deep_stringify_keys)
end

# Create view and paginator for a DB records with/without tags
def get_view(db, options = {}, fetch_data = false)
if !fetch_data && @report_data_additional_options.nil?
Expand Down Expand Up @@ -1223,6 +1230,8 @@ def get_view(db, options = {}, fetch_data = false)

view.conditions = options[:conditions] # Get passed in conditions (i.e. tasks date filters)

options[:filter] = sanitize_filter(options[:filter]) if options[:filter]

# Save the paged_view_search_options for download buttons to use later
session[:paged_view_search_options] = {
:parent => parent ? minify_ar_object(parent) : nil,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class ApplicationController
:match_via_descendants,
:parent_id,
:parent_class_name,
:filter,
:parent_method,
:association,
:view_suffix,
Expand Down Expand Up @@ -37,6 +38,7 @@ def self.from_options(options)
additional_options.association = options[:association]
additional_options.view_suffix = options[:view_suffix]
additional_options.parent_method = options[:parent_method]
additional_options.filter = options[:filter] if options[:filter]
additional_options.supported_features_filter = options[:supported_features_filter]
additional_options.clickable = options[:clickable]
additional_options.report_name = options[:report_name]
Expand Down
237 changes: 0 additions & 237 deletions app/controllers/miq_event_controller.rb

This file was deleted.

62 changes: 62 additions & 0 deletions app/controllers/miq_event_definition_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
class MiqEventDefinitionController < 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_definition"
@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")},
{:title => _('Events'), :url => controller_url},
].compact,
:record_title => :description,
}
end

menu_section :con
end
3 changes: 0 additions & 3 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,6 @@ def db_to_controller(db, action = "show")
when "ScanItemSet"
controller = "ops"
action = "ap_show"
when "MiqEventDefinition"
controller = "event"
action = "_none_"
when "User", "Group", "Patch", "GuestApplication"
controller = "vm"
action = @lastaction
Expand Down
1 change: 1 addition & 0 deletions app/helpers/application_helper/page_layouts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def layout_uses_listnav?
miq_ae_export
miq_ae_logs
miq_ae_tools
miq_event_definition
miq_policy
miq_policy_export
miq_policy_logs
Expand Down
2 changes: 1 addition & 1 deletion app/presenters/menu/default_menu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def control_menu_section
Menu::Section.new(:con, N_("Control"), 'carbon--IbmSecurity', [
Menu::Item.new('miq_policy_set', N_('Policy Profiles'), 'miq_policy_set', {:feature => 'miq_policy_set_show_list'}, '/miq_policy_set/show_list'),
Menu::Item.new('miq_policy', N_('Policies'), 'miq_policy', {:feature => 'miq_policy_show_list'}, '/miq_policy/show_list'),
Menu::Item.new('miq_event', N_('Events'), 'miq_event', {:feature => 'miq_event', :any => true}, '/miq_event/explorer'),
Menu::Item.new('miq_event', N_('Events'), 'miq_event', {:feature => 'miq_event_definition_show_list'}, '/miq_event_definition/show_list'),
Menu::Item.new('condition', N_('Conditions'), 'condition', {:feature => 'condition_show_list'}, '/condition/show_list'),
Menu::Item.new('miq_action', N_('Actions'), 'miq_action', {:feature => 'miq_action', :any => true}, '/miq_action/explorer'),
Menu::Item.new('miq_alert_set', N_('Alert Profiles'), 'miq_alert_set', {:feature => 'miq_alert_set', :any => true}, '/miq_alert_set/explorer'),
Expand Down
2 changes: 0 additions & 2 deletions app/presenters/tree_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,6 @@ def prefixed_title(prefix, title)
## Explorer
### Policies
:policy => "TreeBuilderPolicy",
### Events
:event => "TreeBuilderEvent",
### Actions
:action => "TreeBuilderAction",
### Alert Profiles
Expand Down
20 changes: 0 additions & 20 deletions app/presenters/tree_builder_event.rb

This file was deleted.

Loading

0 comments on commit 6118b83

Please sign in to comment.