feat: save quick connect sessions as hosts (#1055)

This commit is contained in:
ZacharyZcR
2026-07-16 11:51:53 +08:00
committed by GitHub
parent 22124e1bc4
commit 287b0fa656
7 changed files with 201 additions and 29 deletions
+18
View File
@@ -122,6 +122,7 @@ import {
addOpenTab,
deleteOpenTab,
patchOpenTab,
createSSHHost,
getActiveSessions,
getUserPreferences,
type UserPreferences,
@@ -134,6 +135,7 @@ import { TransferMonitor } from "@/features/file-manager/TransferMonitor.tsx";
import { sshHostToHost } from "@/sidebar/HostManagerData";
import { resolveHostTabType } from "@/lib/host-connection-tabs";
import { changeAppLanguage } from "@/i18n/i18n";
import { quickConnectHostToPayload } from "@/sidebar/quick-connect-host";
function buildHostTree(
hosts: SSHHostWithStatus[],
@@ -1092,6 +1094,21 @@ export function AppShell({
openTab(host, type);
}
const saveQuickConnectHost = useCallback(
async (tab: Tab, host: Host) => {
try {
const savedHost = await createSSHHost(quickConnectHostToPayload(host));
await patchOpenTab(tab.instanceId, { hostId: savedHost.id });
await loadHosts();
toast.success(t("hosts.hostCreated"));
} catch (error) {
toast.error(t("hosts.failedToSave"));
throw error;
}
},
[loadHosts, t],
);
function openSerialTab(config: SerialConfig) {
const pseudoHost: Host = {
id: `serial-${Date.now()}`,
@@ -1877,6 +1894,7 @@ export function AppShell({
initialFilePath: path,
}),
renameTab,
saveQuickConnectHost,
),
tabNode,
tab.id,