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

Method list dialog #22921

Closed
wants to merge 1 commit into from
Closed

Conversation

jeffibm
Copy link
Member

@jeffibm jeffibm commented Feb 29, 2024

UPDATE: please see #23106

Related PR - ManageIQ/manageiq-ui-classic#9059

This PR is an RnD work related to the search feature for the selection of the method.

Might be helpful for ManageIQ/manageiq-ui-classic#9047

if method_ids.present?
where(:id => method_ids.split(',').map(&:to_i))
else
where(nil)
Copy link
Member

Choose a reason for hiding this comment

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

unsure, but think a simple self would work here.

Copy link
Member Author

@jeffibm jeffibm May 8, 2024

Choose a reason for hiding this comment

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

Hey @kbrock , Yes, self methods should work here.

I used scope since the query was not that complex.

but, while using the self I was not able to chain it like -

MiqAeMethod
              .name_path_search(params[:search])
              .domain_search(params[:domain_id])
              .selected_methods(params[:ids])
              .select("id, relative_path, name")
              .order('name')

Copy link
Member

Choose a reason for hiding this comment

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

then lets use where(nil)

@jeffibm jeffibm force-pushed the method-list-dialog branch from f552314 to 4da7f18 Compare May 17, 2024 06:04
@GilbertCherrie
Copy link
Member

Tested this with the UI pr: ManageIQ/manageiq-ui-classic#9059 and everything is working good

@jeffibm jeffibm force-pushed the method-list-dialog branch from 4da7f18 to 6b6927e Compare July 11, 2024 12:37
@miq-bot
Copy link
Member

miq-bot commented Jul 11, 2024

Checked commit jeffbonson@6b6927e with ruby 3.1.5, rubocop 1.56.3, haml-lint 0.51.0, and yamllint
1 file checked, 0 offenses detected
Everything looks fine. ⭐

@jeffibm jeffibm changed the title [WIP] Method list dialog Method list dialog Jul 11, 2024
@jeffibm
Copy link
Member Author

jeffibm commented Jul 11, 2024

Tested this with the UI pr: ManageIQ/manageiq-ui-classic#9059 and everything is working good

Hey @kbrock , this PR looks ok.

Since it's been open for a while, I have rebased it with master.

Could you please have a look at this when you find time and merge it so that we can get its dependent UI PR merged.

@@ -30,6 +30,22 @@ class MiqAeMethod < ApplicationRecord
AVAILABLE_SCOPES = ["class", "instance"]
validates_inclusion_of :scope, :in => AVAILABLE_SCOPES

scope :name_path_search, lambda { |search|
where('name ILIKE ? or relative_path ILIKE ?', "%#{search}%", "%#{search}%") if search.present?
Copy link
Member

@kbrock kbrock Jul 17, 2024

Choose a reason for hiding this comment

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

Suggested change
where('name ILIKE ? or relative_path ILIKE ?', "%#{search}%", "%#{search}%") if search.present?
search.present? ? where('name ILIKE ? or relative_path ILIKE ?', "%#{search}%", "%#{search}%") : where({})

Alternatively, if we want no results, then you can do : none

Do this across these 3 methods

@kbrock kbrock mentioned this pull request Jul 24, 2024
@kbrock
Copy link
Member

kbrock commented Jul 24, 2024

deferring to #23106

Thanks Jeffrey

@kbrock kbrock closed this Jul 24, 2024
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