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

[WIP] Adding support for subcollections and related subresources #80

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

abellotti
Copy link
Member

@abellotti abellotti commented Apr 26, 2018

Adding support for subcollections and related subresources

  • Dynamically driven by the "subcollections" exposed via OPTIONS /api/:collection

  • supports queries and actions

    Queries:
    miq.vms.find(166).tags.collect(&:name)
    miq.vms.find(166).tags.select(:categorization).collect(&:categorization)
    
    Subcollection Actions:
    miq.vms.find(166).tags.assign(:name => "/managed/location/ny")
    miq.vms.find(166).tags.assign([{:name => "/managed/location/chicago"}, {:name => "/managed/cc/001"}])
    
    Subcollection resource actions:
    miq.vms.find(166).tags.find(32).unassign
    miq.vms.find(166).tags.where(:name => "/managed/location/*").collect(&:unassign)
    
    Nested searches with sub resource actions:
    miq.providers.find_by(:name => "test-vc").vms.where(:name => "testvm-*").last.tags.where(:name => "environment/testing").unassign
    

    Fixes: Add support for subcollections queries #31
    Fixes: Add support for subcollection actions #32

- Dynamically driven by the "subcollections" exposed via OPTIONS /api/:collection
- supports queries and actions

  Queries:
  miq.vms.find(166).tags.collect(&:name)
  miq.vms.find(166).tags.select(:categorization).collect(&:categorization)

  Subcollection Actions:
  miq.vms.find(166).tags.assign(:name => "/managed/location/ny")
  miq.vms.find(166).tags.assign([{:name => "/managed/location/chicago"}, {:name => "/managed/cc/001"}])

  Subcollection resource actions:
  miq.vms.find(166).tags.find(32).unassign
  miq.vms.find(166).tags.where(:name => "/managed/location/*").collect(&:unassign)

Fixes: ManageIQ#31
Fixes: ManageIQ#32
- Moving action specific action methods for resources and subresources to seperate mixin.
- Moving action specific action methods for collections and subcollections to seperate mixin.
- Moving common queryable methods for collections and subcollections to a common QueryableMixin
- Updated options response fixture to include subcollections
- Added collection rspecs
- Added resource rspecs
- Add tests for subcollections
- Adding resource actions_vms.json
- Adding subcollection actions_vm_tags.json
- Adding tests for subresources
parameters_from_query_relation, filters_from_query_relation and order_parameters_from_query_relation
which really live in the mixins/queryable_mixin.rb
need for the collection_action_mixin.rb
@chessbyte
Copy link
Member

@abellotti if this is still a viable PR, then please rebase.

@abellotti
Copy link
Member Author

Yes, these are still viable PRs.

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.

Add support for subcollection actions Add support for subcollections queries
3 participants