Skip to content

Commit

Permalink
Fixed code to display breadcrumbs links on the form
Browse files Browse the repository at this point in the history
- Fixed code to display breadcrumbs links on the form, this change fixes breadcrumbs for both Ansible Provider and Configuration Provider edit forms because they both use common mixin code.
- Added `Edit Tags` button on Ansible Provider details screen to be consistent with other screens.
- some minor cleanup of setting/checking of `@explorer`
  • Loading branch information
h-kataria committed Mar 17, 2021
1 parent 9be8e19 commit 009d4d1
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 9 deletions.
2 changes: 2 additions & 0 deletions app/controllers/ems_automation_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
class EmsAutomationController < ApplicationController
include Mixins::GenericFormMixin
include Mixins::GenericListMixin
include Mixins::GenericShowMixin
include Mixins::GenericSessionMixin
Expand Down Expand Up @@ -103,6 +104,7 @@ def breadcrumbs_options
{:title => _("Ansible Tower")},
{:title => _("Providers"), :url => controller_url},
],
:record_info => @ems,
}
end

Expand Down
1 change: 1 addition & 0 deletions app/controllers/ems_configuration_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def breadcrumbs_options
{:title => _("Configuration Management")},
{:title => _("Providers"), :url => controller_url},
],
:record_info => @ems,
}
end

Expand Down
13 changes: 6 additions & 7 deletions app/controllers/mixins/manager_controller_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@ def save_provider
else
add_flash(_("%{model} \"%{name}\" was updated") % {:model => model, :name => @provider.name})
end
@explorer ? replace_right_cell(:replace_trees => [x_active_accord]) : javascript_redirect(:action => @lastaction, :id => params[:id])
javascript_redirect(:action => @lastaction, :id => params[:id])
else
@provider.errors.each do |field, msg|
@sb[:action] = nil
add_flash("#{field.to_s.capitalize} #{msg}", :error)
end
render_flash
Expand All @@ -64,7 +63,7 @@ def cancel_provider
else
flash_to_session(_("Edit of Provider was cancelled by the user"))
end
@explorer ? replace_right_cell : javascript_redirect(:action => @lastaction, :id => params[:id])
javascript_redirect(:action => @lastaction, :id => params[:id])
end

def authentication_validate
Expand All @@ -87,16 +86,16 @@ def authentication_validate

def new
assert_privileges("#{privilege_prefix}_add_provider")
@explorer = true if explorer_controller?
@ems = @provider_manager = concrete_model.new
@server_zones = Zone.visible.in_my_region.order(Zone.arel_table[:name].lower).pluck(:description, :name)
@sb[:action] = params[:action]
set_redirect_vars
drop_breadcrumb(:name => _("Add New %{table}") % {:table => ui_lookup(:table => table_name)},
:url => "/#{controller_name}/new")
end

def edit
assert_privileges("#{privilege_prefix}_edit_provider")
@explorer = true if explorer_controller?
@server_zones = Zone.visible.in_my_region.order(Zone.arel_table[:name].lower).pluck(:description, :name)
case params[:button]
when "cancel"
Expand All @@ -110,11 +109,12 @@ def edit
@providerdisplay_type = self.class.model_to_name(@provider_manager.type)
@sb[:action] = params[:action]
set_redirect_vars
drop_breadcrumb(:name => _("Edit %{object_type} '%{object_name}'") % {:object_type => ui_lookup(:tables => table_name), :object_name => @ems.name},
:url => "/#{controller_name}/#{@ems.id}/edit")
end
end

def refresh
@explorer = true if explorer_controller?
assert_privileges("#{privilege_prefix}_refresh_provider")
manager_button_operation('refresh_ems', _('Refresh'))
end
Expand Down Expand Up @@ -156,7 +156,6 @@ def provision

unless ConfiguredSystem.provisionable?(provisioning_ids)
add_flash(_("Provisioning is not supported for at least one of the selected systems"), :error)
replace_right_cell if explorer_controller?
return
end

Expand Down
15 changes: 15 additions & 0 deletions app/helpers/application_helper/toolbar/ems_automation_center.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,19 @@ class ApplicationHelper::Toolbar::EmsAutomationCenter < ApplicationHelper::Toolb
]
),
])
button_group('ems_configuration_policy', [
select(
:ems_configuration_policy_choice,
nil,
t = N_('Policy'),
t,
:items => [
button(
:ems_automation_tag,
'pficon pficon-edit fa-lg',
N_('Edit Tags for this Ansible Tower Provider'),
N_('Edit Tags')),
]
),
])
end
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class ApplicationHelper::Toolbar::EmsAutomationsCenter < ApplicationHelper::Tool
button(
:ems_automation_edit_provider,
'pficon pficon-edit fa-lg',
N_('Select a single item to edit'),
N_('Edit Selected item'),
N_('Select a single Provider to edit'),
N_('Edit Selected Provider'),
:url => "/edit",
:url_parms => "main_div",
:send_checked => true,
Expand Down

0 comments on commit 009d4d1

Please sign in to comment.