From 0c939921151c57be4ba95ea25d83204bc94f62ed Mon Sep 17 00:00:00 2001 From: Harpreet Kataria Date: Thu, 10 Dec 2020 18:09:20 -0500 Subject: [PATCH 1/6] Event Explorer De-Explorization Changes to support Events related screens as other normal screens in the product to help support direct linking. --- app/controllers/miq_event_controller.rb | 186 +-------------------- app/presenters/menu/default_menu.rb | 2 +- app/presenters/tree_builder.rb | 2 - app/presenters/tree_builder_event.rb | 20 --- app/views/miq_event/show.html.haml | 213 ++++++++++++++++++++++++ app/views/miq_event/show_list.html.haml | 2 + config/routes.rb | 9 +- 7 files changed, 222 insertions(+), 212 deletions(-) delete mode 100644 app/presenters/tree_builder_event.rb create mode 100644 app/views/miq_event/show.html.haml create mode 100644 app/views/miq_event/show_list.html.haml diff --git a/app/controllers/miq_event_controller.rb b/app/controllers/miq_event_controller.rb index 0072fe48cc6..64c95a31f7c 100644 --- a/app/controllers/miq_event_controller.rb +++ b/app/controllers/miq_event_controller.rb @@ -4,7 +4,9 @@ class MiqEventController < ApplicationController after_action :cleanup_action after_action :set_session_data + include Mixins::GenericListMixin include Mixins::GenericSessionMixin + include Mixins::GenericShowMixin include Mixins::BreadcrumbsMixin include Mixins::PolicyMixin @@ -12,192 +14,8 @@ def title @title = _("Events") end - def index - flash_to_session - redirect_to(:action => 'explorer') - end - - def explorer - @breadcrumbs = [] - @explorer = true - - self.x_active_tree ||= 'event_tree' - self.x_active_accord ||= 'event' - - build_accordions_and_trees - get_node_info(x_node) - - render :layout => "application" - end - - # Item clicked on in the explorer right cell - def x_show - @explorer = true - tree_select - end - - def accordion_select - self.x_active_accord = params[:id].sub(/_accord$/, '') - self.x_active_tree = "#{self.x_active_accord}_tree" - get_node_info(x_node) - replace_right_cell(:nodetype => @nodetype) - end - - def tree_select - # set these when a link on one of the summary screen was pressed - self.x_active_accord = params[:accord] if params[:accord] - self.x_active_tree = "#{params[:accord]}_tree" if params[:accord] - self.x_active_tree = params[:tree] if params[:tree] - self.x_node = params[:id] - - @sb[:action] = nil - get_node_info(x_node) - replace_right_cell(:nodetype => @nodetype) - end - - def search - get_node_info(x_node) - replace_right_cell(:nodetype => x_node) - end - private - # Get all info for the node about to be displayed - def get_node_info(treenodeid, show_list = true) - @show_list = show_list - _modelname, nodeid, @nodetype = TreeBuilder.extract_node_model_and_id(valid_active_node(treenodeid)) - node_ids = {} - treenodeid.split("_").each do |p| - # Create a hash of all record ids represented by the selected tree node - node_ids[p.split("-").first] = p.split("-").last - end - @sb[:node_ids] ||= {} - @sb[:node_ids][x_active_tree] = node_ids - x_node == "root" ? event_get_all : event_get_info(MiqEventDefinition.find(nodeid)) - @show_adv_search = @nodetype == "root" - {:view => @view, :pages => @pages} - end - - # replace_trees can be an array of tree symbols to be replaced - def replace_right_cell(options = {}) - nodetype, presenter = options.values_at(:nodetype, :presenter) - @explorer = true - - c_tb = build_toolbar(center_toolbar_filename) - - # Build a presenter to render the JS - presenter ||= ExplorerPresenter.new( - :active_tree => x_active_tree, - :open_accord => params[:accord] - ) - - presenter[:osf_node] = x_node - - # Replace right side with based on selected tree node type - case nodetype - when 'root' - partial_name, model = ['event_list', _('Events')] - presenter.update(:main_div, r[:partial => partial_name]) - right_cell_text = _("All %{models}") % {:models => model} - right_cell_text += _(" (Names with \"%{search_text}\")") % {:search_text => @search_text} if @search_text.present? && %w[alert_profile_tree condition_tree policy_tree].exclude?(x_active_tree.to_s) - when 'ev' - presenter.update(:main_div, r[:partial => 'event_details', :locals => {:read_only => true}]) - options = {:name => @event.description} - right_cell_text = @edit ? _("Editing Event \"%{name}\"") % options : _("Event \"%{name}\"") % options - end - presenter[:right_cell_text] = @right_cell_text = right_cell_text - - presenter.reload_toolbars(:center => c_tb) - - if ((@edit && @edit[:new]) || @assign) && params[:action] != "x_search_by_name" - locals = { - :action_url => @sb[:action], - :record_id => @edit ? @edit[:rec_id] : @assign[:rec_id], - } - presenter.hide(:toolbar) - # If was hidden for summary screen and there were no records on show_list - presenter.show(:paging_div, :form_buttons_div) - presenter.update(:form_buttons_div, r[:partial => "layouts/x_edit_buttons", :locals => locals]) - else - # Added so buttons can be turned off even tho div is not being displayed it still pops up - # Abandon changes box when trying to change a node on tree after saving a record - presenter.hide(:buttons_on).show(:toolbar).hide(:paging_div) - end - - presenter.hide(:form_buttons_div) if options[:remove_form_buttons] - - replace_search_box(presenter, :nameonly => true) - - # Hide/show searchbox depending on if a list is showing - presenter.set_visibility(@show_adv_search, :adv_searchbox_div) - - presenter[:record_id] = @record.try(:id) - - presenter[:lock_sidebar] = (@edit || @assign) && params[:action] != "x_search_by_name" - - presenter.update(:breadcrumbs, r[:partial => 'layouts/breadcrumbs']) - - render :json => presenter.for_render - end - - def send_button_changes - if @edit - @changed = (@edit[:new] != @edit[:current]) - elsif @assign - @changed = (@assign[:new] != @assign[:current]) - end - render :update do |page| - page << javascript_prologue - if @edit - if @refresh_inventory - page.replace("action_options_div", :partial => "action_options") - end - if @action_type_changed || @snmp_trap_refresh - page.replace("action_options_div", :partial => "action_options") - elsif @alert_refresh - page.replace("alert_details_div", :partial => "alert_details") - elsif @to_email_refresh - page.replace("edit_to_email_div", - :partial => "layouts/edit_to_email", - :locals => {:action_url => "alert_field_changed", :record => @alert}) - elsif @alert_snmp_refresh - page.replace("alert_snmp_div", :partial => "alert_snmp") - elsif @alert_mgmt_event_refresh - page.replace("alert_mgmt_event_div", :partial => "alert_mgmt_event") - end - elsif @assign - if params.key?(:chosen_assign_to) || params.key?(:chosen_cat) - page.replace("alert_profile_assign_div", :partial => "alert_profile_assign") - end - end - page << javascript_for_miq_button_visibility_changed(@changed) - page << "miqSparkle(false);" - end - end - - def event_get_all - @events = MiqPolicy.all_policy_events.sort_by { |e| e.description.downcase } - set_search_text - @events = apply_search_filter(@search_text, @events) if @search_text.present? - @right_cell_text = _("All Events") - @right_cell_div = "event_list" - end - - # Get information for an event - def event_get_info(event) - @record = @event = event - @policy = MiqPolicy.find(@sb[:node_ids][x_active_tree]["p"]) unless x_active_tree == :event_tree - @right_cell_text = _("Event \"%{name}\"") % {:name => event.description} - @right_cell_div = "event_details" - - if x_active_tree == :event_tree - @event_policies = @event.miq_policies.sort_by { |p| p.description.downcase } - else - @event_true_actions = MiqPolicy.find(@sb[:node_ids][x_active_tree]["p"]).actions_for_event(event, :success) - @event_false_actions = MiqPolicy.find(@sb[:node_ids][x_active_tree]["p"]).actions_for_event(event, :failure) - end - end - def get_session_data @title = _("Events") @layout = "miq_event" diff --git a/app/presenters/menu/default_menu.rb b/app/presenters/menu/default_menu.rb index a4b3acee5e9..cf2d634159d 100644 --- a/app/presenters/menu/default_menu.rb +++ b/app/presenters/menu/default_menu.rb @@ -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'), diff --git a/app/presenters/tree_builder.rb b/app/presenters/tree_builder.rb index da8e20c82af..67495cd9930 100644 --- a/app/presenters/tree_builder.rb +++ b/app/presenters/tree_builder.rb @@ -387,8 +387,6 @@ def prefixed_title(prefix, title) ## Explorer ### Policies :policy => "TreeBuilderPolicy", - ### Events - :event => "TreeBuilderEvent", ### Actions :action => "TreeBuilderAction", ### Alert Profiles diff --git a/app/presenters/tree_builder_event.rb b/app/presenters/tree_builder_event.rb deleted file mode 100644 index 7ba75a73738..00000000000 --- a/app/presenters/tree_builder_event.rb +++ /dev/null @@ -1,20 +0,0 @@ -class TreeBuilderEvent < TreeBuilder - private - - def tree_init_options - {:full_ids => true} - end - - # level 0 - root - def root_options - { - :text => t = _("All Events"), - :tooltip => t - } - end - - # level 1 - events - def x_get_tree_roots - count_only_or_objects(false, MiqPolicy.all_policy_events, :description) - end -end diff --git a/app/views/miq_event/show.html.haml b/app/views/miq_event/show.html.haml new file mode 100644 index 00000000000..adaf0ac5373 --- /dev/null +++ b/app/views/miq_event/show.html.haml @@ -0,0 +1,213 @@ +#main_div + -#= render :partial => "layouts/textual_groups_generic" + - if @event + #event_info_div + = render :partial => "layouts/flash_msg" + %h3= _("Basic Information") + .form-horizontal + .form-group + %label.control-label.col-md-2= _("Event Group") + .col-md-10 + %p.form-control-static= h(@event.memberof.first.description) + - if @policy + .form-group + %label.control-label.col-md-2= _("Attached to Policy") + .col-md-10 + %p.form-control-static= h(@policy.description) + %hr + + - if @event_policies + %h3= _("Assigned to Policies") + - if @event_policies.empty? + = render :partial => 'layouts/info_msg', :locals => {:message => _("This Event is not assigned to any Policies.")} + - else + %table.table.table-striped.table-bordered.table-hover + %tbody + - @event_policies.each do |p| + - id = "xx-#{p.mode.downcase}_xx-#{p.mode.downcase}-#{p.towhat.camelize(:lower)}_p-#{p.id}" + %tr + %td.table-view-pf-select + %i{:class => p.decorate.fonticon} + %td + = p.description + - else + %h3= _("Order of Actions if ALL Conditions are True") + - if @edit + .col-md-5 + = _('Available Actions:') + %span#choices_chosen_true_div + = select_tag('choices_chosen_true[]', + options_for_select(@edit[:choices_true].sort), + :multiple => true, + :class => "form-control", + :style => "overflow-x: scroll;", + :size => 8, + :id => "choices_chosen_true") + + .col-md-1{:style => "padding: 10px"} + .spacer + .spacer + - [[_("Move selected Actions into this Event"), 'choices_chosen_true_div', 'true_right', 'fa-angle-right'], + [_("Remove all Actions from this Event"), nil, 'true_allleft', 'fa-angle-double-left'], + [_("Remove selected Actions from this Event"), 'members_chosen_true_div', 'true_left', 'fa-angle-left']].each do |title, chosen_div, action, arrow_style| + %button.btn.btn-default.btn-block{:title => title, + :remote => true, + "data-submit" => chosen_div, + "data-method" => :post, + "data-miq_sparkle_on" => true, + "data-miq_sparkle_off" => true, + "data-click_url" => {:url => url_for_only_path(:action => 'miq_event_edit', + :button => action, + :id => @event)}.to_json} + %i.fa.fa-lg.hidden-xs.hidden-sm{:class => arrow_style} + %i.fa.fa-lg.fa-rotate-90.hidden-md.hidden-lg{:class => arrow_style} + + .spacer + .col-md-5.col-sm-11.col-xs-11 + = _(' Selected Actions:') + %span#members_chosen_true_div + = select_tag('members_chosen_true[]', + options_for_select(@edit[:new][:actions_true], @true_selected), + :multiple => true, + :class => "form-control", + :style => "overflow-x: scroll;", + :size => 8, + :id => "members_chosen_true") + + .col-md-1.col-sm-1.col-xs-1{:style => "padding: 10px"} + .spacer + .spacer + - [[_("Move selected Action up"), 'members_chosen_true_div', 'true_up', 'fa-angle-up'], + [_("Move selected Action down"), 'members_chosen_true_div', 'true_down', 'fa-angle-down'], + [_("Set selected Actions to Synchronous"), 'members_chosen_true_div', 'true_sync', 'S'], + [_("Set selected Actions to Asynchronous"), 'members_chosen_true_div', 'true_async', 'A']].each do |title, chosen_div, action, arrow_style| + %button.btn.btn-default.btn-block{:title => title, + :remote => true, + "data-submit" => chosen_div, + "data-method" => :post, + "data-miq_sparkle_on" => true, + "data-miq_sparkle_off" => true, + "data-click_url" => {:url => url_for_only_path(:action => 'miq_event_edit', + :button => action, + :id => @event)}.to_json} + - if %w(A S).include?(arrow_style) + =_(arrow_style) + - else + %i.fa.fa-lg{:class => arrow_style} + + .spacer + %hr + - else + - if @event_true_actions.empty? + = render :partial => 'layouts/info_msg', :locals => {:message => _("This Event has no true Actions.")} + - else + %table.table.table-striped.table-bordered.table-hover + %thead + %tr + %th.table-view-pf-select + %th= _("Description") + %th= _("Synchronous") + %th= _("Type") + %tbody + - @event_true_actions.each do |a| + %tr + %td.table-view-pf-select + %i.pficon.pficon-ok + %td + = a.description + %td + = a.v_synchronicity + %td + = a.action_type + + %br{:style => "clear: both"} + %h3= _("Order of Actions if ANY Conditions are False") + - if @edit + + .col-md-5 + = _("Available Actions:") + %span#choices_chosen_false_div + = select_tag('choices_chosen_false[]', + options_for_select(@edit[:choices_false].sort), + :multiple => true, + :class => "form-control", + :style => "overflow-x: scroll;", + :size => 8, + :id => "choices_chosen_false") + + .col-md-1{:style => "padding: 10px"} + .spacer + .spacer + - [[_("Move selected Actions into this Event"), 'choices_chosen_false_div', 'false_right', 'fa-angle-right'], + [_("Remove all Actions from this Event"), nil, 'false_allleft', 'fa-angle-double-left'], + [_("Remove selected Actions from this Event"), 'members_chosen_false_div', 'false_left', 'fa-angle-left']].each do |title, chosen_div, action, arrow_style| + %button.btn.btn-default.btn-block{:title => title, + :remote => true, + "data-submit" => chosen_div, + "data-method" => :post, + "data-miq_sparkle_on" => true, + "data-miq_sparkle_off" => true, + "data-click_url" => {:url => url_for_only_path(:action => 'miq_event_edit', + :button => action, + :id => @event)}.to_json} + %i.fa.fa-lg.hidden-xs.hidden-sm{:class => arrow_style} + %i.fa.fa-lg.fa-rotate-90.hidden-md.hidden-lg{:class => arrow_style} + + .spacer + + .col-md-5.col-sm-11.col-xs-11 + = _(" Selected Actions:") + %span#members_chosen_false_div + = select_tag('members_chosen_false[]', + options_for_select(@edit[:new][:actions_false], @false_selected), + :multiple => true, + :class => "form-control", + :style => "overflow-x: scroll;", + :size => 8, + :id => "members_chosen_false") + + .col-md-1.col-sm-1.col-xs-1{:style => "padding: 10px"} + .spacer + .spacer + - [[_("Move selected Action up"), 'members_chosen_false_div', 'false_up', 'fa-angle-up'], + [_("Move selected Action down"), 'members_chosen_false_div', 'false_down', 'fa-angle-down'], + [_("Set selected Actions to Synchronous"), 'members_chosen_false_div', 'false_sync', 'S'], + [_("Set selected Actions to Asynchronous"), 'members_chosen_false_div', 'false_async', 'A']].each do |title, chosen_div, action, arrow_style| + %button.btn.btn-default.btn-block{:title => title, + :remote => true, + "data-submit" => chosen_div, + "data-method" => :post, + "data-miq_sparkle_on" => true, + "data-miq_sparkle_off" => true, + "data-click_url" => {:url => url_for_only_path(:action => 'miq_event_edit', + :button => action, + :id => @event)}.to_json} + - if %w(A S).include?(arrow_style) + =_(arrow_style) + - else + %i.fa.fa-lg{:class => arrow_style} + .spacer + + - else + - if @event_false_actions.empty? + = render :partial => 'layouts/info_msg', :locals => {:message => _("This Event has no false Actions.")} + - else + %table.table.table-striped.table-bordered.table-hover + %thead + %tr + %th.table-view-pf-select + %th= _('Description') + %th= _('Synchronous') + %th= _('Type') + %tbody + - @event_false_actions.each do |a| + %tr + %td.table-view-pf-select + %i.pficon.pficon-error-circle-o + %td + = a.description + %td + = a.v_synchronicity + %td + = a.action_type + diff --git a/app/views/miq_event/show_list.html.haml b/app/views/miq_event/show_list.html.haml new file mode 100644 index 00000000000..039604839f2 --- /dev/null +++ b/app/views/miq_event/show_list.html.haml @@ -0,0 +1,2 @@ +#main_div + = render :partial => 'layouts/gtl' diff --git a/config/routes.rb b/config/routes.rb index 133f85508cc..68a49c975e6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2183,13 +2183,12 @@ :miq_event => { :get => %w( - explorer + show + show_list ), :post => %w( - tree_autoload - tree_select - ) + - x_post + + ) }, :condition => { From e137b33fc133e80b15db58d406657f0225e696b3 Mon Sep 17 00:00:00 2001 From: Harpreet Kataria Date: Sat, 16 Jan 2021 23:09:54 -0500 Subject: [PATCH 2/6] fixed routes_spec failure Pre work for https://github.com/ManageIQ/manageiq-ui-classic/pull/7401 --- spec/config/routes.pending.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/spec/config/routes.pending.yml b/spec/config/routes.pending.yml index e8c440eb1f6..f593dd025a9 100644 --- a/spec/config/routes.pending.yml +++ b/spec/config/routes.pending.yml @@ -810,11 +810,6 @@ MiqAlertSetController: - x_show MiqEventController: - index -- tree_autoload -- tree_select -- x_history -- x_search_by_name -- x_show MiqPolicyController: - adv_search_button - adv_search_clear From c00ecdb40b43537725323953b679ddabcb847428 Mon Sep 17 00:00:00 2001 From: Harpreet Kataria Date: Mon, 18 Jan 2021 09:29:48 -0500 Subject: [PATCH 3/6] Changes to pass in filter to search to get specific events only Made changes to list view coe to expect and pass filter back to report_data method. Pre work for https://github.com/ManageIQ/manageiq-ui-classic/pull/7401 --- app/controllers/application_controller.rb | 9 + .../report_data_additional_options.rb | 2 + app/controllers/miq_event_controller.rb | 34 ++- app/helpers/application_helper.rb | 3 +- .../application_helper/page_layouts.rb | 1 + app/views/miq_event/_event_details.html.haml | 211 ---------------- app/views/miq_event/_event_list.html.haml | 18 -- app/views/miq_event/explorer.html.haml | 9 - app/views/miq_event/show.html.haml | 239 ++---------------- product/views/MiqEvent.yaml | 8 +- 10 files changed, 68 insertions(+), 466 deletions(-) delete mode 100644 app/views/miq_event/_event_details.html.haml delete mode 100644 app/views/miq_event/_event_list.html.haml delete mode 100644 app/views/miq_event/explorer.html.haml diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index f34273f8d16..3bc95c3470a 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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? @@ -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, diff --git a/app/controllers/application_controller/report_data_additional_options.rb b/app/controllers/application_controller/report_data_additional_options.rb index d9c8fdd000f..ed81abb0807 100644 --- a/app/controllers/application_controller/report_data_additional_options.rb +++ b/app/controllers/application_controller/report_data_additional_options.rb @@ -6,6 +6,7 @@ class ApplicationController :match_via_descendants, :parent_id, :parent_class_name, + :filter, :parent_method, :association, :view_suffix, @@ -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] diff --git a/app/controllers/miq_event_controller.rb b/app/controllers/miq_event_controller.rb index 64c95a31f7c..33fb9f5d4f1 100644 --- a/app/controllers/miq_event_controller.rb +++ b/app/controllers/miq_event_controller.rb @@ -6,7 +6,6 @@ class MiqEventController < ApplicationController include Mixins::GenericListMixin include Mixins::GenericSessionMixin - include Mixins::GenericShowMixin include Mixins::BreadcrumbsMixin include Mixins::PolicyMixin @@ -14,6 +13,26 @@ 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 + @record = MiqEventDefinition.find_by(:id => params[:id]) + end + private def get_session_data @@ -30,22 +49,11 @@ def set_session_data session[:miq_event_current_page] = @current_page end - def features - [ - { - :name => :event, - :title => _("Events"), - :role => "event", - :role_any => true - }, - ].map { |hsh| ApplicationController::Feature.new_with_hash(hsh) } - end - def breadcrumbs_options { :breadcrumbs => [ {:title => _("Control")}, - {:title => _('Explorer')}, + {:title => _('Events')}, ].compact, :record_title => :description, } diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index d2daee4f065..c32a264f7bc 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -391,8 +391,7 @@ def db_to_controller(db, action = "show") controller = "ops" action = "ap_show" when "MiqEventDefinition" - controller = "event" - action = "_none_" + controller = "miq_event" when "User", "Group", "Patch", "GuestApplication" controller = "vm" action = @lastaction diff --git a/app/helpers/application_helper/page_layouts.rb b/app/helpers/application_helper/page_layouts.rb index d6dafffd589..6e3bc319b3a 100644 --- a/app/helpers/application_helper/page_layouts.rb +++ b/app/helpers/application_helper/page_layouts.rb @@ -28,6 +28,7 @@ def layout_uses_listnav? miq_ae_export miq_ae_logs miq_ae_tools + miq_event miq_policy miq_policy_export miq_policy_logs diff --git a/app/views/miq_event/_event_details.html.haml b/app/views/miq_event/_event_details.html.haml deleted file mode 100644 index 795a1c102dd..00000000000 --- a/app/views/miq_event/_event_details.html.haml +++ /dev/null @@ -1,211 +0,0 @@ -#event_details_div - - if @event - #event_info_div - = render :partial => "layouts/flash_msg" - %h3= _("Basic Information") - .form-horizontal - .form-group - %label.control-label.col-md-2= _("Event Group") - .col-md-10 - %p.form-control-static= h(@event.memberof.first.description) - - if @policy - .form-group - %label.control-label.col-md-2= _("Attached to Policy") - .col-md-10 - %p.form-control-static= h(@policy.description) - %hr - - - if @event_policies - %h3= _("Assigned to Policies") - - if @event_policies.empty? - = render :partial => 'layouts/info_msg', :locals => {:message => _("This Event is not assigned to any Policies.")} - - else - %table.table.table-striped.table-bordered.table-hover - %tbody - - @event_policies.each do |p| - - id = "xx-#{p.mode.downcase}_xx-#{p.mode.downcase}-#{p.towhat.camelize(:lower)}_p-#{p.id}" - %tr - %td.table-view-pf-select - %i{:class => p.decorate.fonticon} - %td - = p.description - - else - %h3= _("Order of Actions if ALL Conditions are True") - - if @edit - .col-md-5 - = _('Available Actions:') - %span#choices_chosen_true_div - = select_tag('choices_chosen_true[]', - options_for_select(@edit[:choices_true].sort), - :multiple => true, - :class => "form-control", - :style => "overflow-x: scroll;", - :size => 8, - :id => "choices_chosen_true") - - .col-md-1{:style => "padding: 10px"} - .spacer - .spacer - - [[_("Move selected Actions into this Event"), 'choices_chosen_true_div', 'true_right', 'fa-angle-right'], - [_("Remove all Actions from this Event"), nil, 'true_allleft', 'fa-angle-double-left'], - [_("Remove selected Actions from this Event"), 'members_chosen_true_div', 'true_left', 'fa-angle-left']].each do |title, chosen_div, action, arrow_style| - %button.btn.btn-default.btn-block{:title => title, - :remote => true, - "data-submit" => chosen_div, - "data-method" => :post, - "data-miq_sparkle_on" => true, - "data-miq_sparkle_off" => true, - "data-click_url" => {:url => url_for_only_path(:action => 'miq_event_edit', - :button => action, - :id => @event)}.to_json} - %i.fa.fa-lg.hidden-xs.hidden-sm{:class => arrow_style} - %i.fa.fa-lg.fa-rotate-90.hidden-md.hidden-lg{:class => arrow_style} - - .spacer - .col-md-5.col-sm-11.col-xs-11 - = _(' Selected Actions:') - %span#members_chosen_true_div - = select_tag('members_chosen_true[]', - options_for_select(@edit[:new][:actions_true], @true_selected), - :multiple => true, - :class => "form-control", - :style => "overflow-x: scroll;", - :size => 8, - :id => "members_chosen_true") - - .col-md-1.col-sm-1.col-xs-1{:style => "padding: 10px"} - .spacer - .spacer - - [[_("Move selected Action up"), 'members_chosen_true_div', 'true_up', 'fa-angle-up'], - [_("Move selected Action down"), 'members_chosen_true_div', 'true_down', 'fa-angle-down'], - [_("Set selected Actions to Synchronous"), 'members_chosen_true_div', 'true_sync', 'S'], - [_("Set selected Actions to Asynchronous"), 'members_chosen_true_div', 'true_async', 'A']].each do |title, chosen_div, action, arrow_style| - %button.btn.btn-default.btn-block{:title => title, - :remote => true, - "data-submit" => chosen_div, - "data-method" => :post, - "data-miq_sparkle_on" => true, - "data-miq_sparkle_off" => true, - "data-click_url" => {:url => url_for_only_path(:action => 'miq_event_edit', - :button => action, - :id => @event)}.to_json} - - if %w(A S).include?(arrow_style) - =_(arrow_style) - - else - %i.fa.fa-lg{:class => arrow_style} - - .spacer - %hr - - else - - if @event_true_actions.empty? - = render :partial => 'layouts/info_msg', :locals => {:message => _("This Event has no true Actions.")} - - else - %table.table.table-striped.table-bordered.table-hover - %thead - %tr - %th.table-view-pf-select - %th= _("Description") - %th= _("Synchronous") - %th= _("Type") - %tbody - - @event_true_actions.each do |a| - %tr - %td.table-view-pf-select - %i.pficon.pficon-ok - %td - = a.description - %td - = a.v_synchronicity - %td - = a.action_type - - %br{:style => "clear: both"} - %h3= _("Order of Actions if ANY Conditions are False") - - if @edit - - .col-md-5 - = _("Available Actions:") - %span#choices_chosen_false_div - = select_tag('choices_chosen_false[]', - options_for_select(@edit[:choices_false].sort), - :multiple => true, - :class => "form-control", - :style => "overflow-x: scroll;", - :size => 8, - :id => "choices_chosen_false") - - .col-md-1{:style => "padding: 10px"} - .spacer - .spacer - - [[_("Move selected Actions into this Event"), 'choices_chosen_false_div', 'false_right', 'fa-angle-right'], - [_("Remove all Actions from this Event"), nil, 'false_allleft', 'fa-angle-double-left'], - [_("Remove selected Actions from this Event"), 'members_chosen_false_div', 'false_left', 'fa-angle-left']].each do |title, chosen_div, action, arrow_style| - %button.btn.btn-default.btn-block{:title => title, - :remote => true, - "data-submit" => chosen_div, - "data-method" => :post, - "data-miq_sparkle_on" => true, - "data-miq_sparkle_off" => true, - "data-click_url" => {:url => url_for_only_path(:action => 'miq_event_edit', - :button => action, - :id => @event)}.to_json} - %i.fa.fa-lg.hidden-xs.hidden-sm{:class => arrow_style} - %i.fa.fa-lg.fa-rotate-90.hidden-md.hidden-lg{:class => arrow_style} - - .spacer - - .col-md-5.col-sm-11.col-xs-11 - = _(" Selected Actions:") - %span#members_chosen_false_div - = select_tag('members_chosen_false[]', - options_for_select(@edit[:new][:actions_false], @false_selected), - :multiple => true, - :class => "form-control", - :style => "overflow-x: scroll;", - :size => 8, - :id => "members_chosen_false") - - .col-md-1.col-sm-1.col-xs-1{:style => "padding: 10px"} - .spacer - .spacer - - [[_("Move selected Action up"), 'members_chosen_false_div', 'false_up', 'fa-angle-up'], - [_("Move selected Action down"), 'members_chosen_false_div', 'false_down', 'fa-angle-down'], - [_("Set selected Actions to Synchronous"), 'members_chosen_false_div', 'false_sync', 'S'], - [_("Set selected Actions to Asynchronous"), 'members_chosen_false_div', 'false_async', 'A']].each do |title, chosen_div, action, arrow_style| - %button.btn.btn-default.btn-block{:title => title, - :remote => true, - "data-submit" => chosen_div, - "data-method" => :post, - "data-miq_sparkle_on" => true, - "data-miq_sparkle_off" => true, - "data-click_url" => {:url => url_for_only_path(:action => 'miq_event_edit', - :button => action, - :id => @event)}.to_json} - - if %w(A S).include?(arrow_style) - =_(arrow_style) - - else - %i.fa.fa-lg{:class => arrow_style} - .spacer - - - else - - if @event_false_actions.empty? - = render :partial => 'layouts/info_msg', :locals => {:message => _("This Event has no false Actions.")} - - else - %table.table.table-striped.table-bordered.table-hover - %thead - %tr - %th.table-view-pf-select - %th= _('Description') - %th= _('Synchronous') - %th= _('Type') - %tbody - - @event_false_actions.each do |a| - %tr - %td.table-view-pf-select - %i.pficon.pficon-error-circle-o - %td - = a.description - %td - = a.v_synchronicity - %td - = a.action_type diff --git a/app/views/miq_event/_event_list.html.haml b/app/views/miq_event/_event_list.html.haml deleted file mode 100644 index 6a832a2c222..00000000000 --- a/app/views/miq_event/_event_list.html.haml +++ /dev/null @@ -1,18 +0,0 @@ -#event_list_div - - if @events - - if @events.empty? - - if @search_text.empty? - - msg = _("No Events are defined") - - else - - msg = _("No Events are defined that match the entered search string '%s'") % @search_text - = render 'layouts/info_msg', :message => msg - - else - %table.table.table-striped.table-bordered.table-hover - %tbody - - @events.each do |e| - %tr{:title => _("View this Event"), - :onclick => "miqTreeActivateNode('event_tree', 'ev-#{e.id}');"} - %td.table-view-pf-select - %i{:class => e.decorate.try(:fonticon)} - %td - = e.description diff --git a/app/views/miq_event/explorer.html.haml b/app/views/miq_event/explorer.html.haml deleted file mode 100644 index c7644372400..00000000000 --- a/app/views/miq_event/explorer.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -- content_for :search do - = render(:partial => "layouts/x_adv_searchbox", :locals => {:nameonly => true}) - -#main_div - - case @nodetype - - when "root" - = render :partial => "event_list" - - when "ev" - = render :partial => "event_details", :locals => {:read_only => true} diff --git a/app/views/miq_event/show.html.haml b/app/views/miq_event/show.html.haml index adaf0ac5373..efb4af6a577 100644 --- a/app/views/miq_event/show.html.haml +++ b/app/views/miq_event/show.html.haml @@ -1,213 +1,28 @@ #main_div - -#= render :partial => "layouts/textual_groups_generic" - - if @event - #event_info_div - = render :partial => "layouts/flash_msg" - %h3= _("Basic Information") - .form-horizontal - .form-group - %label.control-label.col-md-2= _("Event Group") - .col-md-10 - %p.form-control-static= h(@event.memberof.first.description) - - if @policy - .form-group - %label.control-label.col-md-2= _("Attached to Policy") - .col-md-10 - %p.form-control-static= h(@policy.description) - %hr - - - if @event_policies - %h3= _("Assigned to Policies") - - if @event_policies.empty? - = render :partial => 'layouts/info_msg', :locals => {:message => _("This Event is not assigned to any Policies.")} - - else - %table.table.table-striped.table-bordered.table-hover - %tbody - - @event_policies.each do |p| - - id = "xx-#{p.mode.downcase}_xx-#{p.mode.downcase}-#{p.towhat.camelize(:lower)}_p-#{p.id}" - %tr - %td.table-view-pf-select - %i{:class => p.decorate.fonticon} - %td - = p.description - - else - %h3= _("Order of Actions if ALL Conditions are True") - - if @edit - .col-md-5 - = _('Available Actions:') - %span#choices_chosen_true_div - = select_tag('choices_chosen_true[]', - options_for_select(@edit[:choices_true].sort), - :multiple => true, - :class => "form-control", - :style => "overflow-x: scroll;", - :size => 8, - :id => "choices_chosen_true") - - .col-md-1{:style => "padding: 10px"} - .spacer - .spacer - - [[_("Move selected Actions into this Event"), 'choices_chosen_true_div', 'true_right', 'fa-angle-right'], - [_("Remove all Actions from this Event"), nil, 'true_allleft', 'fa-angle-double-left'], - [_("Remove selected Actions from this Event"), 'members_chosen_true_div', 'true_left', 'fa-angle-left']].each do |title, chosen_div, action, arrow_style| - %button.btn.btn-default.btn-block{:title => title, - :remote => true, - "data-submit" => chosen_div, - "data-method" => :post, - "data-miq_sparkle_on" => true, - "data-miq_sparkle_off" => true, - "data-click_url" => {:url => url_for_only_path(:action => 'miq_event_edit', - :button => action, - :id => @event)}.to_json} - %i.fa.fa-lg.hidden-xs.hidden-sm{:class => arrow_style} - %i.fa.fa-lg.fa-rotate-90.hidden-md.hidden-lg{:class => arrow_style} - - .spacer - .col-md-5.col-sm-11.col-xs-11 - = _(' Selected Actions:') - %span#members_chosen_true_div - = select_tag('members_chosen_true[]', - options_for_select(@edit[:new][:actions_true], @true_selected), - :multiple => true, - :class => "form-control", - :style => "overflow-x: scroll;", - :size => 8, - :id => "members_chosen_true") - - .col-md-1.col-sm-1.col-xs-1{:style => "padding: 10px"} - .spacer - .spacer - - [[_("Move selected Action up"), 'members_chosen_true_div', 'true_up', 'fa-angle-up'], - [_("Move selected Action down"), 'members_chosen_true_div', 'true_down', 'fa-angle-down'], - [_("Set selected Actions to Synchronous"), 'members_chosen_true_div', 'true_sync', 'S'], - [_("Set selected Actions to Asynchronous"), 'members_chosen_true_div', 'true_async', 'A']].each do |title, chosen_div, action, arrow_style| - %button.btn.btn-default.btn-block{:title => title, - :remote => true, - "data-submit" => chosen_div, - "data-method" => :post, - "data-miq_sparkle_on" => true, - "data-miq_sparkle_off" => true, - "data-click_url" => {:url => url_for_only_path(:action => 'miq_event_edit', - :button => action, - :id => @event)}.to_json} - - if %w(A S).include?(arrow_style) - =_(arrow_style) - - else - %i.fa.fa-lg{:class => arrow_style} - - .spacer - %hr - - else - - if @event_true_actions.empty? - = render :partial => 'layouts/info_msg', :locals => {:message => _("This Event has no true Actions.")} - - else - %table.table.table-striped.table-bordered.table-hover - %thead - %tr - %th.table-view-pf-select - %th= _("Description") - %th= _("Synchronous") - %th= _("Type") - %tbody - - @event_true_actions.each do |a| - %tr - %td.table-view-pf-select - %i.pficon.pficon-ok - %td - = a.description - %td - = a.v_synchronicity - %td - = a.action_type - - %br{:style => "clear: both"} - %h3= _("Order of Actions if ANY Conditions are False") - - if @edit - - .col-md-5 - = _("Available Actions:") - %span#choices_chosen_false_div - = select_tag('choices_chosen_false[]', - options_for_select(@edit[:choices_false].sort), - :multiple => true, - :class => "form-control", - :style => "overflow-x: scroll;", - :size => 8, - :id => "choices_chosen_false") - - .col-md-1{:style => "padding: 10px"} - .spacer - .spacer - - [[_("Move selected Actions into this Event"), 'choices_chosen_false_div', 'false_right', 'fa-angle-right'], - [_("Remove all Actions from this Event"), nil, 'false_allleft', 'fa-angle-double-left'], - [_("Remove selected Actions from this Event"), 'members_chosen_false_div', 'false_left', 'fa-angle-left']].each do |title, chosen_div, action, arrow_style| - %button.btn.btn-default.btn-block{:title => title, - :remote => true, - "data-submit" => chosen_div, - "data-method" => :post, - "data-miq_sparkle_on" => true, - "data-miq_sparkle_off" => true, - "data-click_url" => {:url => url_for_only_path(:action => 'miq_event_edit', - :button => action, - :id => @event)}.to_json} - %i.fa.fa-lg.hidden-xs.hidden-sm{:class => arrow_style} - %i.fa.fa-lg.fa-rotate-90.hidden-md.hidden-lg{:class => arrow_style} - - .spacer - - .col-md-5.col-sm-11.col-xs-11 - = _(" Selected Actions:") - %span#members_chosen_false_div - = select_tag('members_chosen_false[]', - options_for_select(@edit[:new][:actions_false], @false_selected), - :multiple => true, - :class => "form-control", - :style => "overflow-x: scroll;", - :size => 8, - :id => "members_chosen_false") - - .col-md-1.col-sm-1.col-xs-1{:style => "padding: 10px"} - .spacer - .spacer - - [[_("Move selected Action up"), 'members_chosen_false_div', 'false_up', 'fa-angle-up'], - [_("Move selected Action down"), 'members_chosen_false_div', 'false_down', 'fa-angle-down'], - [_("Set selected Actions to Synchronous"), 'members_chosen_false_div', 'false_sync', 'S'], - [_("Set selected Actions to Asynchronous"), 'members_chosen_false_div', 'false_async', 'A']].each do |title, chosen_div, action, arrow_style| - %button.btn.btn-default.btn-block{:title => title, - :remote => true, - "data-submit" => chosen_div, - "data-method" => :post, - "data-miq_sparkle_on" => true, - "data-miq_sparkle_off" => true, - "data-click_url" => {:url => url_for_only_path(:action => 'miq_event_edit', - :button => action, - :id => @event)}.to_json} - - if %w(A S).include?(arrow_style) - =_(arrow_style) - - else - %i.fa.fa-lg{:class => arrow_style} - .spacer - - - else - - if @event_false_actions.empty? - = render :partial => 'layouts/info_msg', :locals => {:message => _("This Event has no false Actions.")} - - else - %table.table.table-striped.table-bordered.table-hover - %thead - %tr - %th.table-view-pf-select - %th= _('Description') - %th= _('Synchronous') - %th= _('Type') - %tbody - - @event_false_actions.each do |a| - %tr - %td.table-view-pf-select - %i.pficon.pficon-error-circle-o - %td - = a.description - %td - = a.v_synchronicity - %td - = a.action_type - + = render :partial => "layouts/flash_msg" + %h3= _("Basic Information") + .form-horizontal + .form-group + %label.control-label.col-md-2= _("Event Group") + .col-md-10 + %p.form-control-static= h(@record.memberof.first.description) + - if @policy + .form-group + %label.control-label.col-md-2= _("Attached to Policy") + .col-md-10 + %p.form-control-static= h(@policy.description) + %hr + - record_policies = @record.miq_policies.sort_by { |p| p.description.downcase } + %h3= _("Assigned to Policies") + - if record_policies.empty? + = render :partial => 'layouts/info_msg', :locals => {:message => _("This Event is not assigned to any Policies.")} + - else + %table.table.table-striped.table-bordered.table-hover + %tbody + - record_policies.each do |p| + -#- id = "xx-#{p.mode.downcase}_xx-#{p.mode.downcase}-#{p.towhat.camelize(:lower)}_p-#{p.id}" + %tr + %td.table-view-pf-select + %i{:class => p.decorate.fonticon} + %td + = p.description diff --git a/product/views/MiqEvent.yaml b/product/views/MiqEvent.yaml index 7b465248c27..d49b6aa8e85 100644 --- a/product/views/MiqEvent.yaml +++ b/product/views/MiqEvent.yaml @@ -15,7 +15,7 @@ title: Events name: Event # Main DB table report is based on -db: MiqEvent +db: MiqEventDefinition # Columns to fetch from the main table cols: @@ -23,6 +23,8 @@ cols: - description - created_on - updated_on +- event_type +- event_group_name # Included tables (joined, has_one, has_many) and columns include: @@ -30,10 +32,14 @@ include: # Order of columns (from all tables) col_order: - description +- event_type +- event_group_name # Column titles, in order headers: - Description +- Type +- Event Group # Condition(s) string for the SQL query conditions: From 775b7ae2274e488d6c0d3425aa7becc65118d351 Mon Sep 17 00:00:00 2001 From: Harpreet Kataria Date: Mon, 1 Feb 2021 19:08:58 -0500 Subject: [PATCH 4/6] Fixed to not show "Back" button on summary screen and fixed breadcrumb. - Back button is to go back to summary screen, is displayed on sub-screens that are linked from summary screen. UI PR https://github.com/ManageIQ/manageiq-ui-classic/pull/7401 for https://github.com/ManageIQ/manageiq-ui-classic/issues/6819 --- app/controllers/miq_event_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/miq_event_controller.rb b/app/controllers/miq_event_controller.rb index 33fb9f5d4f1..b856efabeca 100644 --- a/app/controllers/miq_event_controller.rb +++ b/app/controllers/miq_event_controller.rb @@ -30,6 +30,8 @@ def show_list end def show + @display = params[:display] || "main" unless pagination_or_gtl_request? + @lastaction = "show" @record = MiqEventDefinition.find_by(:id => params[:id]) end @@ -53,7 +55,7 @@ def breadcrumbs_options { :breadcrumbs => [ {:title => _("Control")}, - {:title => _('Events')}, + {:title => _('Events'), :url => controller_url}, ].compact, :record_title => :description, } From 7b4764ff329ac3d681571a7bcad46ef188b95438 Mon Sep 17 00:00:00 2001 From: Harpreet Kataria Date: Tue, 2 Feb 2021 11:07:08 -0500 Subject: [PATCH 5/6] Fixed breadcrumbs to show link for `Events` on details screen - and some cleanup to show_list method --- app/controllers/miq_event_controller.rb | 29 +++++++++++-------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/app/controllers/miq_event_controller.rb b/app/controllers/miq_event_controller.rb index b856efabeca..9eca40dd8f4 100644 --- a/app/controllers/miq_event_controller.rb +++ b/app/controllers/miq_event_controller.rb @@ -5,6 +5,7 @@ class MiqEventController < ApplicationController after_action :set_session_data include Mixins::GenericListMixin + include Mixins::GenericShowMixin include Mixins::GenericSessionMixin include Mixins::BreadcrumbsMixin include Mixins::PolicyMixin @@ -14,25 +15,21 @@ def title 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} + process_show_list(:filter => MiqPolicy.all_policy_events_filter) end - def show - @display = params[:display] || "main" unless pagination_or_gtl_request? - @lastaction = "show" - @record = MiqEventDefinition.find_by(:id => params[:id]) + 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 From fbc1f7fea54ef2e84aa15e12e90ea27c8327a52e Mon Sep 17 00:00:00 2001 From: Harpreet Kataria Date: Fri, 5 Feb 2021 16:10:16 -0500 Subject: [PATCH 6/6] Renamed miq_event related files to miq_event_definition for consistency --- ...t_controller.rb => miq_event_definition_controller.rb} | 4 ++-- app/helpers/application_helper.rb | 2 -- app/helpers/application_helper/page_layouts.rb | 2 +- .../{miq_event => miq_event_definition}/show.html.haml | 0 .../show_list.html.haml | 0 config/routes.rb | 5 +---- product/views/{MiqEvent.yaml => MiqEventDefinition.yaml} | 0 spec/config/routes.pending.yml | 2 +- spec/helpers/application_helper_spec.rb | 8 ++++---- 9 files changed, 9 insertions(+), 14 deletions(-) rename app/controllers/{miq_event_controller.rb => miq_event_definition_controller.rb} (93%) rename app/views/{miq_event => miq_event_definition}/show.html.haml (100%) rename app/views/{miq_event => miq_event_definition}/show_list.html.haml (100%) rename product/views/{MiqEvent.yaml => MiqEventDefinition.yaml} (100%) diff --git a/app/controllers/miq_event_controller.rb b/app/controllers/miq_event_definition_controller.rb similarity index 93% rename from app/controllers/miq_event_controller.rb rename to app/controllers/miq_event_definition_controller.rb index 9eca40dd8f4..b0b310ba5ed 100644 --- a/app/controllers/miq_event_controller.rb +++ b/app/controllers/miq_event_definition_controller.rb @@ -1,4 +1,4 @@ -class MiqEventController < ApplicationController +class MiqEventDefinitionController < ApplicationController before_action :check_privileges before_action :get_session_data after_action :cleanup_action @@ -36,7 +36,7 @@ def init_show def get_session_data @title = _("Events") - @layout = "miq_event" + @layout = "miq_event_definition" @lastaction = session[:miq_event_lastaction] @display = session[:miq_event_display] @current_page = session[:miq_event_current_page] diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c32a264f7bc..5d08af78a94 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -390,8 +390,6 @@ def db_to_controller(db, action = "show") when "ScanItemSet" controller = "ops" action = "ap_show" - when "MiqEventDefinition" - controller = "miq_event" when "User", "Group", "Patch", "GuestApplication" controller = "vm" action = @lastaction diff --git a/app/helpers/application_helper/page_layouts.rb b/app/helpers/application_helper/page_layouts.rb index 6e3bc319b3a..a98a962a06d 100644 --- a/app/helpers/application_helper/page_layouts.rb +++ b/app/helpers/application_helper/page_layouts.rb @@ -28,7 +28,7 @@ def layout_uses_listnav? miq_ae_export miq_ae_logs miq_ae_tools - miq_event + miq_event_definition miq_policy miq_policy_export miq_policy_logs diff --git a/app/views/miq_event/show.html.haml b/app/views/miq_event_definition/show.html.haml similarity index 100% rename from app/views/miq_event/show.html.haml rename to app/views/miq_event_definition/show.html.haml diff --git a/app/views/miq_event/show_list.html.haml b/app/views/miq_event_definition/show_list.html.haml similarity index 100% rename from app/views/miq_event/show_list.html.haml rename to app/views/miq_event_definition/show_list.html.haml diff --git a/config/routes.rb b/config/routes.rb index 68a49c975e6..23e63a91bcb 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2181,14 +2181,11 @@ x_post }, - :miq_event => { + :miq_event_definition => { :get => %w( show show_list ), - :post => %w( - - ) }, :condition => { diff --git a/product/views/MiqEvent.yaml b/product/views/MiqEventDefinition.yaml similarity index 100% rename from product/views/MiqEvent.yaml rename to product/views/MiqEventDefinition.yaml diff --git a/spec/config/routes.pending.yml b/spec/config/routes.pending.yml index f593dd025a9..bf7b299038b 100644 --- a/spec/config/routes.pending.yml +++ b/spec/config/routes.pending.yml @@ -808,7 +808,7 @@ MiqAlertSetController: - x_history - x_search_by_name - x_show -MiqEventController: +MiqEventDefinitionController: - index MiqPolicyController: - adv_search_button diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index f5e2d702560..d43a8cf0948 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -388,14 +388,14 @@ it "and @explorer" do @explorer = true - expect(subject[0]).to eq("event") - expect(subject[1]).to eq("_none_") + expect(subject[0]).to eq("miq_event_definition") + expect(subject[1]).to eq("x_show") end it "and not @explorer" do @explorer = nil - expect(subject[0]).to eq("event") - expect(subject[1]).to eq("_none_") + expect(subject[0]).to eq("miq_event_definition") + expect(subject[1]).to eq("show") end end