|
1 | 1 | 'use strict'; |
2 | 2 | import { TreeItem, TreeItemCollapsibleState } from 'vscode'; |
3 | | -import { GlyphChars } from '../../constants'; |
4 | | -import { Container } from '../../container'; |
5 | | -import { CommitFormatter, GitLogCommit } from '../../gitService'; |
6 | | -import { Strings } from '../../system'; |
| 3 | +import { GitLogCommit } from '../../gitService'; |
| 4 | +import { ResultsExplorer } from '../resultsExplorer'; |
7 | 5 | import { CommitNode } from './commitNode'; |
8 | | -import { Explorer, ExplorerNode, MessageNode, ResourceType } from './explorerNode'; |
| 6 | +import { ExplorerNode, ResourceType } from './explorerNode'; |
9 | 7 |
|
10 | 8 | export class CommitResultsNode extends ExplorerNode { |
11 | 9 | constructor( |
12 | 10 | public readonly commit: GitLogCommit, |
13 | | - private readonly explorer: Explorer, |
14 | | - private readonly contextValue: ResourceType = ResourceType.Results |
| 11 | + private readonly explorer: ResultsExplorer |
15 | 12 | ) { |
16 | 13 | super(commit.toGitUri()); |
17 | 14 | } |
18 | 15 |
|
19 | | - async getChildren(): Promise<ExplorerNode[]> { |
20 | | - const children = await new CommitNode(this.commit, this.explorer).getChildren(); |
21 | | - children.splice( |
22 | | - 0, |
23 | | - 0, |
24 | | - new MessageNode( |
25 | | - CommitFormatter.fromTemplate('${message}', this.commit, { truncateMessageAtNewLine: true }), |
26 | | - CommitFormatter.fromTemplate('${message}', this.commit) |
27 | | - ) |
28 | | - ); |
29 | | - return children; |
| 16 | + getChildren(): ExplorerNode[] { |
| 17 | + return [new CommitNode(this.commit, this.explorer)]; |
30 | 18 | } |
31 | 19 |
|
32 | | - async getTreeItem(): Promise<TreeItem> { |
33 | | - const label = CommitFormatter.fromTemplate( |
34 | | - `Commit \${sha} ${Strings.pad(GlyphChars.Dash, 1, 1)} \${authorAgoOrDate}`, |
35 | | - this.commit, |
36 | | - Container.config.defaultDateFormat |
| 20 | + getTreeItem(): TreeItem { |
| 21 | + const item = new TreeItem( |
| 22 | + `1 result for commits with an id matching '${this.commit.shortSha}'`, |
| 23 | + TreeItemCollapsibleState.Expanded |
37 | 24 | ); |
38 | | - const item = new TreeItem(label, TreeItemCollapsibleState.Expanded); |
39 | | - item.contextValue = this.contextValue; |
| 25 | + item.contextValue = ResourceType.Results; |
40 | 26 | return item; |
41 | 27 | } |
42 | 28 | } |
0 commit comments