Implement complete file manager keyboard shortcuts and copy functionality

Core Features:
- Full Ctrl+C/X/V/Z keyboard shortcuts system for file operations
- Real SSH file copy functionality supporting both files and directories
- Smart filename conflict resolution with timestamp-based naming
- Enhanced UX with detailed toast feedback and operation status

Technical Improvements:
- Remove complex file existence checks to prevent SSH connection hanging
- Optimize cp command with -fpr flags for non-interactive execution
- 20-second timeout mechanism for quick error feedback
- Comprehensive error handling and logging system

Keyboard Shortcuts System:
- Ctrl+A: Select all files (fixed text selection conflicts)
- Ctrl+C: Copy files to clipboard
- Ctrl+X: Cut files to clipboard
- Ctrl+V: Paste files (supports both copy and move operations)
- Ctrl+Z: Undo operations (basic framework)
- Delete: Delete selected files
- F2: Rename files

User Experience Enhancements:
- Smart focus management ensuring shortcuts work properly
- Fixed multi-select right-click delete functionality
- Copy operations with auto-rename: file_copy_12345678.txt
- Detailed operation feedback and error messages

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
ZacharyZcR
2025-09-16 22:13:37 +08:00
parent bf166d602f
commit cae9097034
4 changed files with 378 additions and 10 deletions

View File

@@ -1136,6 +1136,30 @@ export async function deleteSSHItem(
}
}
export async function copySSHItem(
sessionId: string,
sourcePath: string,
targetDir: string,
hostId?: number,
userId?: string,
): Promise<any> {
try {
const response = await fileManagerApi.post("/ssh/copyItem", {
sessionId,
sourcePath,
targetDir,
hostId,
userId,
}, {
timeout: 60000, // 60秒超时因为文件复制可能需要更长时间
});
return response.data;
} catch (error) {
handleApiError(error, "copy SSH item");
throw error;
}
}
export async function renameSSHItem(
sessionId: string,
oldPath: string,