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

Changes to exclude service templates marked as service_type = internal #4274

Conversation

h-kataria
Copy link
Contributor

@h-kataria h-kataria commented Jul 10, 2018

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

@h-kataria
Copy link
Contributor Author

@martinpovolny i will be adding spec test for this later today

@h-kataria h-kataria force-pushed the service_templates_to_exclude_migration_plans branch from 42b1f0e to 8352bf6 Compare July 11, 2018 20:12
@bzwei
Copy link
Contributor

bzwei commented Jul 12, 2018

@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 Bundler could not find compatible versions for gem "faraday"
It is OK to me if you have tested it locally with my backend PR.

Copy link
Member

@gmcculloug gmcculloug left a 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'"))
Copy link
Member

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.

Copy link
Contributor Author

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.

@h-kataria
Copy link
Contributor Author

@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|
Copy link
Member

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|

Copy link
Member

@gmcculloug gmcculloug left a 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.

@h-kataria h-kataria force-pushed the service_templates_to_exclude_migration_plans branch from 9703fe2 to d1baacf Compare July 16, 2018 12:55
@h-kataria h-kataria changed the title [WIP] - Changes to exclude service templates marked as service_type = internal Changes to exclude service templates marked as service_type = internal Jul 16, 2018
@h-kataria h-kataria removed the wip label Jul 16, 2018
@h-kataria
Copy link
Contributor Author

@lgalis can you please test

@h-kataria
Copy link
Contributor Author

@gmcculloug addressed your comments and rubocop warning, please take a look.

@lgalis
Copy link
Contributor

lgalis commented Jul 16, 2018

@h-kataria - looks good. Verified that the migration plans are no longer displayed in the Catalog Items list with this fix.

@bthurber
Copy link

@gmcculloug any remaining items to solve to merge?

@gmcculloug
Copy link
Member

@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

@miq-bot
Copy link
Member

miq-bot commented Jul 24, 2018

This pull request is not mergeable. Please rebase and repush.

@h-kataria h-kataria force-pushed the service_templates_to_exclude_migration_plans branch from f8a1575 to cef6662 Compare July 27, 2018 23:22
@h-kataria h-kataria added the wip label Jul 27, 2018
@h-kataria h-kataria changed the title Changes to exclude service templates marked as service_type = internal [WIP] - Changes to exclude service templates marked as service_type = internal Jul 27, 2018
@h-kataria
Copy link
Contributor Author

@AparnaKarve can you please review/test this blocker PR

@h-kataria h-kataria force-pushed the service_templates_to_exclude_migration_plans branch from cef6662 to 4e232c3 Compare July 30, 2018 15:41
@h-kataria h-kataria removed the wip label Jul 30, 2018
@h-kataria h-kataria changed the title [WIP] - Changes to exclude service templates marked as service_type = internal Changes to exclude service templates marked as service_type = internal Jul 30, 2018
Copy link
Contributor

@AparnaKarve AparnaKarve left a 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

@lgalis
Copy link
Contributor

lgalis commented Jul 30, 2018

@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)

@gmcculloug
Copy link
Member

@h-kataria dependent PR ManageIQ/manageiq#17748 has been merged.

@h-kataria h-kataria force-pushed the service_templates_to_exclude_migration_plans branch from 4e232c3 to 59a7fda Compare July 31, 2018 21:23
@h-kataria h-kataria force-pushed the service_templates_to_exclude_migration_plans branch from 59a7fda to e61f273 Compare July 31, 2018 21:31
@miq-bot
Copy link
Member

miq-bot commented Jul 31, 2018

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
4 files checked, 0 offenses detected
Everything looks fine. 🏆

@dclarizio dclarizio removed the request for review from martinpovolny July 31, 2018 21:37
@dclarizio dclarizio merged commit 3acd763 into ManageIQ:master Jul 31, 2018
@dclarizio dclarizio added this to the Sprint 92 Ending Aug 13, 2018 milestone Jul 31, 2018
@h-kataria h-kataria deleted the service_templates_to_exclude_migration_plans branch July 31, 2018 22:28
@simaishi
Copy link
Contributor

simaishi commented Aug 1, 2018

@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.

@gmcculloug
Copy link
Member

@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.

simaishi pushed a commit that referenced this pull request Aug 6, 2018
…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
@simaishi
Copy link
Contributor

simaishi commented Aug 6, 2018

Gaprindashvili backport details:

$ git log -1
commit 24bc296be8024b360cb14837ac60e34d3c741c93
Author: Dan Clarizio <dclarizi@redhat.com>
Date:   Tue Jul 31 15:24:17 2018 -0700

    Merge pull request #4274 from h-kataria/service_templates_to_exclude_migration_plans
    
    Changes to exclude service templates marked as service_type = internal
    (cherry picked from commit 3acd7630eadecd477892075a2d4b222a16547940)
    
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1610729

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.

9 participants