Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions app/models/move.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,12 @@ def executed?
executed_at?
end

def previous_moves
return nil unless step&.previous_step
def previous_step_moves
step&.previous_step&.moves
end

step.previous_step.moves
def previous_moves
moves_project&.moves&.where(step: step.previous_steps)
end

def refresh_prev_data
Expand Down
62 changes: 39 additions & 23 deletions app/views/moves/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,24 @@
<%= render List::DataTableComponent.new(decorate(@moves)) do |table| %>
<% table.with_column(Server.model_name.human) do |move| %>
<%= link_to move.moveable, server_path(move.moveable), data: { turbo_frame: :_top } %>
<span data-controller="tooltip"
data-bs-placement="top"
title="<%= l(move.executed_at) if move.executed_at.present? %>">
<%= render move.decorated.status_to_badge_component %>
</span>

<div class="small">
<span class="fw-light text-body-secondary"><%= Server.human_attribute_name(:numero) %> :</span>
<span class="font-monospace text-body"><%= move.moveable.numero %></span>
</div>
<% end %>

<% table.with_column(Manager.model_name.human) do |move| %>
<%= move.moveable.manager %>
<% end %>

<% table.with_column(Domain.model_name.human) do |move| %>
<%= move.moveable.domain %>
<div class="small">
<span class="fw-light text-body-secondary">Gestionnaire :</span>
<span class="font-monospace text-body"><%= move.moveable.manager %></span>
</div>
<div class="small">
<span class="fw-light text-body-secondary">Domaine :</span>
<span class="font-monospace text-body"><%= move.moveable.domain %></span>
</div>
<% end %>

<% table.with_column(Move.human_attribute_name(:prev_frame_id)) do |move| %>
Expand All @@ -58,6 +64,17 @@
<span class="fw-light text-body-secondary"><%= Server.human_attribute_name(:position) %> :</span>
<span class="font-monospace"><%= move.prev_position %></span>
</div>

<%= link_to "#",
class: "",
data: { turbo_frame: :_top } do %>
<span class="bi bi-diagram-3-fill"
aria-hidden="true"
data-controller="tooltip"
data-bs-placement="left"
title="<%= t("visualization.title") %>"></span>
<span class="visually-hidden"><%= t("visualization.title") %></span>
<% end %>
<% end %>

<% table.with_column(Move.human_attribute_name(:frame_id)) do |move| %>
Expand All @@ -69,27 +86,33 @@
controller: "tooltip",
bs_placement: "top",
} %>
-
<%= link_to "#",
class: "",
data: { turbo_frame: :_top } do %>
<span class="bi bi-diagram-3-fill"
aria-hidden="true"
data-controller="tooltip"
data-bs-placement="left"
title="<%= t("visualization.title") %>"></span>
<span class="visually-hidden"><%= t("visualization.title") %></span>
<% end %>
<div class="small">
<span class="fw-light text-body-secondary"><%= Server.human_attribute_name(:position) %> :</span>
<span class="font-monospace"><%= move.position %></span>
</div>
<% end %>

<% table.with_column(Move.human_attribute_name(:status)) do |move| %>
<span data-controller="tooltip"
data-bs-placement="top"
title="<%= l(move.executed_at) if move.executed_at.present? %>">
<%= render move.decorated.status_to_badge_component %>
</span>
<% end %>

<% table.with_column(t(".remove_existing_connections_on_execution"), text_align: :center) do |move| %>
<%= render move.moved_connections_to_badge_component %>
<% end %>

<% table.with_column(style: "min-width: 120px; width: 120px") do |move| %>
<div class="btn-group btn-group-sm" role="group" aria-label="...">
<% unless @moves_project.archived? || move.executed? %>
<%= link_to "Modifier les connexions", "#",
class: "btn btn-outline-primary",
aria: { hidden: true } %>
<%= link_to t("action.execute"),
execute_moves_project_step_move_path(@moves_project_step, move),
title: t(".action.execute_move"),
Expand Down Expand Up @@ -148,13 +171,6 @@
</td>
<td class="d-flex justify-content-center column-gap-1">
<div class="btn-group btn-group-sm" role="group" aria-label="...">
<% if @moves_project.unarchived? %>
<%= link_to t(".edit_connections"),
frame_moves_project_moves_project_step_path(@moves_project, @moves_project_step, frame),
class: "btn btn-outline-primary text-nowrap",
data: { turbo_frame: :_top } %>
<% end %>

<%= link_to print_moves_project_moves_project_step_path(@moves_project, @moves_project_step, frame),
class: "btn btn-sm btn-outline-primary",
data: { turbo_frame: :_top },
Expand Down
18 changes: 0 additions & 18 deletions app/views/moves_projects/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -90,24 +90,6 @@
<% end %>
</div>
<% end %>

<% if @moves_project.steps.any? %>
<%= turbo_frame_tag(
dom_id(Move, :frames),
loading: :lazy,
src: moves_project_step_moves_path(@moves_project.steps.last),
class: "pt-4",
) do %>
<div class="w-100 d-flex justify-content-center align-items-center gap-3">
<span role="status"><%= t("has_many_turbo_frame_component.loading") %></span>
<span class="spinner-grow text-<%= @type %>" aria-hidden="true"></span>
</div>
<% end %>
<% else %>
<div class="col-12">
<%= render CardEmptyDataComponent.new %>
</div>
<% end %>
</div>

<div class="pt-4">
Expand Down
Loading