diff --git a/src/ui/plugin-host/frame-host.tsx b/src/ui/plugin-host/frame-host.tsx index 9ee0d91a8..2ae2db0c0 100644 --- a/src/ui/plugin-host/frame-host.tsx +++ b/src/ui/plugin-host/frame-host.tsx @@ -20,6 +20,7 @@ import { getTabType, type TabRenderProps } from "@/shell/tab-registry"; import { getPanel } from "@/shell/panel-registry"; import { getSSHHosts } from "@/main-axios"; import { sshHostToHost } from "@/sidebar/HostManagerData"; +import { hostToSSHHost } from "@/lib/host-to-ssh-host"; import type { Host, Tab } from "@/types/ui-types"; import { createPluginApp } from "./app"; import { installPluginHostBridge } from "./bridge"; @@ -150,6 +151,11 @@ function FrameBody({ key={`${view.view}:${view.hostId ?? ""}:${version}`} tab={record} host={host} + sshHost={ + host + ? (hostToSSHHost(host) as unknown as Record) + : undefined + } label={view.view} isVisible isFocusedPane diff --git a/src/ui/tests/plugin-host/frame-host.test.tsx b/src/ui/tests/plugin-host/frame-host.test.tsx index aa84e9cd3..eaaf09d4a 100644 --- a/src/ui/tests/plugin-host/frame-host.test.tsx +++ b/src/ui/tests/plugin-host/frame-host.test.tsx @@ -6,7 +6,14 @@ import type { PluginSummary } from "@/api/plugins-api"; vi.mock("@/main-axios", async (importOriginal) => ({ ...(await importOriginal()), getSSHHosts: vi.fn(async () => [ - { id: 7, name: "web-01", ip: "10.0.0.7", port: 22, username: "root" }, + { + id: 7, + name: "web-01", + ip: "10.0.0.7", + port: 22, + username: "root", + pluginSettings: { gizmo: { enableGizmo: true } }, + }, ]), })); @@ -59,8 +66,19 @@ function Home() { ); } -function HostView({ host }: { host?: { name: string } }) { - return

host view: {host?.name ?? "none"}

; +function HostView({ + host, + sshHost, +}: { + host?: { name: string }; + sshHost?: { pluginSettings?: { gizmo?: { enableGizmo?: boolean } } }; +}) { + const on = sshHost?.pluginSettings?.gizmo?.enableGizmo === true; + return ( +

+ host view: {host?.name ?? "none"} {on ? "on" : "off"} +

+ ); } const module = { @@ -159,7 +177,7 @@ describe("startPluginFrame", () => { shell: makeShell(), }), ); - await waitFor(() => screen.getByText("host view: web-01")); + await waitFor(() => screen.getByText("host view: web-01 on")); act(() => frame!.setView({ view: "gizmo-home" })); await waitFor(() => screen.getByText("hosts: web-01")); act(() => frame!.setTheme({ id: "nord", mode: "dark" }));