Skip to content

Commit

Permalink
Merge pull request ManageIQ#6075 from hstastna/DisplayinCatalog_not_c…
Browse files Browse the repository at this point in the history
…hecked_Bundle

Allow Display in Catalog to stay checked for Catalog Bundle
  • Loading branch information
martinpovolny authored Aug 23, 2019
2 parents fcf19cd + 6068930 commit 4e569d5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1257,7 +1257,7 @@ def default_entry_point(prov_type, service_type)
def get_form_vars
copy_params_if_present(@edit[:new], params, %i[st_prov_type name description provision_cost catalog_id dialog_id generic_subtype long_description zone_id price retire_fqname reconfigure_fqname fqname])

@edit[:new][:display] = params[:display] == "1"
@edit[:new][:display] = params[:display] == "1" if params[:display] # @edit[:new][:display] should't be changed if params[:display] is not set
# saving it in @edit as well, to use it later because prov_set_form_vars resets @edit[:new]
@edit[:st_prov_type] = @edit[:new][:st_prov_type]
@edit[:new][:long_description] = @edit[:new][:long_description].to_s + "..." if params[:transOne]
Expand Down
12 changes: 12 additions & 0 deletions spec/controllers/catalog_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1232,6 +1232,18 @@
end
end
end

context 'adding a Resource while adding/editing Catalog Bundle' do
before do
controller.params = {:resource_id => '123'}
controller.instance_variable_set(:@edit, :new => {:display => true, :tenant_ids => []})
end

it 'remains @edit[:new][:display] to be set to true' do
controller.send(:get_form_vars)
expect(controller.instance_variable_get(:@edit)[:new][:display]).to be(true)
end
end
end

describe '#identify_catalog' do
Expand Down

0 comments on commit 4e569d5

Please sign in to comment.