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

Fixes #21602 - Add scoped_search on host.id for reports #4989

Merged
merged 1 commit into from
Nov 9, 2017

Conversation

xprazak2
Copy link
Contributor

@xprazak2 xprazak2 commented Nov 8, 2017

No description provided.

@theforeman-bot
Copy link
Member

Issues: #21602

@@ -19,6 +19,7 @@ class Report < ApplicationRecord
def self.inherited(child)
child.instance_eval do
scoped_search :relation => :host, :on => :name, :complete_value => true, :rename => :host
scoped_search :relation => :host, :on => :id, :complete_value => true, :rename => :host_id
Copy link
Member

Choose a reason for hiding this comment

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

Why not search on the host_id column? it would save a potentially painful join with the host table. Also, please make this only explicit.

@@ -27,6 +27,8 @@ def self.inherited(child)
scoped_search :relation => :hostgroup, :on => :title, :complete_value => true, :rename => :hostgroup_title

scoped_search :on => :reported_at, :complete_value => true, :default_order => :desc, :rename => :reported, :only_explicit => true
scoped_search :on => :host_id, :complete_value => true, :only_explicit => true

Choose a reason for hiding this comment

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

Extra empty line detected at block body end.

@xprazak2
Copy link
Contributor Author

xprazak2 commented Nov 9, 2017

I changed to search on reports.host_id column.

@@ -27,6 +27,7 @@ def self.inherited(child)
scoped_search :relation => :hostgroup, :on => :title, :complete_value => true, :rename => :hostgroup_title

scoped_search :on => :reported_at, :complete_value => true, :default_order => :desc, :rename => :reported, :only_explicit => true
scoped_search :on => :host_id, :complete_value => true, :only_explicit => true
Copy link
Member

Choose a reason for hiding this comment

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

@ares made a good comment on the similar GH-4993 - please make complete_value false so it doesn't auto-suggest all host ids.

@xprazak2
Copy link
Contributor Author

xprazak2 commented Nov 9, 2017

I changed it to :complete_value => false

@tbrisker tbrisker merged commit 820afc5 into theforeman:develop Nov 9, 2017
@tbrisker
Copy link
Member

tbrisker commented Nov 9, 2017

Thanks @xprazak2

@ares
Copy link
Member

ares commented Nov 10, 2017

Setting release to 1.17

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