Skip to content

Commit 6fb6e7b

Browse files
committed
Provides webviewId to merge conflicts wrapper
1 parent 960b7a3 commit 6fb6e7b

File tree

3 files changed

+25
-9
lines changed

3 files changed

+25
-9
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,6 +1344,7 @@ export function GraphWrapper({
13441344
continueCommand="gitlens.graph.continuePausedOperation"
13451345
abortCommand="gitlens.graph.abortPausedOperation"
13461346
openEditorCommand="gitlens.graph.openRebaseEditor"
1347+
webviewId="gitlens.views.graph"
13471348
></GlMergeConflictWarning>
13481349
</div>
13491350
)}

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

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { Commands } from '../../../../../constants.commands';
55
import type { GitPausedOperationStatus } from '../../../../../git/models/pausedOperationStatus';
66
import { pausedOperationStatusStringsByType } from '../../../../../git/utils/pausedOperationStatus.utils';
77
import { createCommandLink } from '../../../../../system/commands';
8+
import { createWebviewCommandLink } from '../../../../../system/webview';
89
import { getReferenceLabel } from '../../../shared/git-utils';
910
import '../../../shared/components/actions/action-item';
1011
import '../../../shared/components/actions/action-nav';
@@ -74,20 +75,35 @@ export class GlMergeConflictWarning extends LitElement {
7475
@property()
7576
openEditorCommand = 'gitlens.home.openRebaseEditor';
7677

78+
@property({ type: String })
79+
webviewId?: Parameters<typeof createWebviewCommandLink>[1];
80+
81+
private createWebviewCommandLink<T>(command: string, props: T) {
82+
if (this.webviewId) {
83+
return createWebviewCommandLink(
84+
command as Parameters<typeof createWebviewCommandLink>[0],
85+
this.webviewId,
86+
'',
87+
props,
88+
);
89+
}
90+
return createCommandLink(command as Commands, props);
91+
}
92+
7793
private get onSkipUrl() {
78-
return createCommandLink(this.skipCommand as Commands, this.pausedOpStatus);
94+
return this.createWebviewCommandLink(this.skipCommand, this.pausedOpStatus);
7995
}
8096

8197
private get onContinueUrl() {
82-
return createCommandLink(this.continueCommand as Commands, this.pausedOpStatus);
98+
return this.createWebviewCommandLink(this.continueCommand, this.pausedOpStatus);
8399
}
84100

85101
private get onAbortUrl() {
86-
return createCommandLink(this.abortCommand as Commands, this.pausedOpStatus);
102+
return this.createWebviewCommandLink(this.abortCommand, this.pausedOpStatus);
87103
}
88104

89105
private get onOpenEditorUrl() {
90-
return createCommandLink(this.openEditorCommand as Commands, this.pausedOpStatus);
106+
return this.createWebviewCommandLink(this.openEditorCommand, this.pausedOpStatus);
91107
}
92108

93109
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)