Skip to content

Commit

Permalink
UI for Embedded Ansible Provider refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
mzazrivec committed Apr 10, 2017
1 parent a02e86d commit ee43d9e
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/controllers/ansible_credential_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class AnsibleCredentialController < ApplicationController
include Mixins::GenericListMixin
include Mixins::GenericSessionMixin
include Mixins::GenericShowMixin
include Mixins::EmbeddedAnsibleRefreshMixin

menu_section :ansible_credentials
toolbar :ansible_credential
Expand Down Expand Up @@ -50,6 +51,11 @@ def edit
@id = auth.id
end

def credential_refresh
# Targeted refresh for embedded ansible hasn't been implemented yet
embedded_ansible_refresh
end

private

def textual_group_list
Expand Down
6 changes: 6 additions & 0 deletions app/controllers/ansible_repository_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class AnsibleRepositoryController < ApplicationController
include Mixins::GenericListMixin
include Mixins::GenericSessionMixin
include Mixins::GenericShowMixin
include Mixins::EmbeddedAnsibleRefreshMixin

menu_section :ansible_repositories
toolbar :ansible_repository
Expand Down Expand Up @@ -75,6 +76,11 @@ def display_playbooks
nested_list("ansible_playbook", ManageIQ::Providers::EmbeddedAnsible::AutomationManager::Playbook)
end

def repository_refresh
# Targeted refresh for embedded ansible hasn't been implemented yet
embedded_ansible_refresh
end

private

def textual_group_list
Expand Down
15 changes: 15 additions & 0 deletions app/controllers/mixins/embedded_ansible_refresh_mixin.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module Mixins
module EmbeddedAnsibleRefreshMixin
def embedded_ansible_refresh
begin
embedded_ansible = ManageIQ::Providers::EmbeddedAnsible::AutomationManager.first
ManageIQ::Providers::EmbeddedAnsible::AutomationManager.refresh_ems([embedded_ansible.id])
add_flash(_("Embedded Ansible Provider refresh has been successfully initiated"))
rescue => ex
add_flash(_("An error occurred while initiating Embedded Ansible Provider refresh: %{error}") % {:error => ex}, :error)
end
session[:flash_msgs] = @flash_array
javascript_redirect :action => 'show_list'
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ class ApplicationHelper::Toolbar::AnsibleCredentialsCenter < ApplicationHelper::
t = N_('Configuration'),
t,
:items => [
button(
:embedded_automation_manager_credentials_refresh,
'fa fa-refresh fa-lg',
N_('Refresh Embedded Ansible Provider'),
N_('Refresh Embedded Ansible Provider'),
:klass => ApplicationHelper::Button::EmbeddedAnsible,
:url => "credential_refresh",
:url_parms => "main_div",
:confirm => N_("Refresh relationships for all items from Embedded Ansible Provider?"),
:enabled => true),
separator,
button(
:embedded_automation_manager_credentials_add,
'pficon pficon-edit fa-lg',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ class ApplicationHelper::Toolbar::AnsibleRepositoriesCenter < ApplicationHelper:
t = N_('Configuration'),
t,
:items => [
button(
:embedded_configuration_script_source_refresh,
'fa fa-refresh fa-lg',
N_('Refresh Embedded Ansible Provider'),
N_('Refresh Embedded Ansible Provider'),
:klass => ApplicationHelper::Button::EmbeddedAnsible,
:url => "repository_refresh",
:url_parms => "main_div",
:confirm => N_("Refresh relationships for all items from Embedded Ansible Provider?"),
:enabled => true),
separator,
button(
:embedded_configuration_script_source_add,
'pficon pficon-edit fa-lg',
Expand Down
2 changes: 2 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2025,6 +2025,7 @@
),
:post => %w(
button
credential_refresh
show_list
)
},
Expand Down Expand Up @@ -2053,6 +2054,7 @@
button
edit
new
repository_refresh
show_list
)
},
Expand Down

0 comments on commit ee43d9e

Please sign in to comment.