fix(tui): summarize multiple connections as a count (#54054)

This commit is contained in:
Aiden Cline
2026-10-08 22:04:18 -05:00
committed by GitHub
Unverified
parent f5309982d0
commit eefe85d257
2 changed files with 8 additions and 5 deletions
@@ -77,10 +77,13 @@ export function credentialConnections(integration: IntegrationInfo) {
)
}
// A count keeps several long labels from squeezing the integration name off the row.
export function connectionSummary(integration: IntegrationInfo) {
return integration.connections
.map((connection) => (connection.type === "credential" ? connection.label : `$${connection.name}`))
.join(", ")
const connections = integration.connections
if (connections.length > 1) return `${connections.length} connections`
const connection = connections[0]
if (!connection) return ""
return connection.type === "credential" ? connection.label : `$${connection.name}`
}
export function DialogIntegration(
@@ -76,7 +76,7 @@ describe("credentialConnections", () => {
})
describe("connectionSummary", () => {
test("shows credential labels and environment variables", () => {
test("counts several connections", () => {
expect(
connectionSummary(
integration({
@@ -88,6 +88,6 @@ describe("connectionSummary", () => {
],
}),
),
).toBe("Work, $EXAMPLE_KEY")
).toBe("2 connections")
})
})