feat(connections): show database name in the connection list#1538
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dbe904409d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| case .database, .serviceName: | ||
| let trimmed = database.trimmingCharacters(in: .whitespaces) | ||
| return trimmed.isEmpty ? nil : trimmed |
There was a problem hiding this comment.
Use the Oracle service field in subtitles
For Oracle connections created through the form or URL import, the service name is stored in connection.oracleServiceName / additionalFields["oracleServiceName"] and database can remain empty; the Oracle driver also connects using that additional field. Treating .serviceName the same as .database here means those rows still render only the host, so two Oracle connections to different services on the same host remain indistinguishable despite the new feature.
Useful? React with 👍 / 👎.
Closes #1535.
Problem
Connections that share a name and host but target different databases render identically in the connection list, because the row subtitle only shows
host/host:port. The database is never displayed (though search already filters on it).Change
The row subtitle now reads
endpoint · database · via ssh. The connection name stays the primary label; the database is added as a secondary descriptor so same-name/same-host rows are distinguishable.The subtitle logic moved out of the SwiftUI view into pure computed properties on
DatabaseConnection, which made it unit-testable (it had zero tests before). The database segment is driver-aware viaPathFieldRole:db {index}when an index is set(+N more)viastays lastRow styling is unchanged: it already used the macOS two-line pattern (
.subheadline+.secondary, single line, middle truncation), which matches the HIG guidance for distinguishing similar rows.Tests
Added
DatabaseConnectionDisplayTests(13 cases) covering each branch: default/non-default port, empty database, file-based paths, Redis index present/absent, Oracle service name, MongoDB multi-host, SSH via ordering, and unknown type fallback.Notes
ExportableConnection.displaySubtitle(import-preview DTO) is left unchanged: it has no access toPathFieldRole, so a driver-unaware change there would be worse. Can follow up if that surface should show the database too.