fix(usage): show edited connection names consistently across views

Prefer edited name over provider email/displayName in Providers and
Quota Tracker; surface the provider-sourced email/display as secondary
text. Keeps fallbacks for legacy or unnamed connections.

Closes #1699

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Emirhan
2026-06-17 10:11:12 +07:00
committed by decolua
co-authored by Cursor
parent 4078f36ced
commit df37bb3468
3 changed files with 33 additions and 9 deletions
@@ -57,6 +57,18 @@ function kiroMethodLabel(conn) {
return conn.authType === "api_key" ? "API Key" : "OAuth";
}
function getConnectionSecondaryLabel(connection) {
if (connection.name?.trim() && connection.email?.trim() && connection.name.trim() !== connection.email.trim()) {
return connection.email.trim();
}
if (connection.name?.trim() && connection.displayName?.trim() && connection.name.trim() !== connection.displayName.trim()) {
return connection.displayName.trim();
}
return null;
}
// Region is stored for builder-id/idc/api_key flows; social and imported flows
// omit it, so fall back to the region segment of the profileArn
// (arn:aws:codewhisperer:<region>:...).
@@ -918,6 +930,11 @@ export default function ProviderLimits() {
{getConnectionLabel(conn)}
</p>
) : null}
{getConnectionSecondaryLabel(conn) ? (
<p className="text-[11px] text-text-muted/80 truncate">
{getConnectionSecondaryLabel(conn)}
</p>
) : null}
{isCodex && (
<p className="text-[11px] text-text-muted truncate">
Reset eligible: {resetCreditCount}
@@ -21,11 +21,10 @@ export const QUOTA_SORT_OPTIONS = [
// ─── Pure helpers ─────────────────────────────────────────────────────────────
export function getConnectionLabel(connection) {
const isEmail = (value) =>
typeof value === "string" && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
if (isEmail(connection.email)) return connection.email;
if (isEmail(connection.name)) return connection.name;
return connection.name;
return connection.name?.trim()
|| connection.email?.trim()
|| connection.displayName?.trim()
|| null;
}
export function getConnectionQuotaRemaining(connection, quotaData) {