2022-11-24 14:31:16 -05:00
|
|
|
<div class="mx-auto flex flex-col justify-center items-start space-y-4 max-w-3xl">
|
|
|
|
<h1 class="text-xl">
|
|
|
|
<%= gettext("pipelines") %>
|
|
|
|
</h1>
|
|
|
|
|
|
|
|
<.form
|
|
|
|
:let={f}
|
|
|
|
for={:search}
|
|
|
|
phx-change="search"
|
|
|
|
phx-submit="search"
|
|
|
|
class="self-stretch flex flex-col items-stretch"
|
|
|
|
>
|
|
|
|
<%= text_input(f, :search_term,
|
|
|
|
class: "input input-primary",
|
|
|
|
value: @search,
|
|
|
|
phx_debounce: 300,
|
|
|
|
placeholder: gettext("search")
|
|
|
|
) %>
|
|
|
|
</.form>
|
|
|
|
|
|
|
|
<%= if @pipelines |> Enum.empty?() do %>
|
|
|
|
<h1 class="self-center text-primary-500">
|
|
|
|
<%= gettext("no pipelines found") %>
|
|
|
|
</h1>
|
|
|
|
<% else %>
|
|
|
|
<.live_component
|
|
|
|
module={MemexWeb.Components.PipelinesTableComponent}
|
|
|
|
id="pipelines-index-table"
|
|
|
|
current_user={@current_user}
|
|
|
|
pipelines={@pipelines}
|
|
|
|
>
|
|
|
|
<:actions :let={pipeline}>
|
2022-11-24 17:15:10 -05:00
|
|
|
<%= if is_owner?(pipeline, @current_user) do %>
|
2022-11-24 14:31:16 -05:00
|
|
|
<.link
|
2022-11-26 14:51:18 -05:00
|
|
|
patch={Routes.pipeline_index_path(@socket, :edit, pipeline.slug)}
|
2022-11-24 14:31:16 -05:00
|
|
|
data-qa={"pipeline-edit-#{pipeline.id}"}
|
|
|
|
>
|
|
|
|
<%= dgettext("actions", "edit") %>
|
|
|
|
</.link>
|
2022-11-24 17:15:10 -05:00
|
|
|
<% end %>
|
|
|
|
<%= if is_owner_or_admin?(pipeline, @current_user) do %>
|
2022-11-24 14:31:16 -05:00
|
|
|
<.link
|
|
|
|
href="#"
|
|
|
|
phx-click="delete"
|
|
|
|
phx-value-id={pipeline.id}
|
|
|
|
data-confirm={dgettext("prompts", "are you sure?")}
|
|
|
|
data-qa={"delete-pipeline-#{pipeline.id}"}
|
|
|
|
>
|
|
|
|
<%= dgettext("actions", "delete") %>
|
|
|
|
</.link>
|
|
|
|
<% end %>
|
|
|
|
</:actions>
|
|
|
|
</.live_component>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<%= if @current_user do %>
|
|
|
|
<.link patch={Routes.pipeline_index_path(@socket, :new)} class="self-end btn btn-primary">
|
|
|
|
<%= dgettext("actions", "new pipeline") %>
|
|
|
|
</.link>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
2022-07-25 20:12:11 -04:00
|
|
|
|
|
|
|
<%= if @live_action in [:new, :edit] do %>
|
|
|
|
<.modal return_to={Routes.pipeline_index_path(@socket, :index)}>
|
|
|
|
<.live_component
|
|
|
|
module={MemexWeb.PipelineLive.FormComponent}
|
|
|
|
id={@pipeline.id || :new}
|
2022-11-24 14:31:16 -05:00
|
|
|
current_user={@current_user}
|
2022-07-25 20:12:11 -04:00
|
|
|
title={@page_title}
|
|
|
|
action={@live_action}
|
|
|
|
pipeline={@pipeline}
|
|
|
|
return_to={Routes.pipeline_index_path(@socket, :index)}
|
|
|
|
/>
|
|
|
|
</.modal>
|
|
|
|
<% end %>
|