Files
ubicloud/views/project/token.erb
Jeremy Evans cb389c5144 Use Roda part plugin to simplify render calls with locals
This uses the new part plugin to simplify and optimize render
calls with locals.

```ruby
render(:template, locals: {foo: 'bar'})

part(:template, foo: 'bar')
```

This simplifies a large number of calls in Clover, since
rendering with locals is one of the most common method
calls in the templates.

The main advantage of this is simplicity, but the part method
is also more optimized, and will be even more optimized when
we upgrade to Ruby 3.4.

Diff best reviewed with:

```
git diff -b --color-words --word-diff-regex='\\w+|[^[:space:]]'
```
2025-01-31 09:47:06 -08:00

55 lines
1.9 KiB
Plaintext

<% @page_title = "#{@project_data[:name]} - Personal Access Tokens" %>
<%== part(
"components/page_header",
title: "Personal Access Tokens",
breadcrumbs: [%w[Projects /project], [@project_data[:name], @project_data[:path]], ["Personal Access Tokens", "#"]],
right_items: [<<-CREATE]
<form id="create-pat" action="#{@project_data[:path]}/token" role="form" method="POST">
#{csrf_tag("#{@project_data[:path]}/token")}
#{part("components/form/submit_button", text: "Create Token")}
</form>
CREATE
) %>
<div class="grid gap-6">
<div class="md:flex md:items-center md:justify-between pb-1 lg:pb-2">
<div class="min-w-0 flex-1">
Personal access tokens are both account-specific and project-specific. You can use a separate access control
entries for each token, but be aware that regardless of the access permissions of the token, requests made using
the token cannot exceed the access permissions of your account.
</div>
</div>
<%== part(
"components/table_card",
headers: ["ID", "Token", ""],
empty_state: {
icon: "hero-key",
title: "No personal access token",
description: "Get started with the API by creating a personal access token."
},
rows:
@tokens.map do |token|
[
[
[token.ubid, { link: "#{@project_data[:path]}/token/#{token.ubid}/access-control" }],
["pat-#{token.ubid}-#{token.key}", { revealable: true, copyable: true }],
[
"delete_button",
{
component: {
text: "Remove",
url: "#{@project_data[:path]}/token/#{token.ubid}",
confirmation: "delete token"
},
extra_class: "flex justify-end"
}
]
],
{ id: "token-#{token.ubid}" }
]
end
) %>
</div>