Browse Source

Adds Open Details menu command to Graph commits

main
Eric Amodio 2 years ago
parent
commit
8176007d42
2 changed files with 31 additions and 3 deletions
  1. +15
    -0
      package.json
  2. +16
    -3
      src/plus/webviews/graph/graphWebview.ts

+ 15
- 0
package.json View File

@ -6345,6 +6345,12 @@
"icon": "$(copy)" "icon": "$(copy)"
}, },
{ {
"command": "gitlens.graph.showInDetailsView",
"title": "Open Details",
"category": "GitLens",
"icon": "$(eye)"
},
{
"command": "gitlens.graph.openCommitOnRemote", "command": "gitlens.graph.openCommitOnRemote",
"title": "Open Commit on Remote", "title": "Open Commit on Remote",
"category": "GitLens", "category": "GitLens",
@ -8309,6 +8315,10 @@
"when": "false" "when": "false"
}, },
{ {
"command": "gitlens.graph.showInDetailsView",
"when": "false"
},
{
"command": "gitlens.graph.openCommitOnRemote", "command": "gitlens.graph.openCommitOnRemote",
"when": "false" "when": "false"
}, },
@ -10937,6 +10947,11 @@
"group": "1_gitlens_actions_1@2" "group": "1_gitlens_actions_1@2"
}, },
{ {
"command": "gitlens.graph.showInDetailsView",
"when": "webviewItem =~ /gitlens:(commit|stash)\\b/",
"group": "3_gitlens_explore@0"
},
{
"command": "gitlens.graph.openCommitOnRemote", "command": "gitlens.graph.openCommitOnRemote",
"when": "gitlens:hasRemotes && webviewItem =~ /gitlens:commit\\b/", "when": "gitlens:hasRemotes && webviewItem =~ /gitlens:commit\\b/",
"group": "3_gitlens_explore@2", "group": "3_gitlens_explore@2",

+ 16
- 3
src/plus/webviews/graph/graphWebview.ts View File

@ -22,6 +22,7 @@ import type {
CopyShaToClipboardCommandArgs, CopyShaToClipboardCommandArgs,
OpenBranchOnRemoteCommandArgs, OpenBranchOnRemoteCommandArgs,
OpenCommitOnRemoteCommandArgs, OpenCommitOnRemoteCommandArgs,
ShowCommitsInViewCommandArgs,
} from '../../../commands'; } from '../../../commands';
import { parseCommandContext } from '../../../commands/base'; import { parseCommandContext } from '../../../commands/base';
import { GitActions } from '../../../commands/gitCommands.actions'; import { GitActions } from '../../../commands/gitCommands.actions';
@ -294,6 +295,7 @@ export class GraphWebview extends WebviewBase {
registerCommand('gitlens.graph.cherryPick', this.cherryPick, this), registerCommand('gitlens.graph.cherryPick', this.cherryPick, this),
registerCommand('gitlens.graph.copyRemoteCommitUrl', item => this.openCommitOnRemote(item, true), this), registerCommand('gitlens.graph.copyRemoteCommitUrl', item => this.openCommitOnRemote(item, true), this),
registerCommand('gitlens.graph.showInDetailsView', this.openInDetailsView, this),
registerCommand('gitlens.graph.openCommitOnRemote', this.openCommitOnRemote, this), registerCommand('gitlens.graph.openCommitOnRemote', this.openCommitOnRemote, this),
registerCommand('gitlens.graph.rebaseOntoCommit', this.rebase, this), registerCommand('gitlens.graph.rebaseOntoCommit', this.rebase, this),
registerCommand('gitlens.graph.resetCommit', this.resetCommit, this), registerCommand('gitlens.graph.resetCommit', this.resetCommit, this),
@ -940,9 +942,7 @@ export class GraphWebview extends WebviewBase {
return this.container.storage.getWorkspace('graph:columns'); return this.container.storage.getWorkspace('graph:columns');
} }
private getColumnSettings(
columns: Record<GraphColumnName, GraphColumnConfig> | undefined,
): GraphColumnsSettings {
private getColumnSettings(columns: Record<GraphColumnName, GraphColumnConfig> | undefined): GraphColumnsSettings {
const columnsSettings: GraphColumnsSettings = { const columnsSettings: GraphColumnsSettings = {
...defaultGraphColumnsSettings, ...defaultGraphColumnsSettings,
}; };
@ -1303,6 +1303,19 @@ export class GraphWebview extends WebviewBase {
} }
@debug() @debug()
private openInDetailsView(item: GraphItemContext) {
if (isGraphItemRefContext(item, 'revision')) {
const { ref } = item.webviewItemValue;
return executeCommand<ShowCommitsInViewCommandArgs>(Commands.ShowInDetailsView, {
repoPath: ref.repoPath,
refs: [ref.ref],
});
}
return Promise.resolve();
}
@debug()
private openCommitOnRemote(item: GraphItemContext, clipboard?: boolean) { private openCommitOnRemote(item: GraphItemContext, clipboard?: boolean) {
if (isGraphItemRefContext(item, 'revision')) { if (isGraphItemRefContext(item, 'revision')) {
const { ref } = item.webviewItemValue; const { ref } = item.webviewItemValue;

Loading…
Cancel
Save