-
Notifications
You must be signed in to change notification settings - Fork 897
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
Support array of objects for custom button support #14930
Conversation
https://www.pivotaltracker.com/n/projects/1613907/stories/140944305 This is changes in the Automate side to handle being passed in an array of objects.
@mkanoor Looks good. |
@gmcculloug |
app/models/resource_action.rb
Outdated
klass = target.first.id.class | ||
object_ids = target.collect { |t| "#{klass}::#{t.id}" }.join(",") | ||
override_attrs = {:array_object_type => target.first.class.base_class.name, | ||
'Array::object_ids' => object_ids}.merge(override_attrs || {}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like override_attrs
is a required hash field so this could be:
override_attrs.merge!(:array_object_type => target.first.class.base_class.name,
'Array::object_ids' => object_ids)
Also, what do you think about making the naming here a little more unique/consistent? target_object_type
and target_object_ids
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gmcculloug the override_attrs can also be nil so we have to initialize it before we do the merge
@Fryguy Looking for your thoughts on this one. The idea is to avoid overloading the automation process when passed an array of objects to load by passing the class/IDs into the method and letting the automate method process them as needed. The current usage is from custom buttons on a list-view so this is only handling a single object type. |
Checked commits mkanoor/manageiq@1c94dc0~...9a60fbd with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
ping @Fryguy? Can you delegate someone if you don't have time for this one, please? I'd like to use this from the UI. Thx! |
@Fryguy bump |
https://www.pivotaltracker.com/n/projects/1613907/stories/140944305
These are changes in the Automate side to handle being passed in an array of objects.
The objects are not loaded by the Automate Engine, they are loaded by the Automate Method based on the passed in target_object_type and target_object_ids.
Links
https://www.pivotaltracker.com/n/projects/1613907/stories/140944305
Custom Buttons: Submit multiple objects to automate at once #14877