mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-16 05:01:03 +03:00
fix(tui): summarize multiple connections as a count (#54054)
This commit is contained in:
committed by
GitHub
Unverified
parent
f5309982d0
commit
eefe85d257
@@ -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")
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user