Skip to content

Commit 4f0d3d7

Browse files
committed
Fixes #3954 command links for the graph
1 parent 1ac7c8b commit 4f0d3d7

File tree

3 files changed

+27
-9
lines changed

3 files changed

+27
-9
lines changed

src/webviews/apps/plus/graph/GraphWrapper.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,6 +1344,10 @@ export function GraphWrapper({
13441344
continueCommand="gitlens.graph.continuePausedOperation"
13451345
abortCommand="gitlens.graph.abortPausedOperation"
13461346
openEditorCommand="gitlens.graph.openRebaseEditor"
1347+
webviewCommandContext={{
1348+
webview: state.webviewId,
1349+
webviewInstance: state.webviewInstanceId,
1350+
}}
13471351
></GlMergeConflictWarning>
13481352
</div>
13491353
)}

src/webviews/apps/plus/shared/components/merge-rebase-status.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,20 +74,35 @@ export class GlMergeConflictWarning extends LitElement {
7474
@property()
7575
openEditorCommand = 'gitlens.home.openRebaseEditor';
7676

77+
@property({ type: Object })
78+
webviewCommandContext?: { webview: string; webviewInstance: string | undefined };
79+
7780
private get onSkipUrl() {
78-
return createCommandLink(this.skipCommand as Commands, this.pausedOpStatus);
81+
return this.createCommandLink(this.skipCommand as Commands, this.pausedOpStatus);
7982
}
8083

8184
private get onContinueUrl() {
82-
return createCommandLink(this.continueCommand as Commands, this.pausedOpStatus);
85+
return this.createCommandLink(this.continueCommand as Commands, this.pausedOpStatus);
8386
}
8487

8588
private get onAbortUrl() {
86-
return createCommandLink(this.abortCommand as Commands, this.pausedOpStatus);
89+
return this.createCommandLink(this.abortCommand as Commands, this.pausedOpStatus);
8790
}
8891

8992
private get onOpenEditorUrl() {
90-
return createCommandLink(this.openEditorCommand as Commands, this.pausedOpStatus);
93+
return this.createCommandLink(this.openEditorCommand as Commands, this.pausedOpStatus);
94+
}
95+
96+
private createCommandLink(command: string, args?: any) {
97+
if (this.webviewCommandContext != null) {
98+
if (args == null) {
99+
args = this.webviewCommandContext;
100+
} else {
101+
args = { ...args, ...this.webviewCommandContext };
102+
}
103+
}
104+
105+
return createCommandLink(command as Commands, args);
91106
}
92107

93108
override render() {

src/webviews/plus/graph/graphWebview.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -692,11 +692,10 @@ export class GraphWebviewProvider implements WebviewProvider<State, State, Graph
692692
this.host.registerWebviewCommand('gitlens.graph.generateCommitMessage', this.generateCommitMessage),
693693

694694
this.host.registerWebviewCommand('gitlens.graph.compareSelectedCommits.multi', this.compareSelectedCommits),
695-
// TODO@d13: convert to this.host.registerWebviewCommand
696-
registerCommand('gitlens.graph.abortPausedOperation', this.abortPausedOperation, this),
697-
registerCommand('gitlens.graph.continuePausedOperation', this.continuePausedOperation, this),
698-
registerCommand('gitlens.graph.openRebaseEditor', this.openRebaseEditor, this),
699-
registerCommand('gitlens.graph.skipPausedOperation', this.skipPausedOperation, this),
695+
this.host.registerWebviewCommand('gitlens.graph.abortPausedOperation', this.abortPausedOperation),
696+
this.host.registerWebviewCommand('gitlens.graph.continuePausedOperation', this.continuePausedOperation),
697+
this.host.registerWebviewCommand('gitlens.graph.openRebaseEditor', this.openRebaseEditor),
698+
this.host.registerWebviewCommand('gitlens.graph.skipPausedOperation', this.skipPausedOperation),
700699
);
701700

702701
return commands;

0 commit comments

Comments
 (0)