新增: 文件浏览器增强(窗口分离/Git 变更/行号/Diff/分页提交历史)
- 窗口分离: FileExplorer 可弹出独立 Tauri 窗口 - 行号显示: 文件预览左侧显示行号列 - 按后缀图标: rs/ts/js/vue/css/html 等 20+ 类型彩色图标 - Diff 视图: 有 Git 变更的文件可切换 diff 红绿视图 - Git 变更面板: 变更文件列表(按目录缩进分组)+提交历史(分页加载) - 提交详情: 点击提交查看变更文件列表及文件级 diff - 时间显示: 提交历史显示相对时间/具体日期 - 面包屑导航不丢预览: 导航时不改变当前预览文件 - 刷新保留选中文件: 只清树缓存不清预览 - 中文编码修复: git 命令注入 LANG/LC_ALL 环境变量 - 自适应布局: 弹性 flex 布局,窄窗口适配 - 滚动条优化: 内容区内部滚动,不溢出页面层 - 多工程管理: 工具栏添加工程按钮+弹窗表单 - 审批加载超时缩短: 130s 降至 30s - 文件变更自动刷新: write_file/patch_file 触发 df-data-changed
This commit is contained in:
@@ -63,6 +63,8 @@ export interface GitChangedFile {
|
||||
export interface GitRecentCommit {
|
||||
hash: string
|
||||
subject: string
|
||||
/** Unix 时间戳(秒) */
|
||||
timestamp: number
|
||||
}
|
||||
|
||||
/** getModuleGitStatus 返回结构。 */
|
||||
@@ -74,6 +76,17 @@ export interface GitStatusResult {
|
||||
}
|
||||
|
||||
export const moduleApi = {
|
||||
/** 新增工程(返回完整记录)。 */
|
||||
addProjectModule(input: {
|
||||
projectId: string
|
||||
name: string
|
||||
path: string
|
||||
gitUrl?: string | null
|
||||
stack?: string | null
|
||||
}): Promise<ProjectModuleRecord> {
|
||||
return invoke('add_project_module', { input })
|
||||
},
|
||||
|
||||
/** 列出项目全部工程(按 sort_order ASC)。 */
|
||||
listProjectModules(projectId: string): Promise<ProjectModuleRecord[]> {
|
||||
return invoke('list_project_modules', { projectId })
|
||||
@@ -104,4 +117,30 @@ export const moduleApi = {
|
||||
readModuleFile(moduleId: string, filePath: string): Promise<ReadFileResult> {
|
||||
return invoke('read_module_file', { moduleId, filePath })
|
||||
},
|
||||
|
||||
/** 查询工程内文件元信息(不读内容,前端检测外部变化用)。返回 { path, size, modified_at }。 */
|
||||
getModuleFileMeta(moduleId: string, filePath: string): Promise<{ path: string; size: number; modified_at: number }> {
|
||||
return invoke('get_module_file_meta', { moduleId, filePath })
|
||||
},
|
||||
|
||||
/** 查询工程内文件的 git diff(轻量,不读文件内容)。返回 { path, diff }。 */
|
||||
getModuleFileDiff(moduleId: string, filePath: string): Promise<{ path: string; diff: string }> {
|
||||
return invoke('get_module_file_diff', { moduleId, filePath })
|
||||
},
|
||||
|
||||
/** 分页查询工程 Git 提交历史。返回 { commits, has_more }。 */
|
||||
getModuleCommits(moduleId: string, skip?: number, limit?: number): Promise<{
|
||||
commits: { hash: string; subject: string; timestamp: number }[]
|
||||
has_more: boolean
|
||||
}> {
|
||||
return invoke('get_module_commits', { moduleId, skip: skip ?? 0, limit: limit ?? 50 })
|
||||
},
|
||||
|
||||
/** 查询某次提交的变更文件列表及 diff。返回 { files: [{ status, path }], diff: string }。 */
|
||||
getCommitDetail(moduleId: string, commitHash: string): Promise<{
|
||||
files: { status: string; path: string }[]
|
||||
diff: string
|
||||
}> {
|
||||
return invoke('get_commit_detail', { moduleId, commitHash })
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user