-
Notifications
You must be signed in to change notification settings - Fork 141
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/Remove CustomButton(s) to CustomButtonSet #539
Comments
I see two possible ways how this can be added to the API:
I vote for the 2nd option, but I might need some help with error handling. |
@skateman Second option means that if a user adds/removes multiple buttons when editing Custom Button Group there's gonna be one API call per button, right? |
@ZitaNemeckova yes |
Maybe there are other solutions that I'm not aware of, waiting for the API people to show up. |
Another idea thanks to @himdel: having a before_save :update_members
def update_members
self.members = CustomButton.find(set_data[:button_order])
end I really like this idea, but I don't want to introduce asymmetry with other parts of the API that I don't know 😟 so it would be really nice if I'd have some input on these options from someone who understands the codebase a little better. |
I guess I don't see the issue with making
|
My concern is that we currently have 2 independent places where we list the custom buttons associated with the set (one as an array of ids in If we had a nice way of having our subcollection, and custom-ordering it too, without that duplication, it would be perfect :). (That said, as long as it is possible to manipulate both lists via the API, we're mostly fine (except for potential short-term bugs caused by non-atomicity of that approach).) |
@abellotti and I looked at this today We were thinking that you could have an action on POST /api/custom_button_sets/:id
actions -> "assign_custom_buttons"
"resources" : [
{ "href" : "/api/custom_buttons/1" },
{ "id" : "2" },
{ "href" : "/api/custom_buttons/3" },
]
actions -> "unassign_custom_buttons"
"resources" : [
{ "href" : "/api/custom_buttons/1" },
{ "id" : "2" },
]
In addition to that we were thinking that it would also be good to allow assigning all the buttons in the set on the POST /api/custom_button_sets - create
{
data ....,
"custom_buttons" : [
{ "href" : "/api/custom_buttons/1" },
{ "id" : "2" },
{ "href" : "/api/custom_buttons/3" }
]
}
POST /api/custom_button_sets - edit
{
"action" : "edit",
"resource" : {
"custom_buttons" : [
{ "href" : "/api/custom_buttons/1" },
{ "id" : "2" },
{ "href" : "/api/custom_buttons/3" }
]
}
} |
@gtanzillo the important part not to miss is the button order, just saying so we won't forget about it. |
Created ManageIQ/manageiq#18368 , please review :) We don't actually need those add button/remove button actions, ever .. we only ever send the final list of buttons to the set. |
It's impossible to add/remove a CustomButton to/from CustomButtonSet via API but it's possible to change
set_data[:button_order]
that only says in what order buttons go. It would good to add it as well so UI can only call API and not use extra http request to do it :)@miq-bot assign @skateman
Related to ManageIQ/manageiq-ui-classic#4913
The text was updated successfully, but these errors were encountered: