Skip to content

Commit

Permalink
feat: add display of scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ziinc committed Dec 19, 2023
1 parent 4f5ec92 commit 1897398
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .formatter.exs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Used by "mix format"
[
inputs: ["{mix,.formatter}.exs", "{config,lib}/**/*.{heex,ex,exs}"],
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{heex,ex,exs}"],
subdirectories: ["test", "priv/repo"],
import_deps: [
:ecto_sql,
Expand Down
17 changes: 11 additions & 6 deletions lib/logflare_web/live/access_tokens_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ defmodule LogflareWeb.AccessTokensLive do
<thead>
<tr>
<th class="p-2">Description</th>
<th class="p-2">Scope</th>
<th class="p-2">Created on</th>
<th class="p-2"></th>
</tr>
Expand All @@ -65,19 +66,23 @@ defmodule LogflareWeb.AccessTokensLive do
<%= for token <- @access_tokens do %>
<tr>
<td class="p-2">
<%= token.description %>
<span :for={scope <- String.split(token.scopes || "")}><%= scope %></span>
<span class="tw-text-sm">
<%= token.description %>
</span>
</td>
<td class="p-2">
<td>
<span :for={scope <- String.split(token.scopes || "")} class="badge badge-secondary"><%= scope %></span>
</td>
<td class="p-2 tw-text-sm">
<%= Calendar.strftime(token.inserted_at, "%d %b %Y, %I:%M:%S %p") %>
</td>
<td class="p-2">
<button :if={token.scopes =~ "public"} class="btn btn-secondary" phx-click={JS.dispatch("logflare:copy-to-clipboard", detail: %{text: token.token})} data-toggle="tooltip" data-placement="top" title="Copy to clipboard">
<button :if={token.scopes =~ "public"} class="btn btn-secondary btn-sm" phx-click={JS.dispatch("logflare:copy-to-clipboard", detail: %{text: token.token})} data-toggle="tooltip" data-placement="top" title="Copy to clipboard">
<i class="fa fa-clone" aria-hidden="true"></i> Copy
</button>
<button class="btn text-danger text-bold" data-confirm="Are you sure? This cannot be undone." phx-click="revoke-token" phx-value-token-id={token.id}>
Revoke
<button class="btn text-danger btn-sm" data-confirm="Are you sure? This cannot be undone." phx-click="revoke-token" phx-value-token-id={token.id} data-toggle="tooltip" data-placement="top" title="Revoke access token forever">
<i class="fa fa-trash" aria-hidden="true"></i> Revoke
</button>
</td>
</tr>
Expand Down

0 comments on commit 1897398

Please sign in to comment.