diff --git a/app/controllers/katello/concerns/api/v2/http_proxies_controller_extensions.rb b/app/controllers/katello/concerns/api/v2/http_proxies_controller_extensions.rb index 2d2f8c5baca..2839a6a82f9 100644 --- a/app/controllers/katello/concerns/api/v2/http_proxies_controller_extensions.rb +++ b/app/controllers/katello/concerns/api/v2/http_proxies_controller_extensions.rb @@ -5,9 +5,9 @@ module V2 module HttpProxiesControllerExtensions extend ::Apipie::DSL::Concern - update_api(:create) do + update_api(:create, :show) 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') + param :content_default_http_proxy, :bool, :required => false, :desc => N_('Set this HTTP proxy as the default content HTTP proxy') end end end diff --git a/app/controllers/katello/concerns/http_proxies_controller_extensions.rb b/app/controllers/katello/concerns/http_proxies_controller_extensions.rb index 303a9e11c8e..00049d9282c 100644 --- a/app/controllers/katello/concerns/http_proxies_controller_extensions.rb +++ b/app/controllers/katello/concerns/http_proxies_controller_extensions.rb @@ -11,7 +11,7 @@ module HttpProxiesControllerExtensions def update_content_default_http_proxy return unless @http_proxy.persisted? - return unless ActiveRecord::Type::Boolean.new.deserialize(params.dig('http_proxy', 'default_content')) + return unless ActiveRecord::Type::Boolean.new.deserialize(params.dig('http_proxy', 'content_default_http_proxy')) Setting[:content_default_http_proxy] = @http_proxy.name end diff --git a/app/models/katello/concerns/http_proxy_extensions.rb b/app/models/katello/concerns/http_proxy_extensions.rb index ad2ef8d9aa7..d12940d0ec3 100644 --- a/app/models/katello/concerns/http_proxy_extensions.rb +++ b/app/models/katello/concerns/http_proxy_extensions.rb @@ -84,6 +84,10 @@ def name_and_url uri.user = nil "#{name} (#{uri})" end + + def content_default_http_proxy? + Setting[:content_default_http_proxy] == name + end end end end diff --git a/app/views/katello/api/v2/http_proxies/show.json.rabl b/app/views/katello/api/v2/http_proxies/show.json.rabl new file mode 100644 index 00000000000..9e41a1adf72 --- /dev/null +++ b/app/views/katello/api/v2/http_proxies/show.json.rabl @@ -0,0 +1 @@ +node(:content_default_http_proxy) { |sp| sp.content_default_http_proxy? } diff --git a/app/views/overrides/http_proxies/_update_setting_input.html.erb b/app/views/overrides/http_proxies/_update_setting_input.html.erb index a9141f4bcde..991456abc43 100644 --- a/app/views/overrides/http_proxies/_update_setting_input.html.erb +++ b/app/views/overrides/http_proxies/_update_setting_input.html.erb @@ -1,16 +1,18 @@ -<% if @http_proxy.new_record? %> -