-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #37923 - Set HTTP proxy as default after creating
- Loading branch information
1 parent
640ef71
commit e320acd
Showing
5 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
app/controllers/katello/concerns/api/v2/http_proxies_controller_extensions.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module Katello | ||
module Concerns | ||
module Api | ||
module V2 | ||
module HttpProxiesControllerExtensions | ||
extend ::Apipie::DSL::Concern | ||
|
||
update_api(:create) do | ||
param :http_proxy, Hash do | ||
param :default_content_proxy, :bool, :required => false, :desc => N_('Set this proxy as the default content proxy') | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
20 changes: 20 additions & 0 deletions
20
app/controllers/katello/concerns/http_proxies_controller_extensions.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module Katello | ||
module Concerns | ||
module HttpProxiesControllerExtensions | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
after_action :update_content_default_http_proxy, only: :create | ||
end | ||
|
||
private | ||
|
||
def update_content_default_http_proxy | ||
return unless @http_proxy.persisted? | ||
return unless ActiveRecord::Type::Boolean.new.deserialize(params.dig('http_proxy', 'default_content')) | ||
|
||
Setting[:content_default_http_proxy] = @http_proxy.name | ||
end | ||
end | ||
end | ||
end |
16 changes: 16 additions & 0 deletions
16
app/views/overrides/http_proxies/_update_setting_input.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<% if @http_proxy.new_record? %> | ||
<div class="clearfix"> | ||
<div class="form-group "> | ||
<label class="col-md-2 control-label" for="http_proxy_default_content"> | ||
Default Content HTTP proxy | ||
</label> | ||
<div class="col-md-4"> | ||
<%= check_box_tag 'http_proxy[default_content]', | ||
'1', | ||
params.dig('http_proxy', 'default_content') == '1', | ||
id: 'http_proxy_default_content' %> | ||
Set this proxy as the default for content, updating the 'Default HTTP Proxy' setting. | ||
</div> | ||
</div> | ||
</div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters