diff --git a/lib/lightning_web/live/job_live/manual_run_component.ex b/lib/lightning_web/live/job_live/manual_run_component.ex index a644143af2..589a8061a9 100644 --- a/lib/lightning_web/live/job_live/manual_run_component.ex +++ b/lib/lightning_web/live/job_live/manual_run_component.ex @@ -22,6 +22,7 @@ defmodule LightningWeb.JobLive.ManualRunComponent do |> put_embed(:job, job) |> put_embed(:user, user) |> validate_required([:project, :job, :user]) + |> remove_body_if_dataclip_present() |> Lightning.Validators.validate_exclusive( [:dataclip_id, :body], "Dataclip and custom body are mutually exclusive." @@ -31,6 +32,13 @@ defmodule LightningWeb.JobLive.ManualRunComponent do "Either a dataclip or a custom body must be present." ) end + + defp remove_body_if_dataclip_present(changeset) do + case get_change(changeset, :dataclip_id) do + nil -> changeset + _ -> Ecto.Changeset.delete_change(changeset, :body) + end + end end alias LightningWeb.Components.Form diff --git a/lib/lightning_web/live/workflow_live/edit.ex b/lib/lightning_web/live/workflow_live/edit.ex index 3de5e33d5e..65a35f3ff4 100644 --- a/lib/lightning_web/live/workflow_live/edit.ex +++ b/lib/lightning_web/live/workflow_live/edit.ex @@ -487,7 +487,6 @@ defmodule LightningWeb.WorkflowLive.Edit do {:ok, workflow} -> socket |> assign_workflow(workflow) - |> push_patch(to: build_next_path(socket, workflow), replace: true) |> put_flash(:info, "Workflow saved") {:error, changeset} -> @@ -709,12 +708,6 @@ defmodule LightningWeb.WorkflowLive.Edit do end end - defp build_next_path(socket, workflow) do - %{project: project, selection_params: selection_params} = socket.assigns - - ~p"/projects/#{project}/w/#{workflow}?#{selection_params |> Map.reject(&match?({_, nil}, &1))}" - end - # find the changeset for the selected item # it could be an edge, a job or a trigger defp find_item_in_changeset(changeset, id) do