Skip to content

Commit

Permalink
Add buttons for pausing/resuming ansible tower providers
Browse files Browse the repository at this point in the history
  • Loading branch information
skateman committed Jan 21, 2019
1 parent feb1999 commit f73e9ad
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/controllers/application_controller/explorer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ def x_history
'start' => :s1, 'stop' => :s1, 'suspend' => :s1,
'reset' => :s1, 'terminate' => :s1, 'pause' => :s1,
'shelve' => :s1, 'shelve_offload' => :s1, 'chargeback' => :s1,
'foreman_pause' => :s1, 'foreman_resume' => :s1,
'foreman_pause' => :s1, 'foreman_resume' => :s1, 'manager_pause' => :s1,
'manager_resume' => :s1,

# group 2
'clone' => :s2, 'compare' => :s2, 'drift' => :s2,
Expand Down Expand Up @@ -87,7 +88,7 @@ def x_history
def x_button
model, action = pressed2model_action(params[:pressed])

allowed_models = %w(common image instance vm miq_template provider storage configscript infra_networking automation_manager_provider configuration_manager_provider)
allowed_models = %w(common image instance vm miq_template provider automation storage configscript infra_networking automation_manager_provider configuration_manager_provider)
raise ActionController::RoutingError.new('invalid button action') unless
allowed_models.include?(model)

Expand Down
9 changes: 9 additions & 0 deletions app/controllers/automation_manager_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class AutomationManagerController < ApplicationController
include Mixins::GenericSessionMixin
include Mixins::ManagerControllerMixin
include Mixins::ExplorerPresenterMixin
include EmsCommon

menu_section :at

Expand Down Expand Up @@ -166,6 +167,14 @@ def providers_active_tree?

private

def automation_manager_pause
pause_or_resume_emss(:pause => true)
end

def automation_manager_resume
pause_or_resume_emss(:resume => true)
end

def template_record?
@record.kind_of?(ManageIQ::Providers::AnsibleTower::AutomationManager::ConfigurationWorkflow) || @record.kind_of?(ConfigurationScript)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,23 @@ class ApplicationHelper::Toolbar::AutomationManagerProviderCenter < ApplicationH
t,
:url => "edit"
),
button(
:automation_manager_resume,
'pficon pficon-trend-up fa-lg',
t = N_('Resume this Automation Manager Provider'),
t,
:confirm => N_("Resume this Automation Manager Provider?"),
:enabled => proc { !@record.enabled? },
:url_parms => "main_div"),
button(
:automation_manager_pause,
'pficon pficon-trend-down fa-lg',
t = N_('Pause this Automation Manager Provider'),
t,
:confirm => N_("Warning: While this provider is paused no data will be collected from it. " \
"This may cause gaps in inventory, metrics and events!"),
:enabled => proc { @record.enabled? },
:url_parms => "main_div"),
button(
:automation_manager_delete_provider,
'pficon pficon-delete fa-lg',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,27 @@ class ApplicationHelper::Toolbar::AutomationManagerProvidersCenter < Application
:enabled => false,
:onwhen => "1"
),
button(
:automation_manager_resume,
'pficon pficon-trend-up fa-lg',
t = N_('Resume selected Automation Manager Providers'),
t,
:confirm => N_("Resume these Automation Manager Providers?"),
:enabled => false,
:url_parms => "main_div",
:send_checked => true,
:onwhen => "1+"),
button(
:automation_manager_pause,
'pficon pficon-trend-down fa-lg',
t = N_('Pause selected Automation Manager Providers'),
t,
:confirm => N_("Warning: While these providers are paused no data will be collected from them. " \
"This may cause gaps in inventory, metrics and events!"),
:enabled => false,
:url_parms => "main_div",
:send_checked => true,
:onwhen => "1+"),
button(
:automation_manager_delete_provider,
'pficon pficon-delete fa-lg',
Expand Down

0 comments on commit f73e9ad

Please sign in to comment.