-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Data Table: Projects Automated Pipelines (#848)
* migrate automated pipelines table to use data table component * remove unused file * add test to ensure edit button is hidden when pipeline is disabled
- Loading branch information
1 parent
0f1cd0d
commit c910a05
Showing
6 changed files
with
85 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 0 additions & 74 deletions
74
app/views/projects/automated_workflow_executions/_automated_workflow_execution.html.erb
This file was deleted.
Oops, something went wrong.
123 changes: 66 additions & 57 deletions
123
app/views/projects/automated_workflow_executions/_table.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,73 @@ | ||
<div class="table-container relative overflow-x-auto" data-turbo-temporary> | ||
<table | ||
id="automated_workflow_executions" | ||
class=" | ||
w-full text-sm text-left rtl:text-right text-slate-500 dark:text-slate-400 | ||
dark:divide-slate-600 whitespace-nowrap | ||
" | ||
> | ||
<thead | ||
class=" | ||
text-slate-700 uppercase bg-slate-50 dark:bg-slate-700 dark:text-slate-400 | ||
whitespace-nowrap | ||
" | ||
> | ||
<tr> | ||
<th | ||
scope="col" | ||
class=" | ||
px-6 py-3 whitespace-nowrap text-left sticky left-0 bg-slate-50 | ||
dark:bg-slate-700 | ||
" | ||
> | ||
<%= t(:".headers.id") %> | ||
</th> | ||
<th scope="col" class="px-6 py-3 whitespace-nowrap text-left"> | ||
<%= t(:".headers.name") %> | ||
</th> | ||
<th scope="col" class="px-6 py-3 whitespace-nowrap text-left"> | ||
<%= t(:".headers.workflow_name") %> | ||
</th> | ||
<th scope="col" class="px-6 py-3 whitespace-nowrap text-left"> | ||
<%= t(:".headers.workflow_version") %> | ||
</th> | ||
<th scope="col" class="px-6 py-3 whitespace-nowrap text-left"> | ||
<%= t(:".headers.created_at") %> | ||
</th> | ||
<th scope="col" class="px-6 py-3 whitespace-nowrap text-left"> | ||
<%= t(:".headers.updated_at") %> | ||
</th> | ||
<th scope="col" class="px-6 py-3 whitespace-nowrap text-left"> | ||
<%= t(:".headers.status") %> | ||
</th> | ||
<th scope="col" class="px-6 py-3 whitespace-nowrap text-left sticky right-0"> | ||
<%= t(:".headers.actions") %> | ||
</th> | ||
</tr> | ||
</thead> | ||
<tbody | ||
class=" | ||
bg-white divide-y divide-slate-200 dark:bg-slate-800 dark:divide-slate-700 | ||
" | ||
> | ||
<%= render partial: "automated_workflow_execution", | ||
collection: @automated_workflow_executions %> | ||
</tbody> | ||
</table> | ||
<% if @automated_workflow_executions.count.positive? %> | ||
<%= viral_data_table(@automated_workflow_executions, id: "automated_workflow_executions") do |table| %> | ||
<% table.with_column(t(".headers.id"), | ||
sticky_key: :left | ||
) do |row| %> | ||
<%= row[:id] %> | ||
<% end %> | ||
<% table.with_column(t(".headers.name")) do |row| %> | ||
<%= row[:name] %> | ||
<% end %> | ||
<% table.with_column(t(".headers.workflow_name")) do |row| %> | ||
<%= row.metadata["workflow_name"] %> | ||
<% end %> | ||
<% table.with_column(t(".headers.workflow_version")) do |row| %> | ||
<%= row.metadata["workflow_version"] %> | ||
<% end %> | ||
<% table.with_column(t(".headers.created_at")) do |row| %> | ||
<%= local_time(row[:created_at], :full_date) %> | ||
<% end %> | ||
<% table.with_column(t(".headers.updated_at")) do |row| %> | ||
<%= local_time_ago(row[:updated_at]) %> | ||
<% end %> | ||
<% table.with_column(t(".headers.status")) do |row| %> | ||
<% if row[:disabled] %> | ||
<%= viral_pill(text: t(".disabled"), color: "red") %> | ||
<% else %> | ||
<%= viral_pill(text: t(".enabled"), color: "green") %> | ||
<% end %> | ||
<% end %> | ||
<% table.with_column(t(".headers.actions"), | ||
sticky_key: :right | ||
) do |row| %> | ||
<% unless row.disabled %> | ||
<%= link_to( | ||
t(:"projects.automated_workflow_executions.actions.edit_button"), | ||
edit_namespace_project_automated_workflow_execution_path( | ||
@project.parent, | ||
@project, | ||
row, | ||
), | ||
data: { | ||
turbo_stream: true, | ||
}, | ||
class: | ||
"font-medium text-blue-600 underline dark:text-blue-500 hover:no-underline cursor-pointer", | ||
) %> | ||
<% end %> | ||
<%= link_to( | ||
t(:"projects.automated_workflow_executions.actions.delete_button"), | ||
namespace_project_automated_workflow_execution_path( | ||
@project.parent, | ||
@project, | ||
row, | ||
), | ||
data: { | ||
turbo_method: :delete, | ||
turbo_confirm: | ||
t(:"projects.automated_workflow_executions.actions.delete_confirm"), | ||
}, | ||
class: | ||
"font-medium text-blue-600 underline dark:text-blue-500 hover:no-underline cursor-pointer", | ||
) %> | ||
<% end %> | ||
<% end %> | ||
<% else %> | ||
<div class="empty_state_message"> | ||
<%= viral_empty( | ||
title: t(:".empty.title"), | ||
description: t(:".empty.description"), | ||
icon_name: :document_text, | ||
) %> | ||
</div> | ||
</div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters