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

Send back full dialog on create and edit #32

Merged
merged 1 commit into from
Sep 11, 2017
Merged

Send back full dialog on create and edit #32

merged 1 commit into from
Sep 11, 2017

Conversation

jntullo
Copy link

@jntullo jntullo commented Aug 22, 2017

When the dialog is created or edited, the entire contents of the dialog need to be returned.

cc: @romanblanco

@miq-bot add_label enhancement
@miq-bot assign @abellotti

@@ -18,7 +18,8 @@ def fetch_service_dialogs_content(resource)
end

def create_resource(_type, _id, data)
DialogImportService.new.import(data)
dialog = DialogImportService.new.import(data)
fetch_service_dialogs_content(dialog)
Copy link
Member

Choose a reason for hiding this comment

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

don't we want to return both the resource + resource.content (i.e. as if we're specifying additional_attributes of content ?)

Copy link
Author

Choose a reason for hiding this comment

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

@abellotti it does return both, there are tests for that as well

Copy link
Member

Choose a reason for hiding this comment

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

I'm still a bit confused here, the fetch__ are getters for virtual attributes. Why isn't the hook on line 3 getting this for us. set_additional_attributes asks for content.

Copy link
Author

Choose a reason for hiding this comment

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

@abellotti fetch_ are getters for virtual attributes - and it works as expected on :index and :show, as specified on line 3. This, however, is for create and update. I played around with this quite a bit today, and unfortunately applying the logic of line 3 to create and update with additional attributes will require a bit of refactoring in renderer and virtual attribute selection. i'd be happy to go forward with that work, but want to get your thoughts on whether that would be necessary.

@@ -31,7 +32,7 @@ def edit_resource(type, id, data)
rescue => err
raise BadRequestError, "Failed to update service dialog - #{err}"
end
service_dialog
fetch_service_dialogs_content(service_dialog).first
Copy link
Member

Choose a reason for hiding this comment

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

why is there a .first here and not above on line 22 ?

Copy link
Author

Choose a reason for hiding this comment

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

@abellotti it returns an array, and it needs to return the first element which is both the service dialog and the content

@miq-bot
Copy link
Member

miq-bot commented Sep 7, 2017

This pull request is not mergeable. Please rebase and repush.

@miq-bot
Copy link
Member

miq-bot commented Sep 11, 2017

Checked commit jntullo@e499934 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
2 files checked, 0 offenses detected
Everything looks fine. 🍪

@abellotti abellotti added this to the Sprint 69 Ending Sep 18, 2017 milestone Sep 11, 2017
@abellotti
Copy link
Member

Thanks @jntullo for the API enhancement. LGTM!!

@abellotti abellotti merged commit 7a31abe into ManageIQ:master Sep 11, 2017
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.

3 participants