Skip to content
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

Fix error when clicking on created Catalog Item in the list #5481

Merged

Conversation

hstastna
Copy link

@hstastna hstastna commented Apr 23, 2019

Fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=1702343

What:
This simple PR fixes issue about displaying Catalog Item's info (also Catalog Bundle's), when clicking on the Catalog Item from the list. In our case, nil is a valid value so we prefer using find_by_id instead of using find.

Steps to reproduce:

  1. Go to Services > Catalogs > Catalog Items accordion
  2. Configuration > Add a New Catalog Item, choose some Catalog Item type
  3. Fill in the required info and click on Add button
  4. After successful saving the Catalog Item, click on the same Catalog Item in the list,
    in All Service Catalog Items screen, to view its details
    => clicking on a newly created Catalog Item in the list throws an error, nothing happens in the UI, Catalog Item's summary screen is not displayed.
[----] F, [2019-04-23T15:52:30.005889 #23768:2ac1b3113290] FATAL -- : Error caught: [ActiveRecord::RecordNotFound] Couldn't find ServiceTemplateCatalog with 'id'= /home/hstastna/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activerecord-5.0.7.2/lib/active_record/core.rb:173:in `find' /home/hstastna/manageiq/manageiq-ui-classic/app/controllers/catalog_controller.rb:1897:in `open_parent_nodes' /home/hstastna/manageiq/manageiq-ui-classic/app/controllers/catalog_controller.rb:1947:in `replace_right_cell' /home/hstastna/manageiq/manageiq-ui-classic/app/controllers/application_controller/explorer.rb:177:in `tree_select' /home/hstastna/manageiq/manageiq-ui-classic/app/controllers/catalog_controller.rb:278:in `x_show'

Note:
I need this BZ to be fixed for #5445,
otherwise it will not be possible to display Catalog Item info (with selected Tenants in the tree I am adding there) properly from the list.


Clicking on the Catalog Item from the list:
clicking

Before:
After Clicking on created Catalog Item, nothing happens:
before_catitem

After:
Displaying created Catalog Item's info:
after_catitem
Displaying Catalog Bundle's info:
after2_catbundle

@hstastna
Copy link
Author

@miq-bot add_label bug, hammer/yes

@hstastna
Copy link
Author

@miq-bot add_reviewer @himdel

@@ -1860,7 +1860,7 @@ def open_parent_nodes(record)
parents = [:id => template_to_node_name(record)]
else
# Check for parent nodes missing from vandt tree and return them if any
parent_rec = ServiceTemplateCatalog.find(record.service_template_catalog_id)
parent_rec = ServiceTemplateCatalog.find_by_id(record.service_template_catalog_id) # nil is a valid value
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, miq-bot is right here, this should be find_by(:id =>.

It will probably complain again, and not be right that time :).

@hstastna hstastna force-pushed the Error_when_clicking_created_Catalog_Item branch from fe105f4 to 507ee89 Compare April 24, 2019 08:22
@miq-bot
Copy link
Member

miq-bot commented Apr 24, 2019

Checked commit hstastna@507ee89 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
1 file checked, 0 offenses detected
Everything looks fine. 🍰

@mzazrivec mzazrivec self-assigned this Apr 25, 2019
@mzazrivec mzazrivec added this to the Sprint 110 Ending Apr 29, 2019 milestone Apr 25, 2019
@mzazrivec mzazrivec merged commit 02f596a into ManageIQ:master Apr 25, 2019
simaishi pushed a commit that referenced this pull request Apr 30, 2019
…talog_Item

Fix error when clicking on created Catalog Item in the list

(cherry picked from commit 02f596a)

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1704772
@simaishi
Copy link
Contributor

Hammer backport details:

$ git log -1
commit aadea4e53a2be9146c4ca2e0bd8d4b801c437b74
Author: Milan Zázrivec <mzazrivec@redhat.com>
Date:   Thu Apr 25 09:50:11 2019 +0200

    Merge pull request #5481 from hstastna/Error_when_clicking_created_Catalog_Item
    
    Fix error when clicking on created Catalog Item in the list
    
    (cherry picked from commit 02f596a65fdcb1b248e114f2f863392478bb9546)
    
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1704772

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants