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

Feature/1012 tabs and storages #1028

Open
wants to merge 16 commits into
base: develop
Choose a base branch
from

Conversation

MelchiorKokernoot
Copy link
Contributor

No description provided.

@MelchiorKokernoot MelchiorKokernoot marked this pull request as ready for review January 2, 2025 11:50
core/systems/project/node_page.ex Outdated Show resolved Hide resolved
end
else
{:error, "Project creation failed"}
end
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good 👍

Next thing is to make the "storage creation" part of the transaction to prevent any project to exist without storage:

  Multi.new()
   |> Multi.insert(:project, project)
   |> Multi.insert(:storage, fn %{project: inserted_project} -> prepare_storage(inserted_project) end))
   |> EctoHelper.run(:auth, &update_auth/2)
   |> Repo.transaction()

The idea is that you can capture the just inserted project from the transaction and use this one. Now the storage will not be created if the project failed to be created.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please check out the new version of this, and confirm this is what you were looking for.

core/systems/project/_assembly.ex Show resolved Hide resolved
@MelchiorKokernoot
Copy link
Contributor Author

@AdrienneMendrik de vertalingskeys staan hierin
image

@MelchiorKokernoot
Copy link
Contributor Author

ik krijg het nog niet voor elkaar om te testen of de flash messages goed werken @mellelieuwes

case Project.Assembly.attach_storage_to_project(project) do
      {:ok, changes} ->
        {:ok,
         put_flash(
           socket,
           :info,
           dgettext("eyra-project", "node.data.empty.create-storage-success")
         )}

      {:error, reason} ->
        {:noreply,
         put_flash(
           socket,
           :error,
           dgettext("eyra-project", "node.data.empty.create-storage-failed")
         )}
    end

Comment on lines +20 to +26
{:ok,
put_flash(
socket,
:info,
dgettext("eyra-project", "node.data.empty.create-storage-success")
)}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mellelieuwes deze :ok lijkt niet correct te zijn, maar als ik er :reply/:noreply van maak werkt het niet meer. Weet jij wat ik hier zou moeten teruggeven

core/systems/project/_assembly.ex Show resolved Hide resolved
endpoint
)
|> Ecto.Changeset.put_assoc(:node, project.root)
end)
|> EctoHelper.run(:auth, &update_auth/2)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this line necessary here?

{:ok, Repo.preload(project, :root)}
end)
|> Multi.insert(:storage_endpoint, fn %{project: project} ->
key = "project_node=#{project.root.id}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider this naming rule to be centralized somewhere, possibly in the Project.Private module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add project tabs and move components to tabs
2 participants