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

Remove Playbook Service Templates from list of Available resources #613

Conversation

h-kataria
Copy link
Contributor

@h-kataria h-kataria force-pushed the remove_playbook_templates_from_catalog_bundle_edit branch from 8ff205b to 2dee57a Compare March 7, 2017 18:12
@@ -1422,7 +1422,7 @@ def rearrange_groups_array

def get_available_resources(kls)
@edit[:new][:available_resources] = {}
kls.constantize.all.each do |r|
kls.constantize.all.reject { |st| st.type == "ServiceTemplateAnsiblePlaybook" }.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.

Better to query for only the items you want:
kls.constantize.where("type is null or type != 'ServiceTemplateAnsiblePlaybook'").each do |r|

cc @syncrou

@h-kataria
Copy link
Contributor Author

@gmcculloug made suggested change.

@@ -1422,7 +1422,7 @@ def rearrange_groups_array

def get_available_resources(kls)
@edit[:new][:available_resources] = {}
kls.constantize.all.each do |r|
kls.constantize.where("type is null or type != 'ServiceTemplateAnsiblePlaybook'").each do |r|
Copy link
Member

@chessbyte chessbyte Mar 7, 2017

Choose a reason for hiding this comment

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

@kbrock is this the preferred query? We can fix in follow-up PR - just drawing your attention here.

Copy link
Member

Choose a reason for hiding this comment

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

Not rush to get this in, if there is a better query we should update this PR.

Copy link
Member

Choose a reason for hiding this comment

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

@kbrock ping

Copy link
Member

Choose a reason for hiding this comment

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

if there is an index on type, then Postgres can do an index scan. But since we're bringing back all that data, not sure what we buy.

I don't know another way to write this query.
good catch on the type is null because I tend to miss this null nuance with type != 'abc'.

Copy link
Member

Choose a reason for hiding this comment

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

since you are only using the id and name, I'd only select those columns.

Copy link
Member

Choose a reason for hiding this comment

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

@kbrock Good point. @h-kataria So this line becomes:
kls.constantize.where("type is null or type != 'ServiceTemplateAnsiblePlaybook'").select(:id, :name).each do |r|

@miq-bot
Copy link
Member

miq-bot commented Mar 13, 2017

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

@h-kataria h-kataria force-pushed the remove_playbook_templates_from_catalog_bundle_edit branch from 40796e7 to d3e223b Compare March 14, 2017 16:07
@h-kataria h-kataria force-pushed the remove_playbook_templates_from_catalog_bundle_edit branch from d3e223b to cb6c343 Compare March 14, 2017 16:09
@h-kataria
Copy link
Contributor Author

@gmcculloug made suggested changes.

@miq-bot
Copy link
Member

miq-bot commented Mar 14, 2017

Checked commits h-kataria/manageiq-ui-classic@8b7d2f2~...cb6c343 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
2 files checked, 0 offenses detected
Everything looks good. 👍

@gmcculloug
Copy link
Member

Thanks. @dclarizio I think this is good to merge once tests are green.

@dclarizio dclarizio merged commit f2817a9 into ManageIQ:master Mar 14, 2017
@dclarizio dclarizio added this to the Sprint 57 Ending Mar 27, 2017 milestone Mar 14, 2017
@h-kataria h-kataria deleted the remove_playbook_templates_from_catalog_bundle_edit branch March 15, 2017 20:59
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.

6 participants