Files
ubicloud/views/github/cache.erb
Enes Cakir 31ae88bc3b Add default url values to delete button component
Almost half of the `delete_button` instances use `request.path` for
`url` or `redirect`. By adding default values to them, we can remove
bunch of lines.
2024-11-07 12:33:25 +03:00

79 lines
3.5 KiB
Plaintext

<% @page_title = "GitHub Runners" %>
<div class="space-y-1">
<%== render(
"components/breadcrumb",
locals: {
back: @project_data[:path],
parts: [%w[Projects /project], [@project_data[:name], @project_data[:path]], ["GitHub Runners", "#{@project_data[:path]}/github"], ["Caches", "#"]]
}
) %>
<%== render("components/page_header", locals: { title: "GitHub Runner Integration" }) %>
</div>
<%== render("github/tabbar") %>
<div class="grid gap-6">
<div class="overflow-hidden rounded-lg shadow ring-1 ring-black ring-opacity-5 bg-white divide-y divide-gray-200">
<table class="min-w-full divide-y divide-gray-300">
<% if @total_usage %>
<thead class="bg-gray-50 whitespace-nowrap">
<tr>
<th scope="col" class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6" colspan="2"><%= @entries.count %> cache entries</th>
<th scope="col" class="relative py-3.5 pl-3 pr-4 text-right text-sm font-semibold text-gray-900 sm:pr-6" colspan="3"><%= @total_usage %> used of <%= @total_quota %></th>
</tr>
</thead>
<% end %>
<tbody class="divide-y divide-gray-200 bg-white">
<% if @entries.count > 0 %>
<% @entries.each do |entry| %>
<tr id="entry-<%= entry[:id]%>">
<td class="py-3 pl-4 pr-3 text-sm sm:pl-6" scope="row">
<div class="font-medium text-gray-900"><%= entry[:key] %></div>
<div class="mt-1 text-gray-500 text-xs ">created <span title="<%= entry[:created_at] %>"><%= entry[:created_at_human] %></span></div>
</td>
<td class="whitespace-nowrap px-3 py-3 text-sm text-gray-500">
<div><%= entry[:scope] %></div>
<div class="mt-1 text-gray-500 text-xs"><%= entry[:repository_name] %></div>
</td>
<td class="whitespace-nowrap px-3 py-3 text-sm text-gray-500">
<div class="inline-flex items-baseline rounded-md px-2 text-xs font-medium leading-5 bg-slate-100 text-slate-800" title="<%= entry[:size] %> bytes">
<%= entry[:size_human] %>
</div>
</td>
<td class="whitespace-nowrap px-3 py-3 text-sm text-gray-500">
<% if entry[:last_accessed_at] %>
<div>Last used</div>
<div title="<%= entry[:last_accessed_at] %>"> <%= entry[:last_accessed_at_human] %></div>
<% else %>
<div>Never used</div>
<% end %>
</td>
<td class="whitespace-nowrap py-3 pl-3 pr-4 text-sm text-right">
<%== render(
"components/delete_button",
locals: {
url: "#{@project_data[:path]}/github/cache/#{entry[:id]}",
text: ""
}
) %>
</td>
</tr>
<% end %>
<% else %>
<tr>
<td colspan="6">
<div class="text-center py-4 px-8 lg:px-32">
<h3 class="text-xl leading-10 font-medium mb-2">No cache entries</h3>
<p class="leading-6">
Check out <a href="https://www.ubicloud.com/docs/github-actions-integration/ubicloud-cache" class="text-orange-500 font-medium">our documentation</a> to use Ubicloud Cache for faster caching.
</p>
</div>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>