mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-28 14:15:24 +00:00
feat: reconnect all disconnected terminal tabs (#1523)
This commit is contained in:
1 parent
5860921cbe
commit
e161ad22e0
12 files changed
+265
-17
No files matched your search
@@ -53,6 +53,7 @@ import {
|
||||
} from "@/shell/split/EmptyPanePicker";
|
||||
import { renderTabContent } from "@/shell/tabUtils";
|
||||
import { TabBar } from "@/shell/TabBar";
|
||||
import { reconnectDisconnectedTabs } from "@/shell/reconnect-tabs";
|
||||
import {
|
||||
dispatchCtrlW,
|
||||
createCommandPaletteShortcutMatcher,
|
||||
@@ -1796,6 +1797,24 @@ export function AppShell({
|
||||
});
|
||||
}
|
||||
|
||||
const reconnectAllRef = useRef<() => void>(() => {});
|
||||
function reconnectAllDisconnected() {
|
||||
const { reconnected, failed } = reconnectDisconnectedTabs(tabsRef.current);
|
||||
if (reconnected || !failed)
|
||||
toast(
|
||||
t(
|
||||
reconnected
|
||||
? "nav.reconnectingTerminals"
|
||||
: "nav.noDisconnectedTerminals",
|
||||
{ count: reconnected },
|
||||
),
|
||||
);
|
||||
if (failed)
|
||||
toast.error(t("nav.reconnectTerminalsFailed", { count: failed }));
|
||||
}
|
||||
|
||||
reconnectAllRef.current = reconnectAllDisconnected;
|
||||
|
||||
function refreshTab(id: string) {
|
||||
const tab = tabs.find((t) => t.id === id);
|
||||
const handle = tab?.terminalRef?.current;
|
||||
@@ -2158,6 +2177,14 @@ export function AppShell({
|
||||
tabsRef.current.find((tab) => tab.id === activeTabIdRef.current),
|
||||
);
|
||||
const entries = [
|
||||
registerPaletteEntry({
|
||||
id: "core.reconnectDisconnected",
|
||||
titleKey: "nav.reconnectDisconnectedTerminals",
|
||||
icon: RotateCcw,
|
||||
keywords: ["reconnect", "disconnected", "ssh", "all", "network"],
|
||||
scope: "global",
|
||||
run: () => reconnectAllRef.current(),
|
||||
}),
|
||||
registerPaletteEntry({
|
||||
id: "core.split.right",
|
||||
titleKey: "splitScreen.splitRight",
|
||||
@@ -2995,6 +3022,7 @@ export function AppShell({
|
||||
onSetActiveTab={setActiveTabId}
|
||||
onCloseTab={closeTab}
|
||||
onRefreshTab={refreshTab}
|
||||
onReconnectDisconnected={reconnectAllDisconnected}
|
||||
onReorderTabs={reorderTopLevelTabs}
|
||||
onSplitAction={handleTabSplitAction}
|
||||
onRenameTab={renameTab}
|
||||
|
||||
Reference in new issue
Block a user