Skip to content

feat(connections): show database name in the connection list#1538

Merged
datlechin merged 2 commits into
mainfrom
feat/issue-1535-db-name-in-list
Jun 1, 2026
Merged

feat(connections): show database name in the connection list#1538
datlechin merged 2 commits into
mainfrom
feat/issue-1535-db-name-in-list

Conversation

@datlechin
Copy link
Copy Markdown
Member

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 via PathFieldRole:

  • Relational and unknown future types: database name after the host
  • Redis: db {index} when an index is set
  • SQLite/DuckDB: file path only (host is empty, so no duplication)
  • Oracle: service name
  • MongoDB replica sets: host count (+N more)
  • SSH via stays last

Row 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 to PathFieldRole, so a driver-unaware change there would be worse. Can follow up if that surface should show the database too.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +38 to +40
case .database, .serviceName:
let trimmed = database.trimmingCharacters(in: .whitespaces)
return trimmed.isEmpty ? nil : trimmed
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@datlechin datlechin merged commit d5b62be into main Jun 1, 2026
4 checks passed
@datlechin datlechin deleted the feat/issue-1535-db-name-in-list branch June 1, 2026 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add database name in connections list

1 participant