From 8da88b906b8fc49d7c50be16a1a53da1025d7250 Mon Sep 17 00:00:00 2001 From: LukeGus Date: Thu, 29 Oct 2026 13:24:01 -0500 Subject: [PATCH] feat: shell can open a saved host's editor for plugins (Plugin-SSH-Terminal#36) --- packages/plugin-sdk/CHANGELOG.md | 1 + packages/plugin-sdk/src/frontend.ts | 2 ++ src/ui/shell/controller/ShellControllerProvider.tsx | 5 +++++ src/ui/shell/tab-registry.ts | 2 ++ 4 files changed, 10 insertions(+) diff --git a/packages/plugin-sdk/CHANGELOG.md b/packages/plugin-sdk/CHANGELOG.md index 10f37b08f..b8b14ad14 100644 --- a/packages/plugin-sdk/CHANGELOG.md +++ b/packages/plugin-sdk/CHANGELOG.md @@ -12,6 +12,7 @@ Plugin API 1.13.0. - SSH transport providers get the host's owner, sync id, connection origin and local only flag in `claims` and `open`, and core's SSH relay takes a `syncId` instead of a host id - `ctx.sync.host.entities.idsOf` maps sync ids to the local ids of the user's own rows of one type - Rail items take `useStatus` for a small ok, warning or error dot on the icon +- `shell.editHost(hostId)` opens the editor of a saved host ### Fixed diff --git a/packages/plugin-sdk/src/frontend.ts b/packages/plugin-sdk/src/frontend.ts index 2d3d2a3dc..a263b1974 100644 --- a/packages/plugin-sdk/src/frontend.ts +++ b/packages/plugin-sdk/src/frontend.ts @@ -206,6 +206,8 @@ export interface ShellApi { * user reviews and saves it. Absent in some shells. */ openHostEditor?: (draft?: HostDraft) => void; + /** Opens the editor of a saved host. Termix 26.10.6+, absent in some shells. */ + editHost?: (hostId: number) => void; /** Opens a rail view in the left sidebar. */ openRailView: (id: string) => void; /** Closes a rail view wherever it is shown. */ diff --git a/src/ui/shell/controller/ShellControllerProvider.tsx b/src/ui/shell/controller/ShellControllerProvider.tsx index 1354fb953..025895e94 100644 --- a/src/ui/shell/controller/ShellControllerProvider.tsx +++ b/src/ui/shell/controller/ShellControllerProvider.tsx @@ -173,6 +173,10 @@ export function ShellControllerProvider({ }, openHostEditor: (draft) => requestManage({ kind: "host", hostId: null, draft }), + editHost: (hostId) => { + requestManage({ kind: "host", hostId }); + if (isMobile) regions.left.setOpen(false); + }, saveQuickConnect: tabsState.saveQuickConnectHost, confirm: (options) => confirmRef.current ? confirmRef.current(options) : Promise.resolve(false), @@ -196,6 +200,7 @@ export function ShellControllerProvider({ closeRailView: (...args) => shellImplRef.current.closeRailView(...args), openHostEditor: (...args) => shellImplRef.current.openHostEditor?.(...args), + editHost: (...args) => shellImplRef.current.editHost?.(...args), saveQuickConnect: (...args) => shellImplRef.current.saveQuickConnect!(...args), confirm: (...args) => shellImplRef.current.confirm!(...args), diff --git a/src/ui/shell/tab-registry.ts b/src/ui/shell/tab-registry.ts index f820cccbf..72376a6ee 100644 --- a/src/ui/shell/tab-registry.ts +++ b/src/ui/shell/tab-registry.ts @@ -33,6 +33,8 @@ export interface TabShellCallbacks { closeRailView: (id: string) => void; /** Opens the host editor for a new host with these fields filled in. */ openHostEditor?: (draft?: HostDraft) => void; + /** Opens the editor of a saved host. */ + editHost?: (hostId: number) => void; /** Saves a quick-connect tab's host. Core terminal only. */ saveQuickConnect?: (tab: Tab, host: Host) => Promise; /** Asks a yes or no question over the main area. */