forked from ManageIQ/manageiq
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'MR-for-PR6097' into '5.5.z'
MR for PR6097 - Add method for returning serialized attributes after dynamic updates This MR adds a method that will be used by the API in order to return all attributes of a dynamic dialog field (after it has run through its respective automate method). Cherry-pick was clean aside from the `dialog_field_serializer_spec` which I changed to use stubs instead of "allow" since this branch isn't on the latest Rspec yet. PR: ManageIQ#6097 BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1297953 See merge request !715
- Loading branch information
Showing
13 changed files
with
117 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,26 @@ | ||
class DialogFieldSerializer < Serializer | ||
EXCLUDED_ATTRIBUTES = ["created_at", "dialog_group_id", "id", "updated_at"] | ||
|
||
def self.serialize(dialog_field) | ||
new.serialize(dialog_field) | ||
end | ||
|
||
def initialize(resource_action_serializer = ResourceActionSerializer.new) | ||
@resource_action_serializer = resource_action_serializer | ||
end | ||
|
||
def serialize(dialog_field) | ||
serialized_resource_action = @resource_action_serializer.serialize(dialog_field.resource_action) | ||
|
||
included_attributes(dialog_field.attributes).merge("resource_action" => serialized_resource_action) | ||
extra_attributes = { | ||
"resource_action" => serialized_resource_action | ||
} | ||
|
||
if dialog_field.dynamic? | ||
dynamic_values = dialog_field.trigger_automate_value_updates | ||
extra_attributes["values"] = dynamic_values | ||
end | ||
|
||
included_attributes(dialog_field.attributes).merge(extra_attributes) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters