Skip to content
Open
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ and this project adheres to
[#4524](https://github.com/OpenFn/lightning/issues/4524)
- Copying api tokens doesn't work on unsecure non-localhost contexts
[PR#4551](https://github.com/OpenFn/lightning/pull/4551)
- Copy token button on the Personal Access Tokens page now shows a
'Copied!' tooltip on click and no longer causes the icon to flicker
[#2463](https://github.com/OpenFn/lightning/issues/2463)
- Fix AI assistant authorization for support users on projects with support
access enabled [#4571](https://github.com/OpenFn/lightning/issues/4571)

Expand Down
8 changes: 0 additions & 8 deletions lib/lightning_web/live/tokens_live/index.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ defmodule LightningWeb.TokensLive.Index do
alias Lightning.Accounts
alias Lightning.Policies.Permissions
alias Lightning.Policies.Users
alias Phoenix.LiveView.JS

on_mount {LightningWeb.Hooks, :assign_projects}

Expand Down Expand Up @@ -59,13 +58,6 @@ defmodule LightningWeb.TokensLive.Index do
|> put_flash(:info, "Token created successfully")}
end

@impl true
def handle_event("copy", _, socket) do
{:noreply,
socket
|> put_flash(:info, "Token copied successfully")}
end

defp get_api_tokens_for(user) do
Accounts.list_api_tokens(user)
end
Expand Down
28 changes: 17 additions & 11 deletions lib/lightning_web/live/tokens_live/index.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
Make sure to copy your token now as you will not be able to see it again.
</div>
</div>
<div class="flex rounded overflow-auto p-2 bg-gray-100 w-auto justify-between">
<div class="flex rounded overflow-hidden p-2 bg-gray-100 w-auto justify-between">
<input
type="text"
id="new_token"
Expand All @@ -45,17 +45,23 @@
disabled
/>

<button
id="copy"
type="button"
phx-hook="Copy"
phx-then={JS.push("copy")}
data-to="#new_token"
class="rounded-full bg-blue-100 p-2 text-indigo-700 shadow-xs hover:opacity-75"
<span
id="copy-token-tooltip"
phx-hook="Tooltip"
aria-label="Copy to clipboard"
data-hide-on-click="false"
>
<.icon name="hero-clipboard" class="h-5 w-5" />
<span class="sr-only">Copy</span>
</button>
<button
id="copy"
type="button"
phx-hook="Copy"
data-to="#new_token"
class="rounded-full bg-blue-100 p-2 text-indigo-700 shadow-xs hover:opacity-75"
>
<.icon name="hero-clipboard" class="h-5 w-5" />
<span class="sr-only">Copy to clipboard</span>
</button>
</span>
</div>
</div>
</div>
Expand Down