diff --git a/src/ui/Desktop/Apps/File Manager/FileManagerModern.tsx b/src/ui/Desktop/Apps/File Manager/FileManagerModern.tsx index 85eaebbf..bf43d7c6 100644 --- a/src/ui/Desktop/Apps/File Manager/FileManagerModern.tsx +++ b/src/ui/Desktop/Apps/File Manager/FileManagerModern.tsx @@ -111,7 +111,23 @@ export function FileManagerModern({ initialHost, onClose }: FileManagerModernPro try { setIsLoading(true); - const sessionId = await connectSSH(currentHost.id); + // 使用主机ID作为会话ID + const sessionId = currentHost.id.toString(); + + // 调用connectSSH建立连接 + await connectSSH(sessionId, { + hostId: currentHost.id, + ip: currentHost.ip, + port: currentHost.port, + username: currentHost.username, + password: currentHost.password, + sshKey: currentHost.key, + keyPassword: currentHost.keyPassword, + authType: currentHost.authType, + credentialId: currentHost.credentialId, + userId: currentHost.userId + }); + setSshSessionId(sessionId); } catch (error: any) { toast.error(t("fileManager.failedToConnect")); @@ -286,6 +302,24 @@ export function FileManagerModern({ initialHost, onClose }: FileManagerModernPro toast.success(t("fileManager.filesCutToClipboard", { count: files.length })); } + function handlePasteFiles() { + if (!clipboard || !sshSessionId) return; + + // TODO: 实现粘贴功能 + // 这里需要根据剪贴板操作类型(copy/cut)来执行相应的操作 + toast.info("粘贴功能正在开发中..."); + } + + function handleRenameFile(file: FileItem) { + if (!sshSessionId) return; + + const newName = prompt(t("fileManager.enterNewName"), file.name); + if (!newName || newName === file.name) return; + + // TODO: 实现重命名功能 + toast.info("重命名功能正在开发中..."); + } + // 过滤文件 const filteredFiles = files.filter(file => file.name.toLowerCase().includes(searchQuery.toLowerCase()) @@ -379,6 +413,16 @@ export function FileManagerModern({ initialHost, onClose }: FileManagerModernPro {t("fileManager.newFolder")} + +