Skip to content

feat(playground): add copy button when creating an API key#896

Merged
leoguillaume merged 4 commits into
mainfrom
feat/playground-api-key-copy
Jun 4, 2026
Merged

feat(playground): add copy button when creating an API key#896
leoguillaume merged 4 commits into
mainfrom
feat/playground-api-key-copy

Conversation

@tibo-pdn
Copy link
Copy Markdown
Contributor

@tibo-pdn tibo-pdn commented May 29, 2026

Overview

This PR improves the user experience around API key creation in the playground.

When a new API key is created, the value is shown only once and cannot be retrieved again. The previous dialog displayed the key in a read-only text area and only offered an "I've copied the key" button that the user had to act on manually, which was error-prone (the key could easily be lost if not copied correctly).

What was done:

  • Redesigned the "API key created" dialog with a clearer layout (header with icon + title/description, an amber warning callout, the key in a tinted bordered panel, and a footer with actions).

  • Added a "Copy API key" button that copies the key to the clipboard and shows a success toast, removing the manual copy/paste step.

  • Replaced the manual "I've copied the key" action with a simple "Done" button to close the dialog.

  • Added a default expiration date of one year for newly created keys, capped at the configured maximum (auth_key_max_expiration_days) when one is set.

  • Reset the creation form after a key is created, keeping the default 1-year expiry pre-filled for the next key.

  • Users can copy the newly created API key in one click (with confirmation feedback).

  • The new key value remains visible/copyable until the dialog is dismissed.

  • New keys default to a 1-year expiration, capped at the configured maximum.

Breaking changes:

  • No breaking changes
  • This PR contains breaking changes (explain below)

Check lists

Review checklist

Before requesting a review, please take a moment to confirm that the following aspects have been considered and addressed. This section helps ensure the PR is ready for review, safe to merge, and deployable. If any items are left unchecked, please add a brief explanation for context.

  • Updated or added documentation — N/A, UI-only change in the playground.
  • Updated or added unit tests — N/A, presentational/UI logic only.
  • Updated or added integration tests — N/A, presentational/UI logic only.
  • No debug logs or commented-out code left
  • No secrets or environment variables committed in clear text
  • Code is linted and formatted using the project pre-commit hooks

Deployment checklist

For each of the following items, please confirm if the PR concerns the deployment of the changes:

  • Alembic migration has been generated — N/A
  • Configuration file has been modified — N/A
  • Environment variables have been modified — N/A

Additional Notes

The expiry default reuses the existing auth_key_max_expiration_days setting to make sure the proposed 1-year default never exceeds the configured maximum.

Changes are scoped to two files in the playground:

  • playground/app/features/keys/components/dialogs.py — redesigned dialog + copy button.
  • playground/app/features/keys/state.py — default 1-year expiry and form reset after creation.
  • Don't take into account the difference in theme

Before redesign:
Screenshot 2026-06-04 at 15 10 43

After redesign:
Screenshot 2026-05-29 at 14 42 49

@tibo-pdn tibo-pdn self-assigned this May 29, 2026
@tibo-pdn tibo-pdn force-pushed the feat/playground-api-key-copy branch from df45f99 to c6cc817 Compare June 4, 2026 13:04
@tibo-pdn tibo-pdn requested a review from leoguillaume June 4, 2026 13:14
@tibo-pdn tibo-pdn marked this pull request as ready for review June 4, 2026 13:16
@leoguillaume leoguillaume force-pushed the feat/playground-api-key-copy branch from a6ed323 to 0937771 Compare June 4, 2026 13:30
@leoguillaume leoguillaume merged commit f62dbce into main Jun 4, 2026
2 checks passed
@leoguillaume leoguillaume deleted the feat/playground-api-key-copy branch June 4, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants