From 4276c043c66e66fdfc0ba4e0ce2a4ae471a818fe Mon Sep 17 00:00:00 2001 From: viettranx Date: Tue, 24 Mar 2026 20:45:54 +0700 Subject: [PATCH] fix(ui): scope API key create dialog to current tenant only Owner sees only "System" + current tenant in dropdown (not all tenants). Default selection is current tenant instead of system. --- .../src/pages/api-keys/api-key-create-dialog.tsx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/ui/web/src/pages/api-keys/api-key-create-dialog.tsx b/ui/web/src/pages/api-keys/api-key-create-dialog.tsx index a3d0ab0e..002784d1 100644 --- a/ui/web/src/pages/api-keys/api-key-create-dialog.tsx +++ b/ui/web/src/pages/api-keys/api-key-create-dialog.tsx @@ -50,11 +50,9 @@ interface Props { export function ApiKeyCreateDialog({ open, onOpenChange, onCreate }: Props) { const { t } = useTranslation("api-keys"); - const { isOwner, tenants, currentTenantId } = useTenants(); + const { isOwner, currentTenantId, currentTenantName } = useTenants(); - const defaultTenant = isOwner - ? currentTenantId || SYSTEM_TENANT - : SYSTEM_TENANT; + const defaultTenant = currentTenantId || SYSTEM_TENANT; const [name, setName] = useState(""); const [scopes, setScopes] = useState([]); @@ -132,11 +130,11 @@ export function ApiKeyCreateDialog({ open, onOpenChange, onCreate }: Props) { {t("form.tenantSystem")} - {tenants.map((tenant) => ( - - {tenant.name} + {currentTenantId && ( + + {currentTenantName || currentTenantId} - ))} + )}