mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-28 14:15:24 +00:00
feat: convert file manager into a plugin
This commit is contained in:
1 parent
b76da9ab52
commit
c85c1fdb86
259 files changed
+54155
-16791
No files matched your search
@@ -14,7 +14,6 @@ import {
|
||||
Server,
|
||||
Settings,
|
||||
Terminal,
|
||||
FolderSearch,
|
||||
Globe,
|
||||
Plus,
|
||||
MessagesSquare,
|
||||
@@ -67,11 +66,6 @@ function getSshActions(host: Host): {
|
||||
label: string;
|
||||
}[] {
|
||||
return [
|
||||
host.enableFileManager && {
|
||||
type: "files",
|
||||
icon: FolderSearch,
|
||||
label: "Files",
|
||||
},
|
||||
// --- tmux-monitor --- opt-in per host, off by default
|
||||
host.enableTerminal !== false &&
|
||||
host.enableTmuxMonitor && {
|
||||
|
||||
@@ -19,7 +19,6 @@ import { getTabType } from "./tab-registry";
|
||||
* not a meaningful part of an arrangement.
|
||||
*/
|
||||
const CORE_CAPTURABLE = new Set([
|
||||
"files",
|
||||
"tunnel",
|
||||
"tmux_monitor",
|
||||
"serial",
|
||||
@@ -51,7 +50,6 @@ const CORE_UNSAVED = new Set([
|
||||
"user-profile",
|
||||
"admin-settings",
|
||||
"split-screen",
|
||||
"sftp",
|
||||
]);
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,8 +23,6 @@ export interface TabShellCallbacks {
|
||||
) => void;
|
||||
closeTab: (tabId: string) => void;
|
||||
renameTab: (tabId: string, label: string) => void;
|
||||
openFileInEditor: (host: Host, path: string) => void;
|
||||
openFileManager: (host: Host, path?: string) => void;
|
||||
openTerminalTab: (host: Host, path?: string) => void;
|
||||
openRailView: (id: string) => void;
|
||||
/** Closes a rail view wherever it is shown, e.g. when its feature goes away. */
|
||||
@@ -85,7 +83,7 @@ export const useTabTypes = registry.useList;
|
||||
export const resetTabTypes = registry.reset;
|
||||
|
||||
/** Core tab types that are saved and reopened after login. */
|
||||
const CORE_PERSISTENT = new Set(["files", "tunnel"]);
|
||||
const CORE_PERSISTENT = new Set(["tunnel"]);
|
||||
/** Core tab types that hold a live session (close confirm, refresh). */
|
||||
const CORE_SESSION = new Set(["serial"]);
|
||||
/** Core tab types that restore without a host. */
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
/* eslint-disable react-refresh/only-export-components */
|
||||
import {
|
||||
Braces,
|
||||
FolderSearch,
|
||||
LayoutDashboard,
|
||||
LayoutGrid,
|
||||
LayoutPanelLeft,
|
||||
Network,
|
||||
ArrowLeftRight,
|
||||
Server,
|
||||
Settings,
|
||||
Usb,
|
||||
@@ -46,11 +44,6 @@ const LocalTerminal = lazy(() =>
|
||||
default: m.LocalTerminal,
|
||||
})),
|
||||
);
|
||||
const loadFileManager = () =>
|
||||
import("@/features/file-manager/FileManager").then((m) => ({
|
||||
default: m.FileManager,
|
||||
}));
|
||||
const FileManager = lazy(loadFileManager);
|
||||
const loadTmuxMonitor = () =>
|
||||
import("@/features/tmux-monitor/TmuxMonitor").then((m) => ({
|
||||
default: m.TmuxMonitor,
|
||||
@@ -71,11 +64,6 @@ const loadTunnelTab = () =>
|
||||
default: m.TunnelTab,
|
||||
}));
|
||||
const TunnelTab = lazy(loadTunnelTab);
|
||||
const SftpTransferTab = lazy(() =>
|
||||
import("@/features/sftp/SftpTransferTab").then((m) => ({
|
||||
default: m.SftpTransferTab,
|
||||
})),
|
||||
);
|
||||
const Serial = lazy(() =>
|
||||
import("@/features/serial/Serial").then((m) => ({
|
||||
default: m.Serial,
|
||||
@@ -100,7 +88,6 @@ const SshToolsPanel = lazy(() =>
|
||||
import("@/sidebar/SshToolsPanel").then((m) => ({ default: m.SshToolsPanel })),
|
||||
);
|
||||
const tabSurfaceLoaders: Partial<Record<TabType, () => Promise<unknown>>> = {
|
||||
files: loadFileManager,
|
||||
tmux_monitor: loadTmuxMonitor,
|
||||
tunnel: loadTunnelTab,
|
||||
};
|
||||
@@ -168,8 +155,6 @@ export function tabIcon(type: TabType) {
|
||||
return <LayoutDashboard className="size-3.5" />;
|
||||
case "local-terminal":
|
||||
return <TerminalSquare className="size-3.5" />;
|
||||
case "files":
|
||||
return <FolderSearch className="size-3.5" />;
|
||||
case "host-manager":
|
||||
return <Server className="size-3.5" />;
|
||||
case "user-profile":
|
||||
@@ -178,8 +163,6 @@ export function tabIcon(type: TabType) {
|
||||
return <Settings className="size-3.5" />;
|
||||
case "tunnel":
|
||||
return <Network className="size-3.5" />;
|
||||
case "sftp":
|
||||
return <ArrowLeftRight className="size-3.5" />;
|
||||
// --- tmux-monitor ---
|
||||
case "tmux_monitor":
|
||||
return <Layers className="size-3.5" />;
|
||||
@@ -293,32 +276,11 @@ export function renderTabContent(tab: Tab, context: TabRenderContext) {
|
||||
<LocalTerminal instanceId={tab.instanceId} isVisible={isVisible} />,
|
||||
);
|
||||
|
||||
case "files":
|
||||
if (!host)
|
||||
return (
|
||||
<EmptyState
|
||||
icon={FolderSearch}
|
||||
messageKey="fileManager.noHostSelected"
|
||||
/>
|
||||
);
|
||||
return withTabSuspense(
|
||||
<FileManager
|
||||
initialHost={hostToSSHHost(host)}
|
||||
initialFilePath={tab.initialFilePath}
|
||||
initialPath={tab.initialPath}
|
||||
isVisible={isVisible}
|
||||
onOpenTerminalTab={(path) => shell.openTerminalTab(host, path)}
|
||||
/>,
|
||||
);
|
||||
|
||||
case "tunnel":
|
||||
return withTabSuspense(
|
||||
<TunnelTab label={label} host={host} isVisible={isVisible} />,
|
||||
);
|
||||
|
||||
case "sftp":
|
||||
return withTabSuspense(<SftpTransferTab />);
|
||||
|
||||
// --- tmux-monitor ---
|
||||
case "tmux_monitor":
|
||||
return withTabSuspense(
|
||||
|
||||
Reference in new issue
Block a user