-
Notifications
You must be signed in to change notification settings - Fork 357
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
Changes to exclude service templates marked as service_type = internal #4274
Changes to exclude service templates marked as service_type = internal #4274
Conversation
@martinpovolny i will be adding spec test for this later today |
42b1f0e
to
8352bf6
Compare
@h-kataria I cannot test your PR locally. I forked your branch and referenced it in my bundler.d/Gemfile.dev.rb, but I cannot resolve error |
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.
@h-kataria I believe we need to review all the where
class in this PR and determine if there are existing scopes or do we need new scopes that can be used.
cc @bzwei
@@ -1776,7 +1777,7 @@ def get_node_info_handle_stc_node(id) | |||
|
|||
def get_node_info_handle_leaf_node_stcat(id) | |||
@record = ServiceTemplateCatalog.find(id) | |||
@record_service_templates = Rbac.filtered(@record.service_templates) | |||
@record_service_templates = Rbac.filtered(@record.service_templates.where("service_type != 'internal'")) |
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.
@h-kataria I think you want to use the new scope
here instead of recreating the where
clause.
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.
@gmcculloug will clean those up.
@gmcculloug please re-review, replaced where clauses with named_Scope wherever possible. |
@@ -1455,7 +1454,7 @@ def rearrange_groups_array | |||
|
|||
def get_available_resources(kls) | |||
@edit[:new][:available_resources] = {} | |||
Rbac.filtered(kls.constantize.where("type is null or type != 'ServiceTemplateAnsiblePlaybook'")).select(:id, :name).each do |r| | |||
Rbac.filtered(kls.constantize.where("type is null or type not in (?)", ['ServiceTemplateAnsiblePlaybook', 'ServiceTemplateTransformationPlan'])).select(:id, :name).each do |r| |
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.
Is kls.constantize
always ServiceTemplate
here? If so it would be better to use the scope here as well:
Rbac.filtered(kls.constantize.public_service_templates.where("type is null or type != 'ServiceTemplateAnsiblePlaybook'")).select(:id, :name).each do |r|
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.
@h-kataria One additional change I commented on and then please address rubocop comments.
9703fe2
to
d1baacf
Compare
@lgalis can you please test |
@gmcculloug addressed your comments and rubocop warning, please take a look. |
@h-kataria - looks good. Verified that the migration plans are no longer displayed in the Catalog Items list with this fix. |
@gmcculloug any remaining items to solve to merge? |
@bthurber Yes, this PR still requires backend changes which are being worked on. We are taking a slightly different approach then what was done in the dependent PR ManageIQ/manageiq#17681 and those changes are in progress. First PR is here: ManageIQ/manageiq-schema#238 |
This pull request is not mergeable. Please rebase and repush. |
f8a1575
to
cef6662
Compare
@AparnaKarve can you please review/test this blocker PR |
This is to exclude Migration Plan Service Templates from Catalogs Explorer. Backend changes to support this are in ManageIQ/manageiq#17681 Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1594408
cef6662
to
4e232c3
Compare
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.
Validated in the UI successfully.
service templates that already existed prior to this PR and ManageIQ/manageiq#17681, ManageIQ/manageiq#17748 still show up in Catalog Items; but the new ones (new migration plans) created after applying these PR changes, do not show up in Catalog items, which is the expected behavior
@h-kataria - Looks good - verified in the UI that with this PR and ManageIQ/manageiq#17748, a newly created migration plan will not show in the list of Catalog Items . ( Migration plans created prior to these code changes will still be visible) |
@h-kataria dependent PR ManageIQ/manageiq#17748 has been merged. |
4e232c3
to
59a7fda
Compare
59a7fda
to
e61f273
Compare
Checked commits h-kataria/manageiq-ui-classic@5fc42f8~...e61f273 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
@h-kataria @gmcculloug Please confirm that the only PR this depends on for Gaprindashvili backport is ManageIQ/manageiq#17748 and ManageIQ/manageiq#17681 isn't needed. |
@simaishi Your statement is correct, you only need to backport ManageIQ/manageiq#17748. The confusion is that the work was initially started in ManageIQ/manageiq#17681 and we ended up changing direction on the solution. However, this PR had a refactoring, creating constants for service_type, that we wanted to keep so the PR was reworked to keep just that part. |
…migration_plans Changes to exclude service templates marked as service_type = internal (cherry picked from commit 3acd763) Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1610729
Gaprindashvili backport details:
|
This is to exclude Migration Plan Service Templates from Catalogs Explorer. Backend changes to support this are in ManageIQ/manageiq#17681
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1594408
Depends on ManageIQ/manageiq#17681, ManageIQ/manageiq#17748
@bzwei please review/test