-
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
Load dialog fields with updated values on workflow submit #17855
Conversation
@miq-bot add_label bug, blocker, gaprindashvili/yes |
@@ -21,14 +21,19 @@ def initialize(values, requester, resource_action, options = {}) | |||
|
|||
Vmdb::Deprecation.deprecate_methods(self, :dialogs => :dialog) | |||
|
|||
def submit_request | |||
def submit_request(data) |
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.
Should we provide a default value (data = {})
which would remove the need to pass empty hashes in service_template and the specs?
Also, service_template and the specs
is not a good band name. 🎻 🥁
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.
I know it's still WIP, but since a review was requested: spec please? 😄
@miq-bot remove_label wip |
@eclarizio can you please take another look for me? |
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.
Thanks for adding the spec, but I think you need to add a spec for the #submit_request
method as well, since that's really the main method you changed and is what the API will be calling into.
@@ -21,14 +21,19 @@ def initialize(values, requester, resource_action, options = {}) | |||
|
|||
Vmdb::Deprecation.deprecate_methods(self, :dialogs => :dialog) | |||
|
|||
def submit_request | |||
def submit_request(data = {}) | |||
update_dialog_field_values(data) if data.present? |
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.
Disregard. My mistake, when testing I set a variable of `test` to a valid hash and `test2` to an empty hash and when I went to test `.present?` I used `test.present?` which of course returned true. `test2.present?` does indeed return false.
This pull request is not mergeable. Please rebase and repush. |
@eclarizio PTAL |
@eclarizio @gmcculloug it's complaining because I moved those existing lines, not because I added anything that has an |
Some comments on commits d-m-u/manageiq@3f41da8~...72fb15e spec/models/resource_action_workflow_spec.rb
|
Checked commits d-m-u/manageiq@3f41da8~...72fb15e with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
@d-m-u The |
@eclarizio sorry but changing that makes the tests fail. |
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.
No problem, I think it's fine to leave it the way it is then, especially since you didn't introduce those lines and they were simply moved.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1594469
We need to run load_values_into_fields inside the resource action workflow, not where they're currently running because with the changes to how and when we load field values, this functionality broke.
I think that the api needs to be passing the changed field values into the resource action workflow when we make the submit workflow call. Otherwise the field values automate sees by the time we get to https://github.com/ManageIQ/manageiq/blob/master/app/models/resource_action_workflow.rb#L81 will be the default values only, not the updated fields you changed on the dialog.
The setup this applies to is a custom button on a generic object.
Related to
ManageIQ/manageiq-api#448