From c0e04d1a56cbc956ef25507b537dd48a91908045 Mon Sep 17 00:00:00 2001 From: William Mantly Date: Tue, 28 Jul 2026 20:40:39 -0400 Subject: [PATCH] Unify API-token UI: modal-based create, new Edit modal (#191) Continues the cross-app API-token UI unification (jump-host landed first). proxy already had the card grid and a description field, so this is a smaller diff: converts the always-visible inline create-form card into a "+ New Token" button + app.modal (matching the Add-Resource/Add-Host convention used stack-wide, per explicit direction to standardize on the modal-button approach rather than sso-manager-node's inline-card style), adds a net-new Edit modal (proxy's PUT /api-token/:id already fully supported it -- no route change needed), and replaces the static #secretModal with the same bare app.modal showToken()/copyFieldValue() pattern jump-host uses. Found and fixed a real timing bug along the way: the create flow's evalAJAX called app.modal.close() immediately before showToken() (which calls app.modal.open()) in the same synchronous tick. app.modal is a singleton, and close() immediately followed by open() collides with Bootstrap's hide-transition guard -- show() silently no-ops while _isTransitioning is still true from the just-started hide(), so the "secret revealed" modal never actually appeared after creating a token. Confirmed via a live click-through: the reveal modal stayed invisible (title set, `.show` class never added) with the close() call, and rendered correctly with it removed. Also fixed the same latent bug in jump-host's already-shipped v1.10.0 (submitApiToken() had the identical close()-then-open() sequence) and in sso-manager-node's directory.ejs (saveResource()'s OAuth-secret-reveal path, softened there by an intervening `await loadResources()` but not guaranteed race-free). Verified live: create -> reveal modal now appears correctly; Edit modal shows real created-by/on data, saves a description change, card refreshes. --- nodejs/views/profile.ejs | 227 ++++++++++++++++++++++++--------------- 1 file changed, 141 insertions(+), 86 deletions(-) diff --git a/nodejs/views/profile.ejs b/nodejs/views/profile.ejs index 0414cb0..165924c 100644 --- a/nodejs/views/profile.ejs +++ b/nodejs/views/profile.ejs @@ -102,43 +102,33 @@ - - -
-
-
-
New API Token - -
- -
-

A personal access token lets scripts and services call the proxy management API as you, with your permissions. Treat it like a password.

-
-
- - -
-
- - -
-
- - -
- -
-
-
-
+
- - -
-
-
{{ name }}
- {{ id_short }} +
+
+ API Tokens + + + +
+

A personal access token lets scripts and services call the proxy management API as you, with your permissions. Treat it like a password.

- {{ #description }}

{{ description }}

{{ /description }} -
-
Token ID
-
{{ id_short }}
-
Created
-
{{{ created_display }}}
-
Last used
-
{{{ last_used_display }}}
-
Expires
-
{{{ expires_display }}}
-
-
-