Skip to content

Commit

Permalink
Merge pull request #9142 from jrafanie/rename_ansible_tag_features_to…
Browse files Browse the repository at this point in the history
…_be_generic

UI changes to use the renamed product features from core #22971
  • Loading branch information
agrare committed May 8, 2024
2 parents abc30b6 + 2cc2c07 commit 5e32f48
Show file tree
Hide file tree
Showing 18 changed files with 30 additions and 33 deletions.
6 changes: 3 additions & 3 deletions app/controllers/ansible_credential_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ def button
javascript_redirect(:action => 'edit', :id => params[:miq_grid_checks])
when 'embedded_configuration_script_source_edit' # edit repository from nested list
javascript_redirect(:controller => "ansible_repository", :action => 'edit', :id => params[:miq_grid_checks])
when 'ansible_credential_tag' # tag credentials
when 'embedded_automation_manager_credential_tag' # tag credentials
tag(self.class.model)
when "ansible_repository_tag" # tag repositories from nested list
when "embedded_configuration_script_source_tag" # tag repositories from nested list
tag(ManageIQ::Providers::EmbeddedAnsible::AutomationManager::ConfigurationScriptSource)
end
end
Expand Down Expand Up @@ -118,7 +118,7 @@ def show_list
end

def tag_edit_form_field_changed
assert_privileges('ansible_credential_tag')
assert_privileges('embedded_automation_manager_credential_tag')

super
end
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/ansible_repository_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def button
show
render_update("main_div", "show", false)
end
when "ansible_repository_tag" # tag repositories
when "embedded_configuration_script_source_tag" # tag repositories
tag(self.class.model)
when "embedded_configuration_script_payload_tag" # tag playbooks from nested list
tag(ManageIQ::Providers::EmbeddedAnsible::AutomationManager::Playbook)
Expand Down Expand Up @@ -144,7 +144,7 @@ def show_list
end

def tag_edit_form_field_changed
assert_privileges('ansible_repository_tag')
assert_privileges('embedded_configuration_script_source_tag')
super
end

Expand Down
11 changes: 4 additions & 7 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1890,13 +1890,10 @@ def controller_for_common_methods
"generic_object"
when "ansible_playbook", "workflow", "embedded_terraform_template"
"embedded_configuration_script_payload"
when "workflow_repository", "embedded_terraform_repository"
"ansible_repository"
# TODO: Update manageiq/db/fixtures/miq_product_features.yml by replacing ansible_credential_tag with embedded_automation_manager_credential_tag
# when "workflow_credential", "ansible_credential"
# "embedded_automation_manager_credential"
when "workflow_credential", "embedded_terraform_credential"
"ansible_credential"
when "workflow_repository", "ansible_repository", "embedded_terraform_repository"
"embedded_configuration_script_source"
when "workflow_credential", "ansible_credential", "embedded_terraform_credential"
"embedded_automation_manager_credential"
else
controller_name
end
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/workflow_credential_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ def button
javascript_redirect(:action => 'edit', :id => params[:miq_grid_checks])
when 'embedded_configuration_script_source_edit' # edit repository from nested list
javascript_redirect(:controller => 'workflow_repository', :action => 'edit', :id => params[:miq_grid_checks])
when 'ansible_credential_tag' # tag credentials
when 'embedded_automation_manager_credential_tag' # tag credentials
tag(self.class.model)
when "ansible_repository_tag" # tag repositories from nested list
when "embedded_configuration_script_source_tag" # tag repositories from nested list
tag(ManageIQ::Providers::Workflows::AutomationManager::ConfigurationScriptSource)
end
end
Expand Down Expand Up @@ -120,7 +120,7 @@ def show_list
end

def tag_edit_form_field_changed
assert_privileges('ansible_credential_tag')
assert_privileges('embedded_automation_manager_credential_tag')

$log.warn(caller.pretty_inspect)

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/workflow_repository_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def button
show
render_update("main_div", "show", false)
end
when "ansible_repository_tag" # tag repositories
when "embedded_configuration_script_source_tag" # tag repositories
tag(self.class.model)
when "embedded_configuration_script_payload_tag" # tag workflows from nested list
tag(ManageIQ::Providers::Workflows::AutomationManager::Workflow)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class ApplicationHelper::Toolbar::AnsibleCredentialCenter < ApplicationHelper::T
t,
:items => [
button(
:ansible_credential_tag,
:embedded_automation_manager_credential_tag,
'pficon pficon-edit fa-lg',
N_('Edit Tags for this Ansible Credential'),
N_('Edit Tags'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class ApplicationHelper::Toolbar::AnsibleCredentialsCenter < ApplicationHelper::
:onwhen => "1+",
:items => [
button(
:ansible_credential_tag,
:embedded_automation_manager_credential_tag,
'pficon pficon-edit fa-lg',
N_('Edit Tags for the selected Ansible Credentials'),
N_('Edit Tags'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class ApplicationHelper::Toolbar::AnsibleRepositoriesCenter < ApplicationHelper:
:onwhen => "1+",
:items => [
button(
:ansible_repository_tag,
:embedded_configuration_script_source_tag,
'pficon pficon-edit fa-lg',
N_('Edit Tags for the selected Ansible Repositories'),
N_('Edit Tags'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class ApplicationHelper::Toolbar::AnsibleRepositoryCenter < ApplicationHelper::T
t,
:items => [
button(
:ansible_repository_tag,
:embedded_configuration_script_source_tag,
'pficon pficon-edit fa-lg',
N_('Edit Tags for this Ansible Repository'),
N_('Edit Tags'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ApplicationHelper::Toolbar::WorkflowCredentialCenter < ApplicationHelper::
t,
:items => [
button(
:ansible_credential_tag,
:embedded_automation_manager_credential_tag,
'pficon pficon-edit fa-lg',
N_('Edit Tags for this Workflow Credential'),
N_('Edit Tags')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class ApplicationHelper::Toolbar::WorkflowCredentialsCenter < ApplicationHelper:
:onwhen => "1+",
:items => [
button(
:ansible_credential_tag,
:embedded_automation_manager_credential_tag,
'pficon pficon-edit fa-lg',
N_('Edit Tags for the selected Workflow Credentials'),
N_('Edit Tags'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class ApplicationHelper::Toolbar::WorkflowRepositoriesCenter < ApplicationHelper
:items =>
[
button(
:ansible_repository_tag,
:embedded_configuration_script_source_tag,
'pficon pficon-edit fa-lg',
N_('Edit Tags for the selected Workflow Repositories'),
N_('Edit Tags'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class ApplicationHelper::Toolbar::WorkflowRepositoryCenter < ApplicationHelper::
:items =>
[
button(
:ansible_repository_tag,
:embedded_configuration_script_source_tag,
'pficon pficon-edit fa-lg',
N_('Edit Tags for this Workflow Repository'),
N_('Edit Tags')
Expand Down
6 changes: 3 additions & 3 deletions app/presenters/menu/default_menu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,9 @@ def automation_manager_menu_section

def ansible_menu_section
Menu::Section.new(:ansible, N_("Embedded Ansible"), nil, [
Menu::Item.new('ansible_playbooks', N_('Playbooks'), 'embedded_configuration_script_payload', {:feature => 'embedded_configuration_script_payload', :any => true}, '/ansible_playbook/show_list'),
Menu::Item.new('ansible_repositories', N_('Repositories'), 'embedded_configuration_script_source', {:feature => 'embedded_configuration_script_source', :any => true}, '/ansible_repository/show_list'),
Menu::Item.new('ansible_credentials', N_('Credentials'), 'embedded_automation_manager_credentials', {:feature => 'embedded_automation_manager_credentials', :any => true}, '/ansible_credential/show_list'),
Menu::Item.new('ansible_playbooks', N_('Playbooks'), 'embedded_configuration_script_payload', {:feature => 'embedded_configuration_script_payload_view', :any => true}, '/ansible_playbook/show_list'),
Menu::Item.new('ansible_repositories', N_('Repositories'), 'embedded_configuration_script_source', {:feature => 'embedded_configuration_script_source_view', :any => true}, '/ansible_repository/show_list'),
Menu::Item.new('ansible_credentials', N_('Credentials'), 'embedded_automation_manager_credentials', {:feature => 'embedded_automation_manager_credentials_view', :any => true}, '/ansible_credential/show_list'),
])
end

Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/ansible_credential_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
end

context 'tagging one or more ansible credentials' do
let(:params) { {:pressed => "ansible_credential_tag"} }
let(:params) { {:pressed => "embedded_automation_manager_credential_tag"} }

it 'calls tag method' do
expect(controller).to receive(:tag).with(controller.class.model)
Expand All @@ -64,7 +64,7 @@
end

context 'tagging one or more ansible repositories from nested list' do
let(:params) { {:pressed => "ansible_repository_tag"} }
let(:params) { {:pressed => "embedded_configuration_script_source_tag"} }

before do
controller.instance_variable_set(:@display, "repositories")
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/ansible_repository_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
end

context 'tagging one or more repositories' do
let(:params) { {:pressed => "ansible_repository_tag"} }
let(:params) { {:pressed => "embedded_configuration_script_source_tag"} }

it 'calls tag method' do
expect(controller).to receive(:tag).with(controller.class.model)
Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/workflow_credential_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
end

context 'tagging one or more workflow credentials' do
let(:params) { {:pressed => "ansible_credential_tag"} }
let(:params) { {:pressed => "embedded_automation_manager_credential_tag"} }

it 'calls tag method' do
expect(controller).to receive(:tag).with(controller.class.model)
Expand All @@ -67,7 +67,7 @@
end

context 'tagging one or more workflow repositories from nested list' do
let(:params) { {:pressed => "ansible_repository_tag"} }
let(:params) { {:pressed => "embedded_configuration_script_source_tag"} }

before do
controller.instance_variable_set(:@display, "repositories")
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/workflow_repository_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
end

context 'tagging one or more repositories' do
let(:params) { {:pressed => "ansible_repository_tag"} }
let(:params) { {:pressed => "embedded_configuration_script_source_tag"} }

it 'calls tag method' do
expect(controller).to receive(:tag).with(controller.class.model)
Expand Down

0 comments on commit 5e32f48

Please sign in to comment.