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 displaying multiple Catalogs with the same name in the dropdown while creating a Catalog Item #4278

Merged

Conversation

hstastna
Copy link

@hstastna hstastna commented Jul 11, 2018

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


Steps to reproduce:

  1. Enable Ansible Embedded role (not sure if this is required)
  2. Add multiple (child) Tenants (Configuration > Access Control > Tenants), each Tenant has one super admin user which then creates Catalog with name 'catalog' (under Services > Catalogs > Catalogs)
  3. Add Ansible Credentials and Repo (not sure if this is required)
  4. Try to add new catalog item of Ansible Playbook type ( Services > Catalogs > Catalog Items )
    (or also any other type, but the BZ is mainly about Ansible Playbook type)

Before: (multiple Catalogs with the same name in the dropdown)
Adding a new Service Catalog Item:
catalog_before
Editing an existing Catalog Item - similar problem as the picture above

After:
Adding a new Service Catalog Item:
catalog_after
Editing an existing Catalog Item:
edit_item

This PR:

  • adds a new method available_catalogs for getting all the available catalogs with the names containing tenant names and their ancestors (if they exist) to prevent displaying multiple catalogs with the same name in the dropdown menu while creating/editing a Catalog Item or also Catalog Bundle because the same problems occurs also there
  • passes the variable with the new available catalogs to angular form, for editing catalogs' names to display also tenants and their ancestors names in the drop down menu
  • finally edits the original name of each catalog to get tenants and their ancestors names in the name of the Catalog

@hstastna
Copy link
Author

@miq-bot add_label bug, gaprindashvili/yes, fine/yes

@hstastna hstastna force-pushed the Multiple_catalogs_same_name_dropdown_menu branch 9 times, most recently from 0f71300 to 291bf5e Compare July 11, 2018 14:19
@hstastna
Copy link
Author

hstastna commented Jul 11, 2018

@h-kataria I've found some solution for the BZ, not sure if it looks good (but it works well). Anyway, I have a question: do we want to fix the problem according to the one specific situation - while only Ansible Playbook as a Catalog Item Type is chosen? I did it so because of description in the BZ but.. don't we want the same change also for another types? Because I was able to create such catalogs so then.. see the screenshot (editing some Catalog Item of some other type):
not_playbook_type

@hstastna hstastna force-pushed the Multiple_catalogs_same_name_dropdown_menu branch from 291bf5e to 59140d4 Compare July 12, 2018 12:51
@h-kataria
Copy link
Contributor

@hstastna it should be changed for both Ansible and non-Ansible type Catalog Items to keep it consistent.

@hstastna hstastna force-pushed the Multiple_catalogs_same_name_dropdown_menu branch 5 times, most recently from e5bceea to 1df2b0a Compare August 14, 2018 15:32
@hstastna hstastna changed the title [WIP] Fix displaying multiple Catalogs with the same name in the dropdown while creating a Catalog Item Fix displaying multiple Catalogs with the same name in the dropdown while creating a Catalog Item Aug 14, 2018
@miq-bot miq-bot removed the wip label Aug 14, 2018
@hstastna
Copy link
Author

@h-kataria I've made small changes in this PR, to fix the problem for both Ansible and non-Ansible type Catalog Items. It works for editing and also adding new Catalog Items, also for Catalog Bundles :)

@mzazrivec
Copy link
Contributor

@h-kataria Are you OK with the above changes?

@hstastna Could you please address the codeclimate issues? Thanks.

@hstastna
Copy link
Author

Thanks, @mzazrivec I will update the PR asap resolving codeclimate issues.

@hstastna hstastna force-pushed the Multiple_catalogs_same_name_dropdown_menu branch from 1df2b0a to 75719c2 Compare August 22, 2018 13:01
@h-kataria h-kataria self-assigned this Aug 22, 2018
@hstastna hstastna force-pushed the Multiple_catalogs_same_name_dropdown_menu branch 2 times, most recently from 90c2472 to aae8173 Compare August 24, 2018 08:38
Hilda Stastna added 4 commits August 27, 2018 09:53
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1451300

Add new method available_catalogs for getting all the available catalogs with
the names containing tenant names and their ancestors to prevent displaying
catalogs with the same name in the dropdown menu while creating a Catalog Item
or Catalog Bundle.
Pass the variable for editing catalogs' names to be able to display
also tenants and their ancestors names in the drop down menu while
creating a new Catalog Item.
Edit name of each catalog to get tenants and their ancestors names
in the name of the catalog in the drop down menu.
This is related to the different Catalog Item types than Ansible Playbook.
@hstastna hstastna force-pushed the Multiple_catalogs_same_name_dropdown_menu branch 2 times, most recently from 979c38d to 8f34d8b Compare August 27, 2018 08:09
Update specs according to changes in Catalog names while creating Catalog Item
@hstastna hstastna force-pushed the Multiple_catalogs_same_name_dropdown_menu branch from 8f34d8b to 28d90af Compare August 27, 2018 08:12
@miq-bot
Copy link
Member

miq-bot commented Aug 27, 2018

Checked commits hstastna/manageiq-ui-classic@bde7cb5~...28d90af with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
2 files checked, 0 offenses detected
Everything looks fine. 🍪

@h-kataria h-kataria added this to the Sprint 93 Ending Aug 27, 2018 milestone Aug 27, 2018
@h-kataria h-kataria merged commit 8c06fe0 into ManageIQ:master Aug 27, 2018
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.

4 participants