Просмотр исходного кода

Adds Open Details menu command to Graph commits

main
Eric Amodio 2 лет назад
Родитель
Сommit
8176007d42
2 измененных файлов: 31 добавлений и 3 удалений
  1. +15
    -0
      package.json
  2. +16
    -3
      src/plus/webviews/graph/graphWebview.ts

+ 15
- 0
package.json Просмотреть файл

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

+ 16
- 3
src/plus/webviews/graph/graphWebview.ts Просмотреть файл

@ -22,6 +22,7 @@ import type {
CopyShaToClipboardCommandArgs,
OpenBranchOnRemoteCommandArgs,
OpenCommitOnRemoteCommandArgs,
ShowCommitsInViewCommandArgs,
} from '../../../commands';
import { parseCommandContext } from '../../../commands/base';
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.copyRemoteCommitUrl', item => this.openCommitOnRemote(item, true), this),
registerCommand('gitlens.graph.showInDetailsView', this.openInDetailsView, this),
registerCommand('gitlens.graph.openCommitOnRemote', this.openCommitOnRemote, this),
registerCommand('gitlens.graph.rebaseOntoCommit', this.rebase, this),
registerCommand('gitlens.graph.resetCommit', this.resetCommit, this),
@ -940,9 +942,7 @@ export class GraphWebview extends WebviewBase {
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 = {
...defaultGraphColumnsSettings,
};
@ -1303,6 +1303,19 @@ export class GraphWebview extends WebviewBase {
}
@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) {
if (isGraphItemRefContext(item, 'revision')) {
const { ref } = item.webviewItemValue;

Загрузка…
Отмена
Сохранить