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

Specify a target and resource when refreshing a dialog field #233

Merged
merged 2 commits into from Dec 4, 2017

Conversation

eclarizio
Copy link
Member

@eclarizio eclarizio commented Dec 1, 2017

Related to ManageIQ/manageiq-ui-classic#2885, this needs to be merged first so that the API then supports the parameters that are being passed in for refresh.

https://bugzilla.redhat.com/show_bug.cgi?id=1518390

@eclarizio eclarizio changed the title [WIP] Specify a target and resource when refreshing a dialog field Specify a target and resource when refreshing a dialog field Dec 4, 2017
@miq-bot miq-bot removed the wip label Dec 4, 2017
Copy link

@jntullo jntullo left a comment

Choose a reason for hiding this comment

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

LGTM 👍

data ||= {}
dialog_fields = Hash(data["dialog_fields"])
refresh_fields = data["fields"]
return action_result(false, "Must specify fields to refresh") if refresh_fields.blank?

define_service_dialog_fields(service_dialog, dialog_fields)
service_dialog = define_service_dialog(dialog_fields, data)
Copy link
Member

Choose a reason for hiding this comment

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

with the service_dialog no longer passed in as parameter (which was RBAC checked earlier for the user via resource_search), is it possible we'll be updating a different service_dialog (data driven and not URL) ?

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought about that too, but the way the classic-ui was doing the refresh before was pulling the dialog off of the resource_action, since it belongs to it. So I guess I could envision a scenario where someone could call, say, /api/service_dialogs/123 with action set to refresh, and pass in a bogus resource_action_id that doesn't correspond to the dialog with the id of 123. We could compare ids, and return an error if they don't match, maybe?

Copy link
Member

Choose a reason for hiding this comment

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

maybe pass the service_dialog to refresh_dialog_fields_service_dialog and have it check there against the one defined in data and raise an error accordingly, (with added test for that). Thanks.

@eclarizio
Copy link
Member Author

@abellotti, addressed your concerns, added specs. It definitely would have been possible (although very unlikely) that the resource action id could have pointed to a different dialog, but when trying to update the fields, unless there was a field of the same name to attempt to be updated in the different dialog, the API would have returned an error as well.

This way, though, we should be safe if somehow that does happen.

@abellotti
Copy link
Member

Thanks @eclarizio just the picky rubocop ^

@miq-bot
Copy link
Member

miq-bot commented Dec 4, 2017

Checked commits eclarizio/manageiq-api@0cbec91~...574e63d with ruby 2.3.3, rubocop 0.47.1, haml-lint 0.20.0, and yamllint 1.10.0
2 files checked, 0 offenses detected
Everything looks fine. 🍰

@abellotti
Copy link
Member

@eclarizio thanks for the update.

@eclarizio @gmcculloug Is this g/yes ?

@abellotti abellotti added the bug label Dec 4, 2017
@eclarizio
Copy link
Member Author

@miq-bot add_label gaprindashvili/yes

@abellotti abellotti added this to the Sprint 75 Ending Dec 11, 2017 milestone Dec 4, 2017
@abellotti abellotti merged commit d56b2a6 into ManageIQ:master Dec 4, 2017
simaishi pushed a commit that referenced this pull request Dec 4, 2017
Specify a target and resource when refreshing a dialog field
(cherry picked from commit d56b2a6)

https://bugzilla.redhat.com/show_bug.cgi?id=1520678
@simaishi
Copy link
Contributor

simaishi commented Dec 4, 2017

Gaprindashvili backport details:

$ git log -1
commit bbd52eb2b6a17bafe8761974401460c9fae17e8f
Author: Alberto Bellotti <abellotti@users.noreply.github.com>
Date:   Mon Dec 4 16:59:42 2017 -0500

    Merge pull request #233 from eclarizio/dialog_refresh_targets
    
    Specify a target and resource when refreshing a dialog field
    (cherry picked from commit d56b2a6214aa1d063ecc3ffb3ad03a8116fcc011)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1520678

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.

None yet

5 participants