mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-10-23 03:48:11 +08:00
Show File System and Deployment Group form errors (#2396)
This commit is contained in:
parent
74d98e58d9
commit
c8fbad1bf8
3 changed files with 29 additions and 4 deletions
|
|
@ -127,9 +127,14 @@ defmodule LivebookWeb.Hub.FileSystemFormComponent do
|
||||||
|> put_flash(:success, message)
|
|> put_flash(:success, message)
|
||||||
|> push_patch(to: socket.assigns.return_to)}
|
|> push_patch(to: socket.assigns.return_to)}
|
||||||
else
|
else
|
||||||
{:error, %Ecto.Changeset{} = changeset} -> {:noreply, assign(socket, changeset: changeset)}
|
{:error, %Ecto.Changeset{} = changeset} ->
|
||||||
{:transport_error, message} -> {:noreply, assign(socket, error_message: message)}
|
{:noreply, assign(socket, changeset: Map.replace!(changeset, :action, :validate))}
|
||||||
{:error, message} -> {:noreply, assign(socket, error_message: message)}
|
|
||||||
|
{:transport_error, message} ->
|
||||||
|
{:noreply, assign(socket, error_message: message)}
|
||||||
|
|
||||||
|
{:error, message} ->
|
||||||
|
{:noreply, assign(socket, error_message: message)}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ defmodule LivebookWeb.Hub.Teams.DeploymentGroupFormComponent do
|
||||||
|> push_patch(to: ~p"/hub/#{socket.assigns.hub.id}/deployment-groups/edit/#{id}")}
|
|> push_patch(to: ~p"/hub/#{socket.assigns.hub.id}/deployment-groups/edit/#{id}")}
|
||||||
else
|
else
|
||||||
{:error, %Ecto.Changeset{} = changeset} ->
|
{:error, %Ecto.Changeset{} = changeset} ->
|
||||||
{:noreply, assign(socket, changeset: changeset)}
|
{:noreply, assign(socket, changeset: Map.replace!(changeset, :action, :validate))}
|
||||||
|
|
||||||
{:transport_error, message} ->
|
{:transport_error, message} ->
|
||||||
{:noreply, assign(socket, error_message: message)}
|
{:noreply, assign(socket, error_message: message)}
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,16 @@ defmodule LivebookWeb.Integration.Hub.EditLiveTest do
|
||||||
assert render(view) =~ "Secret TEAM_ADD_SECRET added successfully"
|
assert render(view) =~ "Secret TEAM_ADD_SECRET added successfully"
|
||||||
assert render(element(view, "#hub-secrets-list")) =~ secret.name
|
assert render(element(view, "#hub-secrets-list")) =~ secret.name
|
||||||
assert secret in Livebook.Hubs.get_secrets(hub)
|
assert secret in Livebook.Hubs.get_secrets(hub)
|
||||||
|
|
||||||
|
# Guarantee it shows the error from API
|
||||||
|
|
||||||
|
{:ok, view, _html} = live(conn, ~p"/hub/#{hub.id}/secrets/new")
|
||||||
|
|
||||||
|
view
|
||||||
|
|> element("#secrets-form")
|
||||||
|
|> render_submit(attrs)
|
||||||
|
|
||||||
|
assert render(view) =~ "has already been taken"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "updates existing secret", %{conn: conn, hub: hub} do
|
test "updates existing secret", %{conn: conn, hub: hub} do
|
||||||
|
|
@ -332,6 +342,16 @@ defmodule LivebookWeb.Integration.Hub.EditLiveTest do
|
||||||
assert_patch(view, "/hub/#{hub.id}/deployment-groups/edit/#{id}")
|
assert_patch(view, "/hub/#{hub.id}/deployment-groups/edit/#{id}")
|
||||||
assert render(view) =~ "Deployment group TEAM_ADD_DEPLOYMENT_GROUP added successfully"
|
assert render(view) =~ "Deployment group TEAM_ADD_DEPLOYMENT_GROUP added successfully"
|
||||||
assert deployment_group in Livebook.Teams.get_deployment_groups(hub)
|
assert deployment_group in Livebook.Teams.get_deployment_groups(hub)
|
||||||
|
|
||||||
|
# Guarantee it shows the error from API
|
||||||
|
|
||||||
|
{:ok, view, _html} = live(conn, ~p"/hub/#{hub.id}/deployment-groups/new")
|
||||||
|
|
||||||
|
view
|
||||||
|
|> element("#deployment-groups-form")
|
||||||
|
|> render_submit(attrs)
|
||||||
|
|
||||||
|
assert render(view) =~ "has already been taken"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "updates existing deployment group", %{conn: conn, hub: hub} do
|
test "updates existing deployment group", %{conn: conn, hub: hub} do
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue