diff --git a/package.json b/package.json index e652c44..f35df11 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "publisher": "zhangmo8", "name": "git-panel", "displayName": "Git Panel", - "version": "0.1.0", + "version": "0.1.1", "private": true, "packageManager": "pnpm@9.7.1", "description": "", diff --git a/src/constant.ts b/src/constant.ts index 4b779d4..8e14a8f 100644 --- a/src/constant.ts +++ b/src/constant.ts @@ -2,6 +2,7 @@ export const WEBVIEW_CHANNEL = { GET_HISTORY: 'get-history', SHOW_COMMIT_DETAILS: 'show-commit-details', + SHOW_CHANGES_PANEL: 'show-changes-panel', } as const // vscode to webview channel diff --git a/src/git/index.ts b/src/git/index.ts index 6d6ef25..710eecc 100644 --- a/src/git/index.ts +++ b/src/git/index.ts @@ -36,7 +36,6 @@ export class GitService { try { const logResult = await this.git.log([ '--all', - '--max-count=100', '--decorate=full', ]) as ExtendedLogResult diff --git a/src/views/diff/DiffTreeView.ts b/src/views/diff/DiffTreeView.ts index aa5a01a..ca172f5 100644 --- a/src/views/diff/DiffTreeView.ts +++ b/src/views/diff/DiffTreeView.ts @@ -85,7 +85,7 @@ export class DiffTreeView implements TreeDataProvider { this.fileTreeProvider.refresh(commitDetails.hash) - const changedFiles = await this.fileTreeProvider.getChildren() + const { files, total } = await this.fileTreeProvider.getChildren() return [ new CommitNode( @@ -108,10 +108,10 @@ export class DiffTreeView implements TreeDataProvider { ), new CommitNode( 'Changed Files', - `${changedFiles.length} Files Changed`, - changedFiles.length > 0 ? TreeItemCollapsibleState.Expanded : TreeItemCollapsibleState.None, + `${total} Files Changed`, + total > 0 ? TreeItemCollapsibleState.Expanded : TreeItemCollapsibleState.None, 'files', - changedFiles, + files, ), ] } diff --git a/src/views/diff/FileTreeView.ts b/src/views/diff/FileTreeView.ts index bc9e4cd..95d8a2f 100644 --- a/src/views/diff/FileTreeView.ts +++ b/src/views/diff/FileTreeView.ts @@ -93,15 +93,18 @@ export class FileTreeView { return Array.from(root.values()) } - async getChildren(): Promise> { + async getChildren(): Promise<{ files: Array, total: number }> { if (!this.commitHash) - return [] + return { files: [], total: 0 } try { const commit = this.storageService.getCommit(this.commitHash) if (commit?.files) { - return this.buildFileTree(commit.files) + return { + files: this.buildFileTree(commit.files), + total: commit.files.length, + } } const showResult = await this.gitService.git.show([ @@ -138,11 +141,14 @@ export class FileTreeView { this.storageService.updateCommitFiles(this.commitHash, fileChanges) - return this.buildFileTree(fileChanges) + return { + files: this.buildFileTree(fileChanges), + total: fileChanges.length, + } } catch (error) { console.error('Error getting commit files:', error) - return [] + return { files: [], total: 0 } } } } diff --git a/src/views/history/App.vue b/src/views/history/App.vue index c591db1..76bf1e2 100644 --- a/src/views/history/App.vue +++ b/src/views/history/App.vue @@ -1,7 +1,7 @@ - - - - diff --git a/src/views/history/components/CommitTable/ColumnHeader.vue b/src/views/history/components/CommitTable/ColumnHeader.vue new file mode 100644 index 0000000..956a292 --- /dev/null +++ b/src/views/history/components/CommitTable/ColumnHeader.vue @@ -0,0 +1,121 @@ + + + + + diff --git a/src/views/history/components/CommitTable/ListItem.vue b/src/views/history/components/CommitTable/ListItem.vue new file mode 100644 index 0000000..05c536f --- /dev/null +++ b/src/views/history/components/CommitTable/ListItem.vue @@ -0,0 +1,102 @@ + + + + + diff --git a/src/views/history/components/CommitTable/ResizeHandle.vue b/src/views/history/components/CommitTable/ResizeHandle.vue new file mode 100644 index 0000000..b2e4ac1 --- /dev/null +++ b/src/views/history/components/CommitTable/ResizeHandle.vue @@ -0,0 +1,36 @@ + + + + + diff --git a/src/views/history/components/CommitTable/index.vue b/src/views/history/components/CommitTable/index.vue new file mode 100644 index 0000000..88f01b6 --- /dev/null +++ b/src/views/history/components/CommitTable/index.vue @@ -0,0 +1,111 @@ + + + + + diff --git a/src/views/webview.ts b/src/views/webview.ts index 48961fa..6e30f64 100644 --- a/src/views/webview.ts +++ b/src/views/webview.ts @@ -86,7 +86,6 @@ export class GitPanelViewProvider implements WebviewViewProvider { case WEBVIEW_CHANNEL.SHOW_COMMIT_DETAILS: try { this.gitChangesProvider.refresh(message.commitHash) - await commands.executeCommand('git.showCommitDetails', message.commitHash) } catch (error) { webviewView.webview.postMessage({ @@ -95,6 +94,9 @@ export class GitPanelViewProvider implements WebviewViewProvider { }) } break + case WEBVIEW_CHANNEL.SHOW_CHANGES_PANEL: + await commands.executeCommand('git-panel.changes.focus') + break case 'clearHistory': this.storageService.clearCommits()