-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #37923 - Set HTTP proxy as default after creating #11183
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 HTTP proxy as the default content HTTP 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we create a http proxy with default_content_proxy set to true with UI, it gets created successfully and setting is updated, but when we click on created proxy on edit page we don't see the value set for default_content_proxy, so I feel it would be better to include it on edit page too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And, If we decide to add it to the edit page, will it be possible to change it or will it remain grayed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's tied to a Setting, so if it were included on the edit page it would have to be disabled. It would just be an indicator of whether this current HTTP proxy is set as the default.