fix(services): list the SSH configurations in the Docker connection dialog (#3570)

SshConfigSelect reads the settings window's staged ssh.configs unless given a list, and that list is empty outside the settings window, so the Docker connection dialog offered only None. The dialog now passes the live list; the None choice gets its Chinese text.

Closes #3535
This commit is contained in:
l0ng-ai
2026-11-15 23:51:21 +08:00
committed by GitHub
parent 937008a6fe
commit 1679d61a6a
4 changed files with 42 additions and 2 deletions
@@ -0,0 +1,37 @@
import { act, cleanup, render, screen } from "@testing-library/react";
import { afterEach, describe, expect, it } from "vitest";
import type { Settings } from "@/platform/ipc";
import { useProject } from "@/platform/project";
import { openConnectionDialog, ServicesDialogHost } from "./dialogs";
afterEach(() => {
cleanup();
useProject.setState({ settings: null });
});
describe("Docker connection dialog", () => {
it("offers the SSH configurations of Settings › Tools › SSH Configurations", () => {
const config = {
id: "ssh1",
name: "Build server",
host: "build-server",
port: 2222,
user: "ops",
auth: "openSsh",
keyFile: "",
saveSecret: false,
};
useProject.setState({ settings: { ssh: { configs: [config] } } as unknown as Settings });
render(<ServicesDialogHost />);
act(() =>
openConnectionDialog({
id: "c1",
name: "Docker",
endpoint: { kind: "tcp", host: "ssh://ops@build-server:2222", tlsCertDir: null },
} as never),
);
const picker = screen.getByRole("button", { name: /SSH configuration/ });
expect(picker.textContent).toContain("Build server");
expect(picker.textContent).not.toContain("missing");
});
});
+1
View File
@@ -234,6 +234,7 @@ function ConnectionDialog({ existing, onDone }: { existing?: DockerConnection; o
<SshConfigSelect
value={shown}
onChange={pickSsh}
configs={sshConfigs}
none="None — type the Engine API URL below"
aria-label="SSH configuration"
/>
+2 -1
View File
@@ -1883,5 +1883,6 @@
"No playful words: the status stays factual": "No playful words: the status stays factual",
"e.g. Reticulating splines…": "e.g. Reticulating splines…",
"New playful word": "New playful word",
"Restore Built-in Words": "Restore Built-in Words"
"Restore Built-in Words": "Restore Built-in Words",
"None — type the Engine API URL below": "None — type the Engine API URL below"
}
+2 -1
View File
@@ -8284,5 +8284,6 @@
"No playful words: the status stays factual": "没有趣味文字:状态只显示实际进展",
"e.g. Reticulating splines…": "例如:正在网格化样条曲线…",
"New playful word": "新的趣味文字",
"Restore Built-in Words": "恢复内置文字"
"Restore Built-in Words": "恢复内置文字",
"None — type the Engine API URL below": "无(在下方输入 Engine API URL)"
}