Skip to content

Commit

Permalink
Action explorer de-explorized version
Browse files Browse the repository at this point in the history
- This commit includes de-explorized Actions list/details screen with Add/Edit/Delete buttons working.
- Updated MiqAction controller spec tests

ManageIQ#6819
  • Loading branch information
h-kataria committed Feb 8, 2021
1 parent 6118b83 commit 4a2ba1c
Show file tree
Hide file tree
Showing 15 changed files with 477 additions and 593 deletions.
353 changes: 100 additions & 253 deletions app/controllers/miq_action_controller.rb

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions app/helpers/application_helper/button/miq_action_edit.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
class ApplicationHelper::Button::MiqActionEdit < ApplicationHelper::Button::MiqActionModify
class ApplicationHelper::Button::MiqActionEdit < ApplicationHelper::Button::Basic
needs :@record

def disabled?
super
@error_message = _("Default actions can not be changed.") if @record.action_type == "default"
@error_message.present?
end
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 @@ -23,6 +23,7 @@ def layout_uses_listnav?
cloud_topology
diagnostics
exception
miq_action
miq_ae_automate_button
miq_ae_customization
miq_ae_export
Expand Down
6 changes: 4 additions & 2 deletions app/helpers/application_helper/toolbar/miq_action_center.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ class ApplicationHelper::Toolbar::MiqActionCenter < ApplicationHelper::Toolbar::
'pficon pficon-edit fa-lg',
t = N_('Edit this Action'),
t,
:klass => ApplicationHelper::Button::MiqActionEdit,
:url_parms => "?type=basic"),
:klass => ApplicationHelper::Button::MiqActionEdit,
:url => "/edit",
:send_checked => true,),
button(
:miq_action_delete,
'pficon pficon-delete fa-lg',
Expand All @@ -21,6 +22,7 @@ class ApplicationHelper::Toolbar::MiqActionCenter < ApplicationHelper::Toolbar::
:klass => ApplicationHelper::Button::MiqActionDelete,
:data => {'function' => 'sendDataWithRx',
'function-data' => {:api_url => 'actions',
:redirect_url => '/miq_action/show_list',
:component_name => 'RemoveGenericItemModal',
:controller => 'provider_dialogs',
:display_field => 'description',
Expand Down
28 changes: 28 additions & 0 deletions app/helpers/application_helper/toolbar/miq_actions_center.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,35 @@ class ApplicationHelper::Toolbar::MiqActionsCenter < ApplicationHelper::Toolbar:
'pficon pficon-add-circle-o fa-lg',
t = N_('Add a new Action'),
t,
:url => "/new",
:klass => ApplicationHelper::Button::ButtonNewDiscover),
button(
:miq_action_edit,
'pficon pficon-edit fa-lg',
t = N_('Edit the selected Action'),
t,
:url => "/edit",
:url_parms => "main_div",
:send_checked => true,
:enabled => false,
:onwhen => "1"),
button(
:miq_action_delete,
'pficon pficon-delete fa-lg',
N_('Delete selected Actions'),
N_('Delete Actions'),
:enabled => false,
:onwhen => "1+",
:data => {'function' => 'sendDataWithRx',
'function-data' => {:api_url => 'actions',
:redirect_url => '/miq_action/show_list',
:component_name => 'RemoveGenericItemModal',
:controller => 'provider_dialogs',
:display_field => 'description',
:modal_text => N_("Are you sure you want to delete selected Actions?"),
:modal_title => N_("Delete Actions")}}
),

]
),
])
Expand Down
4 changes: 1 addition & 3 deletions app/helpers/application_helper/toolbar_chooser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def center_toolbar_filename_explorer
center_toolbar_filename_chargeback_report
elsif @layout == "miq_ae_tools"
super_admin_user? ? "miq_ae_tools_simulate_center_tb" : nil
elsif %w[miq_action miq_alert miq_alert_set miq_event].include?(@layout)
elsif %w[miq_alert miq_alert_set miq_event miq_policy].include?(@layout)
center_toolbar_filename_miq_policy
elsif @layout == "ops"
center_toolbar_filename_ops
Expand Down Expand Up @@ -229,13 +229,11 @@ def center_toolbar_filename_miq_policy
case @nodetype
when "root"
case x_active_tree
when :action_tree then "miq_actions_center_tb"
when :alert_tree then "miq_alerts_center_tb"
end
when "p" then "miq_policy_center_tb"
when "co" then "condition_center_tb"
when "ev" then "miq_event_center_tb"
when "a" then "miq_action_center_tb"
when "al" then "miq_alert_center_tb"
when "ap" then "miq_alert_set_center_tb"
end
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 @@ -230,7 +230,7 @@ def control_menu_section
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_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_action', N_('Actions'), 'miq_action', {:feature => 'miq_action_show_list'}, '/miq_action/show_list'),
Menu::Item.new('miq_alert_set', N_('Alert Profiles'), 'miq_alert_set', {:feature => 'miq_alert_set', :any => true}, '/miq_alert_set/explorer'),
Menu::Item.new('miq_alert', N_('Alerts'), 'miq_alert', {:feature => 'miq_alert', :any => true}, '/miq_alert/explorer'),
Menu::Item.new('miq_policy_rsop', N_('Simulation'), 'policy_simulation', {:feature => 'policy_simulation'}, '/miq_policy_rsop'),
Expand Down
Loading

0 comments on commit 4a2ba1c

Please sign in to comment.