View Source LightningWeb.WorkflowNewLive.WorkflowParams (Lightning v2.10.4)

Various function for reconciling changes to a workflow params map.

The front end editor uses JSON patches to represent changes to the workflow.

Summary

Functions

Produce a new set of params by applying the given form params to the current params.

Produce a new set of params by applying the given patches to the current parms

Convert a changeset to a serializable map of workflow params, suitable for sending to the front end editor.

Produce a set of patches that represent the difference between the initial params and the target params.

Functions

Link to this function

apply_form_params(current_params, form_params)

View Source

Produce a new set of params by applying the given form params to the current params.

Link to this function

apply_patches(current_params, patches)

View Source

Produce a new set of params by applying the given patches to the current parms

@spec to_map(Ecto.Changeset.t()) :: %{required(String.t()) => any()}

Convert a changeset to a serializable map of workflow params, suitable for sending to the front end editor.

It uses Lightning.Helpers.json_safe/1 to ensure that the map is safe to serialize to JSON. This is necessary because the underlying model may contain atom values.

Link to this function

to_patches(initial_params, target_params)

View Source

Produce a set of patches that represent the difference between the initial params and the target params.

This usually is used to produce a set of patches that represent the changes introduced by a changeset.