Skip to content

Sftpfix#2

Merged
joesdu merged 2 commits into
mainfrom
sftpfix
Jul 7, 2026
Merged

Sftpfix#2
joesdu merged 2 commits into
mainfrom
sftpfix

Conversation

@joesdu

@joesdu joesdu commented Jul 7, 2026

Copy link
Copy Markdown
Owner

No description provided.

joesdu added 2 commits July 7, 2026 11:43
本次提交显著扩展了SFTP文件管理器功能和交互体验,包括:
- 支持按名称、大小、权限、修改时间排序,目录优先,列头可点击切换升降序;
- 工具栏与右键菜单重构,支持新建文件/文件夹、下载、重命名、移动、复制路径/名称、属性等操作;
- 文件列表切换为ListBox,支持多选和双击进入目录;
- 新增属性弹窗、剪贴板复制、对话框输入等交互;
- ISftpService接口扩展,支持文件创建、重命名/移动、获取工作目录、关闭会话等;
- 新增“tools.files”命令(Ctrl+Shift+F),主窗口自动管理SFTP面板绑定与销毁;
- 单元测试覆盖所有新增功能;
- 代码风格和注释优化,.gitignore补充FodyWeavers.xsd。

整体提升了易用性、可维护性和现代化体验。
# Conflicts:
#	src/PulseTerm.App/ViewModels/MainWindowViewModel.cs
Copilot AI review requested due to automatic review settings July 7, 2026 04:11
@joesdu joesdu merged commit e947768 into main Jul 7, 2026
@joesdu joesdu deleted the sftpfix branch July 7, 2026 04:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds/finishes the SFTP file manager workflow by extending the SFTP service API, wiring UI commands/shortcuts, and expanding the file browser UI/VM behaviors (sorting, activation, context menu operations), with corresponding test coverage.

Changes:

  • Extend ISftpService/SftpService to support working directory discovery, empty-file creation, rename/move, and per-session SFTP channel teardown.
  • Add a “tools.files” command + Ctrl+Shift+F shortcut and update views to expose the SFTP file manager via menu and keybinding.
  • Upgrade the file browser UI/VM with sortable columns, double-click directory navigation, and right-click context actions; add/adjust unit tests accordingly.

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tests/PulseTerm.Core.Tests/Sftp/SftpServiceTests.cs Adds tests for new SFTP service behaviors (cwd, close session, rename, create empty file).
tests/PulseTerm.App.Tests/ViewModels/MainWindowViewModelTests.cs Verifies the new tools.files command/shortcut wiring and toggle behavior.
tests/PulseTerm.App.Tests/ViewModels/FileBrowserViewModelTests.cs Expands coverage for activation, initial load to cwd, sorting, and context-menu actions.
src/PulseTerm.Infrastructure/Ssh/SftpClientWrapper.cs Adds RenameFile wrapper to the concrete SFTP client adapter.
src/PulseTerm.Core/Ssh/ISftpClientWrapper.cs Extends the wrapper interface with RenameFile.
src/PulseTerm.Core/Sftp/SftpService.cs Implements create-file, rename, working-directory, and close-session APIs.
src/PulseTerm.Core/Sftp/ISftpService.cs Exposes new SFTP APIs with documentation for UI consumption.
src/PulseTerm.App/Views/MenuBarView.axaml Enables the menu entry to launch the SFTP file manager command.
src/PulseTerm.App/Views/MainWindow.axaml Adds Ctrl+Shift+F keybinding for tools.files.
src/PulseTerm.App/Views/FileBrowserView.axaml.cs Wires view-provided callbacks (prompt/clipboard/properties) and double-tap activation.
src/PulseTerm.App/Views/FileBrowserView.axaml Switches to a selectable ListBox, adds sortable headers and context menus.
src/PulseTerm.App/ViewModels/MainWindowViewModel.cs Registers the new command and manages file browser binding across connect/reconnect/tab close.
src/PulseTerm.App/ViewModels/FileBrowserViewModel.cs Adds sorting, home-directory initial load, activation, and new context-menu operations.
.gitignore Ignores additional local/auxiliary artifacts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +5 to +9
using Avalonia;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Input.Platform;
using Avalonia.Layout;
Comment on lines +150 to +166
await Task.Run(() =>
{
try
{
if (client.IsConnected)
{
client.Disconnect();
}

client.Dispose();
}
catch
{
// Best-effort teardown; the tab is already gone.
}
}, cancellationToken).ConfigureAwait(false);
}
Comment on lines +174 to +175
if (wasVisible)
FileBrowser.RefreshCommand.Execute().Subscribe(_ => { }, _ => { });
Comment on lines +188 to +189
if (FileBrowser.IsVisible && FileBrowser.SessionId != Guid.Empty)
FileBrowser.RefreshCommand.Execute().Subscribe(_ => { }, _ => { });
Comment on lines +358 to +366
var name = await PromptForText("新建文件夹", "");
if (string.IsNullOrWhiteSpace(name))
return;
}

try
{
ErrorMessage = null;
var toDelete = SelectedFiles.ToList();
await _sftpService.CreateDirectoryAsync(_sessionId, CombinePath(CurrentPath, name.Trim()), ct);
await RefreshAsync(ct);
Comment on lines +379 to 388
var name = await PromptForText("新建文件", "");
if (string.IsNullOrWhiteSpace(name))
return;

try
{
ErrorMessage = null;
await _sftpService.CreateFileAsync(_sessionId, CombinePath(CurrentPath, name.Trim()), ct);
await RefreshAsync(ct);
}
Comment on lines +400 to 410
var newName = await PromptForText("重命名", file.Name);
if (string.IsNullOrWhiteSpace(newName) || newName.Trim() == file.Name)
return;

try
{
ErrorMessage = null;
var target = CombinePath(ParentOf(file.FullPath), newName.Trim());
await _sftpService.RenameAsync(_sessionId, file.FullPath, target, ct);
await RefreshAsync(ct);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants