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

Add scopes for MiqRequest #3274

Merged
merged 1 commit into from
Feb 20, 2018
Merged

Conversation

tumido
Copy link
Member

@tumido tumido commented Jan 18, 2018

Change the MiqRequest query builder to use named_scopes instead of filter.

Depends on: ManageIQ/manageiq#16843
Depends on: ManageIQ/manageiq#16939
Depends on: ManageIQ/manageiq#16950

  • Get rid of filter, use scopes instead
  • Investigate when the different branches in page_display_options are used (the first two seems redundant and the third seems unused)
  • Clean up and update testcases
  • Change request_types_for_model magic to something readible

@tumido
Copy link
Member Author

tumido commented Jan 18, 2018

cc @martinpovolny
@miq-bot add_label pending core, wip, refactoring

@miq-bot miq-bot changed the title Add scopes for MiqRequest [WIP] Add scopes for MiqRequest Jan 18, 2018
@tumido tumido force-pushed the miq_request_scopes branch 3 times, most recently from 95b4525 to 8a84800 Compare January 22, 2018 15:45
@tumido
Copy link
Member Author

tumido commented Jan 22, 2018

@miq-bot remove_label wip
@miq-bot add_label gtls, requests

@tumido tumido changed the title [WIP] Add scopes for MiqRequest Add scopes for MiqRequest Jan 22, 2018
Copy link
Contributor

@Ladas Ladas left a comment

Choose a reason for hiding this comment

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

@tumido nice work 👏 👏 , it looks like tough refactoring, untangling this.

@martinpovolny I wonder if the specs are enough to say this all works? Do we have also some integration tests somewhere? Or should we click it through?

@miq-bot miq-bot changed the title Add scopes for MiqRequest [WIP] Add scopes for MiqRequest Jan 30, 2018
@miq-bot miq-bot added wip and removed wip labels Jan 30, 2018
@martinpovolny
Copy link
Member

I merged the backend PR. Here I am waiting for the specs that we discussed today. Thx!

@tumido
Copy link
Member Author

tumido commented Jan 31, 2018

@martinpovolny 👍 I'm on it! 😉

@tumido
Copy link
Member Author

tumido commented Feb 5, 2018

@miq-bot remove_label wip

@tumido tumido changed the title [WIP] Add scopes for MiqRequest Add scopes for MiqRequest Feb 5, 2018
@miq-bot miq-bot removed the wip label Feb 5, 2018
@@ -118,7 +118,8 @@ def report_data_request_data(options)
# Fires a POST request to the current controller's /report_data action
#
def report_data_request(options)
post :report_data, :params => report_data_request_data(options)
request.headers['Content-Type'] = 'application/json'
post :report_data, report_data_request_data(options)
Copy link
Member Author

@tumido tumido Feb 5, 2018

Choose a reason for hiding this comment

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

The lines above are required, otherwise the report_data post request is broken. Rails can't handle nested arrays on request properly. (When sending the request.) This is the way to bypass it.

If :named_scope is sent the old way this is what happens:

Sent data (includes):

"named_scope" => [["with_requester", 80000000000202]]

Received by controller:

"named_scope" => [["with_requester"], [80000000000202]]

@tumido tumido force-pushed the miq_request_scopes branch from 1ead08f to cd812b1 Compare February 19, 2018 13:05
@miq-bot
Copy link
Member

miq-bot commented Feb 19, 2018

Some comments on commit tumido@cd812b1

spec/controllers/miq_request_controller_spec.rb

  • ⚠️ - 154 - Detected expect_any_instance_of. This RSpec method is highly discouraged, please only use when absolutely necessary.

@miq-bot
Copy link
Member

miq-bot commented Feb 19, 2018

Checked commit tumido@cd812b1 with ruby 2.3.3, rubocop 0.52.0, haml-lint 0.20.0, and yamllint 1.10.0
4 files checked, 3 offenses detected

app/controllers/miq_request_controller.rb

spec/support/controller_helper.rb

@martinpovolny martinpovolny merged commit 521486f into ManageIQ:master Feb 20, 2018
@martinpovolny martinpovolny added this to the Sprint 80 Ending Feb 26, 2018 milestone Feb 20, 2018
@martinpovolny martinpovolny self-assigned this Feb 20, 2018
@tumido tumido deleted the miq_request_scopes branch June 26, 2018 14:39
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.

4 participants