Skip to content

fix: show the SSH key name in SSH connection dropdowns - #1602

Open
susheelg1197 wants to merge 1 commit into
karanhudia:mainfrom
susheelg1197:fix/ssh-connection-key-name-in-dropdown
Open

susheelg1197 wants to merge 1 commit into
karanhudia:mainfrom
susheelg1197:fix/ssh-connection-key-name-in-dropdown

Conversation

@susheelg1197

@susheelg1197 susheelg1197 commented Nov 26, 2026 •

Copy link
Copy Markdown

Description

With two Remote Machines connections to the same server, each using its own SSH key (the setup from #1498 / discussion #109), the SSH Connection dropdown showed two identical entries, borg@host / Port 22. So under Repositories → Import Existing → Remote Client you couldn't tell which connection you were picking.

The friendly name in that setup is the connection's SSH key name (for example borgserver-repo1), which GET /ssh-keys/connections already returns as ssh_key_name. Each dropdown entry now shows it on its second line, before the port:

borg@borg.example.com
borgserver-repo1 • Port 22 • /backups
  • SshConnectionSelect (the shared picker used by the repository wizard's location and data-source steps and by Quick Start) gains an optional ssh_key_name and puts it in the secondary line. A connection without a key name shows exactly what it showed before.
  • The restore wizard's destination dropdown, which renders its own MenuItems, shows the key name the same way.
  • The SSHConnection interfaces in RepositoryWizard, RestoreWizard and WizardStepRestoreDestination declare the field the API already sends.

No backend change was needed.

Related Issue

Fixes #1601

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • 🎨 UI/UX improvement

Testing

  • I have added tests that prove my fix is effective or that my feature works: new src/components/shared/__tests__/SshConnectionSelect.test.tsx.
    • Two connections to borg@borg.example.com with keys borgserver-repo1 and borgserver-repo2 show different options. This test fails without the change.
    • A connection with no key name still shows Port 22 • /backups.
  • npm run typecheck, npm run lint (oxlint) and prettier --check on the changed files pass.
  • npx vitest run src/components: 2165 passed, 1 failed. The failure is WizardStepScheduleConfig > formats first run time with localeString inline, which fails the same way without this change; it looks tied to this machine's locale or timezone.
  • I have tested this locally in the running app: no. I didn't bring up the Docker stack, so there's no screenshot.

Checklist

  • I have read the CONTRIBUTING guidelines
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes (except the locale test above, which fails on main too)

Additional Context

I wrote this with an AI coding assistant (Claude Code), then reviewed the change myself and ran the checks above.


Note: By submitting this pull request, you agree that your contributions will be licensed under the GNU Affero General Public License v3.0 (AGPL-3.0), the same license as this project.

🤖 Generated with Claude Code

Visual regression report

Visual changes detected: 1 changed, 0 added, 0 removed, 1377 unchanged.
Report: https://docs.borgui.com/visual/reports/pr-1602/
Workflow run: https://github.com/karanhudia/borg-ui/actions/runs/46042878433

Changed files - `quick-start-agent-command-copying--without-clipboard-api--mobile.png` (0.13%)
New screenshots - None
Removed screenshots - None

Two connections to the same server with separate SSH keys looked the
same in the repository wizard's SSH Connection dropdown (and in the
restore and source pickers), since each entry showed only user@host and
the port. Each entry now also shows its SSH key's name, which the
connections API already returns, so the two can be told apart.

Fixes karanhudia#1601

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Improvements
    • SSH connection options now display the key name when available, making connections with the same username and host easier to distinguish.
    • Connections without a key name continue to show their port and available destination details.

SSH connection data now includes an optional key name. Connection options display that name when present, making connections to the same host and user distinguishable.

Changes: SSH Connection Labels

Layer / File(s) Summary
Connection data and option labels
frontend/src/components/RepositoryWizard.tsx, frontend/src/components/RestoreWizard.tsx, frontend/src/components/shared/SshConnectionSelect.tsx, frontend/src/components/shared/__tests__/SshConnectionSelect.test.tsx, frontend/src/components/wizard/WizardStepRestoreDestination.tsx
SSH connection types include an optional nullable ssh_key_name. Connection options show the key name before the port when present. Tests check that distinct key names appear and that a null key name is omitted.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: karanhudia

Merge Risk: Minimal · up to 295db

This change shows the SSH key name in the connection dropdowns so connections to the same server can be told apart. Connections without a key name display as before. The risk is minimal and the change is easy to revert.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title states the main change: the SSH key name is now shown in SSH connection dropdowns. It is a short, specific single sentence with a conventional fix: prefix. The changeset matches it: SshConne…
Description check Passed The description explains the problem (two same-host Remote Machines connections showed identical dropdown entries), the fix (ssh_key_name is shown before the port in the shared picker and the restore …
Linked Issues check Passed Issue #1601 requires that SSH connections to the same remote host be distinguishable in the repository import SSH Connection dropdown. At the reviewed head, SshConnectionSelect.tsx adds optional ssh_k…
Out of Scope Changes check Passed Changes are: (1) the shared SshConnectionSelect display and its summary interface, which implement #1601 directly; (2) a matching key-name line in the restore wizard destination dropdown in WizardStep…
Full details: Title check

Explanation

The title states the main change: the SSH key name is now shown in SSH connection dropdowns. It is a short, specific single sentence with a conventional fix: prefix. The changeset matches it: SshConnectionSelect and the restore wizard destination dropdown now display ssh_key_name on the secondary line, and the SSHConnection interfaces declare the field.

Full details: Description check

Explanation

The description explains the problem (two same-host Remote Machines connections showed identical dropdown entries), the fix (ssh_key_name is shown before the port in the shared picker and the restore destination dropdown), and the interface updates in RepositoryWizard, RestoreWizard and WizardStepRestoreDestination. It also lists the new tests and check results, so it relates directly to the changeset.

Full details: Linked Issues check

Explanation

Issue #1601 requires that SSH connections to the same remote host be distinguishable in the repository import SSH Connection dropdown. At the reviewed head, SshConnectionSelect.tsx adds optional ssh_key_name to SshConnectionSummary and builds the secondary line as [ssh_key_name, Port ${port}, mount_point || default_path] joined with ' • '. Two connections to the same user@host with different key names therefore render different option text. Connections without a key name keep the prior Port N • detail text. The issue names the friendly name as an example, and the PR uses that name. The author-reported SshConnectionSelect.test.tsx covers both cases; I did not run it. The change covers the Add Repository location and data-source steps through the shared picker. The required display is implemented. No coding requirement remains unmet.

Full details: Out of Scope Changes check

Explanation

Changes are: (1) the shared SshConnectionSelect display and its summary interface, which implement #1601 directly; (2) a matching key-name line in the restore wizard destination dropdown in WizardStepRestoreDestination.tsx, which shows the same connections and the same ambiguity; (3) ssh_key_name type declarations in RepositoryWizard.tsx and RestoreWizard.tsx, which match the field the API already returns; and (4) a new SshConnectionSelect.test.tsx that supports change (1). Change (2) reaches beyond the Add Repository flow named in the issue, but it applies the same fix to sibling connection pickers and does not alter unrelated behavior. No change lacks a connection to #1601.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit checks each key by name,
Two hosts now show they are not the same.
A bullet marks the key in view,
The port and path stay visible too.
No “null” appears beside the hare,
Clear choices hop from here to there.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: karanhudia/borg-ui
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: b8e3503
  • Layers: Repository YAML (base), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 48c8e28e-8b42-4c37-ac6b-491210aaf5d2
Commits

Reviewing files that changed from the base of the PR and between b8e3503 and 295dbff.

Files selected for processing: 5

  • frontend/src/components/RepositoryWizard.tsx
  • frontend/src/components/RestoreWizard.tsx
  • frontend/src/components/shared/SshConnectionSelect.tsx
  • frontend/src/components/shared/__tests__/SshConnectionSelect.test.tsx
  • frontend/src/components/wizard/WizardStepRestoreDestination.tsx

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

This branch has not been deployed

No deployments
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.

[Bug]: Remote connections indistinguishable in the "Add Repository" UI when targeting the same remote machine

1 participant