Skip to content

Commit 07a9f34

Browse files
committed
Implements actions-list component
1 parent f884fc6 commit 07a9f34

File tree

11 files changed

+629
-124
lines changed

11 files changed

+629
-124
lines changed

contributions.json

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2905,6 +2905,123 @@
29052905
]
29062906
}
29072907
},
2908+
"gitlens.home.createPullRequest": {
2909+
"label": "Create Pull Request...",
2910+
"icon": "$(git-pull-request-create)",
2911+
"menus": {
2912+
"webview/context": [
2913+
{
2914+
"when": "webviewItem =~ /gitlens:home\\b(?=.*?\\b\\+.*gitlens\\.home\\.createPullRequest\\b)/",
2915+
"group": "30_gitlens_action",
2916+
"order": 1
2917+
}
2918+
]
2919+
}
2920+
},
2921+
"gitlens.home.fetch": {
2922+
"label": "Fetch",
2923+
"icon": "$(gl-repo-fetch)",
2924+
"menus": {
2925+
"webview/context": [
2926+
{
2927+
"when": "webviewItem =~ /gitlens:home\\b(?=.*?\\b\\+.*gitlens\\.home\\.fetch\\b)/",
2928+
"group": "60_gitlens_action",
2929+
"order": 1
2930+
}
2931+
]
2932+
}
2933+
},
2934+
"gitlens.home.openInGraph": {
2935+
"label": "Open in Commit Graph",
2936+
"icon": "$(gl-graph)",
2937+
"menus": {
2938+
"webview/context": [
2939+
{
2940+
"when": "webviewItem =~ /gitlens:home\\b(?=.*?\\b\\+.*gitlens\\.home\\.openInGraph\\b)/",
2941+
"group": "80_gitlens_action",
2942+
"order": 1
2943+
}
2944+
]
2945+
}
2946+
},
2947+
"gitlens.home.openPullRequestChanges": {
2948+
"label": "Open Pull Request Changes",
2949+
"icon": "$(request-changes)",
2950+
"menus": {
2951+
"webview/context": [
2952+
{
2953+
"when": "webviewItem =~ /gitlens:home\\b(?=.*?\\b\\+.*gitlens\\.home\\.openPullRequestChanges\\b)/",
2954+
"group": "10_gitlens_action",
2955+
"order": 1
2956+
}
2957+
]
2958+
}
2959+
},
2960+
"gitlens.home.openPullRequestOnRemote": {
2961+
"label": "Open Pull Request on Remote",
2962+
"icon": "$(globe)",
2963+
"menus": {
2964+
"webview/context": [
2965+
{
2966+
"when": "webviewItem =~ /gitlens:home\\b(?=.*?\\b\\+.*gitlens\\.home\\.openPullRequestOnRemote\\b)/",
2967+
"group": "20_gitlens_action",
2968+
"order": 1
2969+
}
2970+
]
2971+
}
2972+
},
2973+
"gitlens.home.openWorktree": {
2974+
"label": "Open Worktree",
2975+
"icon": "$(browser)",
2976+
"menus": {
2977+
"webview/context": [
2978+
{
2979+
"when": "webviewItem =~ /gitlens:home\\b(?=.*?\\b\\+.*gitlens\\.home\\.openWorktree\\b)/",
2980+
"group": "40_gitlens_action",
2981+
"order": 1
2982+
}
2983+
]
2984+
}
2985+
},
2986+
"gitlens.home.openWorktreeInNewWindow": {
2987+
"label": "Open Worktree in New Window",
2988+
"icon": "$(empty-window)",
2989+
"menus": {
2990+
"webview/context": [
2991+
{
2992+
"when": "webviewItem =~ /gitlens:home\\b(?=.*?\\b\\+.*gitlens\\.home\\.openWorktreeInNewWindow\\b)/",
2993+
"group": "40_gitlens_action",
2994+
"order": 1
2995+
}
2996+
]
2997+
}
2998+
},
2999+
"gitlens.home.pull": {
3000+
"label": "Pull",
3001+
"icon": "$(gl-repo-pull)",
3002+
"menus": {
3003+
"webview/context": [
3004+
{
3005+
"when": "webviewItem =~ /gitlens:home\\b(?=.*?\\b\\+.*gitlens\\.home\\.pull\\b)/",
3006+
"group": "60_gitlens_action",
3007+
"order": 1
3008+
}
3009+
]
3010+
}
3011+
},
3012+
"gitlens.home.switchToBranch": {
3013+
"label": "Switch to Branch...",
3014+
"icon": "$(gl-switch)",
3015+
"menus": {
3016+
"webview/context": [
3017+
{
3018+
"when": "webviewItem =~ /gitlens:home\\b(?=.*?\\b\\+.*gitlens\\.home\\.switchToBranch\\b)/",
3019+
"group": "50_gitlens_action",
3020+
"order": 1
3021+
}
3022+
]
3023+
}
3024+
},
29083025
"gitlens.inviteToLiveShare": {
29093026
"label": "Invite to Live Share",
29103027
"icon": "$(live-share)",

package.json

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6868,6 +6868,51 @@
68686868
"icon": "$(discard)",
68696869
"enablement": "!operationInProgress"
68706870
},
6871+
{
6872+
"command": "gitlens.home.createPullRequest",
6873+
"title": "Create Pull Request...",
6874+
"icon": "$(git-pull-request-create)"
6875+
},
6876+
{
6877+
"command": "gitlens.home.fetch",
6878+
"title": "Fetch",
6879+
"icon": "$(gl-repo-fetch)"
6880+
},
6881+
{
6882+
"command": "gitlens.home.openInGraph",
6883+
"title": "Open in Commit Graph",
6884+
"icon": "$(gl-graph)"
6885+
},
6886+
{
6887+
"command": "gitlens.home.openPullRequestChanges",
6888+
"title": "Open Pull Request Changes",
6889+
"icon": "$(request-changes)"
6890+
},
6891+
{
6892+
"command": "gitlens.home.openPullRequestOnRemote",
6893+
"title": "Open Pull Request on Remote",
6894+
"icon": "$(globe)"
6895+
},
6896+
{
6897+
"command": "gitlens.home.openWorktree",
6898+
"title": "Open Worktree",
6899+
"icon": "$(browser)"
6900+
},
6901+
{
6902+
"command": "gitlens.home.openWorktreeInNewWindow",
6903+
"title": "Open Worktree in New Window",
6904+
"icon": "$(empty-window)"
6905+
},
6906+
{
6907+
"command": "gitlens.home.pull",
6908+
"title": "Pull",
6909+
"icon": "$(gl-repo-pull)"
6910+
},
6911+
{
6912+
"command": "gitlens.home.switchToBranch",
6913+
"title": "Switch to Branch...",
6914+
"icon": "$(gl-switch)"
6915+
},
68716916
{
68726917
"command": "gitlens.inviteToLiveShare",
68736918
"title": "Invite to Live Share",
@@ -10781,6 +10826,42 @@
1078110826
"command": "gitlens.graph.undoCommit",
1078210827
"when": "false"
1078310828
},
10829+
{
10830+
"command": "gitlens.home.createPullRequest",
10831+
"when": "false"
10832+
},
10833+
{
10834+
"command": "gitlens.home.fetch",
10835+
"when": "false"
10836+
},
10837+
{
10838+
"command": "gitlens.home.openInGraph",
10839+
"when": "false"
10840+
},
10841+
{
10842+
"command": "gitlens.home.openPullRequestChanges",
10843+
"when": "false"
10844+
},
10845+
{
10846+
"command": "gitlens.home.openPullRequestOnRemote",
10847+
"when": "false"
10848+
},
10849+
{
10850+
"command": "gitlens.home.openWorktree",
10851+
"when": "false"
10852+
},
10853+
{
10854+
"command": "gitlens.home.openWorktreeInNewWindow",
10855+
"when": "false"
10856+
},
10857+
{
10858+
"command": "gitlens.home.pull",
10859+
"when": "false"
10860+
},
10861+
{
10862+
"command": "gitlens.home.switchToBranch",
10863+
"when": "false"
10864+
},
1078410865
{
1078510866
"command": "gitlens.inviteToLiveShare",
1078610867
"when": "false"
@@ -18692,6 +18773,51 @@
1869218773
"when": "webviewItem =~ /gitlens:graph:(columns|settings)\\b/",
1869318774
"group": "3_columns@2"
1869418775
},
18776+
{
18777+
"command": "gitlens.home.openPullRequestChanges",
18778+
"when": "webviewItem =~ /gitlens:home\\b(?=.*?\\b\\+.*gitlens\\.home\\.openPullRequestChanges\\b)/",
18779+
"group": "10_gitlens_action@1"
18780+
},
18781+
{
18782+
"command": "gitlens.home.openPullRequestOnRemote",
18783+
"when": "webviewItem =~ /gitlens:home\\b(?=.*?\\b\\+.*gitlens\\.home\\.openPullRequestOnRemote\\b)/",
18784+
"group": "20_gitlens_action@1"
18785+
},
18786+
{
18787+
"command": "gitlens.home.createPullRequest",
18788+
"when": "webviewItem =~ /gitlens:home\\b(?=.*?\\b\\+.*gitlens\\.home\\.createPullRequest\\b)/",
18789+
"group": "30_gitlens_action@1"
18790+
},
18791+
{
18792+
"command": "gitlens.home.openWorktree",
18793+
"when": "webviewItem =~ /gitlens:home\\b(?=.*?\\b\\+.*gitlens\\.home\\.openWorktree\\b)/",
18794+
"group": "40_gitlens_action@1"
18795+
},
18796+
{
18797+
"command": "gitlens.home.openWorktreeInNewWindow",
18798+
"when": "webviewItem =~ /gitlens:home\\b(?=.*?\\b\\+.*gitlens\\.home\\.openWorktreeInNewWindow\\b)/",
18799+
"group": "40_gitlens_action@1"
18800+
},
18801+
{
18802+
"command": "gitlens.home.switchToBranch",
18803+
"when": "webviewItem =~ /gitlens:home\\b(?=.*?\\b\\+.*gitlens\\.home\\.switchToBranch\\b)/",
18804+
"group": "50_gitlens_action@1"
18805+
},
18806+
{
18807+
"command": "gitlens.home.fetch",
18808+
"when": "webviewItem =~ /gitlens:home\\b(?=.*?\\b\\+.*gitlens\\.home\\.fetch\\b)/",
18809+
"group": "60_gitlens_action@1"
18810+
},
18811+
{
18812+
"command": "gitlens.home.pull",
18813+
"when": "webviewItem =~ /gitlens:home\\b(?=.*?\\b\\+.*gitlens\\.home\\.pull\\b)/",
18814+
"group": "60_gitlens_action@1"
18815+
},
18816+
{
18817+
"command": "gitlens.home.openInGraph",
18818+
"when": "webviewItem =~ /gitlens:home\\b(?=.*?\\b\\+.*gitlens\\.home\\.openInGraph\\b)/",
18819+
"group": "80_gitlens_action@1"
18820+
},
1869518821
{
1869618822
"command": "gitlens.graph.openPullRequestChanges",
1869718823
"when": "webviewItem =~ /gitlens:pullrequest\\b(?=.*?\\b\\+refs\\b)/ && config.multiDiffEditor.experimental.enabled",

src/constants.commands.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,8 +692,10 @@ type HomeWebviewCommands = `home.${
692692
| 'openPullRequestDetails'
693693
| 'createPullRequest'
694694
| 'openWorktree'
695+
| 'openWorktreeInNewWindow'
695696
| 'switchToBranch'
696697
| 'fetch'
698+
| 'pull'
697699
| 'openInGraph'
698700
| 'createBranch'
699701
| 'mergeIntoCurrent'

src/webviews/apps/home/home.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<body
2020
class="preload"
2121
data-placement="#{placement}"
22-
data-vscode-context='{ "webview": "#{webviewId}", "webviewInstance": "#{webviewInstanceId}" }'
22+
data-vscode-context='{ "preventDefaultContextMenuItems": true, "webview": "#{webviewId}", "webviewInstance": "#{webviewInstanceId}" }'
2323
>
2424
<gl-home-app name="HomeView" placement="#{placement}" bootstrap="#{state}"></gl-home-app>
2525
</body>

src/webviews/apps/plus/home/components/active-work.ts

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,23 @@ import { createCommandLink } from '../../../../../system/commands';
99
import { createWebviewCommandLink } from '../../../../../system/webview';
1010
import type { GetOverviewBranch, OpenInGraphParams, State } from '../../../../home/protocol';
1111
import { stateContext } from '../../../home/context';
12-
import { linkStyles } from '../../shared/components/vscode.css';
13-
import { branchCardStyles, GlBranchCardBase } from './branch-card';
14-
import type { Overview, OverviewState } from './overviewState';
15-
import { overviewStateContext } from './overviewState';
12+
import type { ActionList } from '../../../shared/components/actions/action-list';
1613
import '../../../shared/components/button';
17-
import '../../../shared/components/code-icon';
18-
import '../../../shared/components/skeleton-loader';
1914
import '../../../shared/components/card/card';
15+
import '../../../shared/components/code-icon';
2016
import '../../../shared/components/commit/commit-stats';
2117
import '../../../shared/components/menu/menu-item';
2218
import '../../../shared/components/overlays/popover';
2319
import '../../../shared/components/overlays/tooltip';
2420
import '../../../shared/components/pills/tracking';
2521
import '../../../shared/components/rich/issue-icon';
2622
import '../../../shared/components/rich/pr-icon';
23+
import '../../../shared/components/skeleton-loader';
2724
import '../../shared/components/merge-rebase-status';
25+
import { linkStyles } from '../../shared/components/vscode.css';
26+
import { branchCardStyles, GlBranchCardBase } from './branch-card';
27+
import type { Overview, OverviewState } from './overviewState';
28+
import { overviewStateContext } from './overviewState';
2829

2930
export const activeWorkTagName = 'gl-active-work';
3031

@@ -376,23 +377,23 @@ export class GlActiveBranchCard extends GlBranchCardBase {
376377
return [];
377378
}
378379

379-
protected getPrActions() {
380+
protected getPrActions(): (typeof ActionList.ItemProps)[] {
380381
return [
381-
html`<action-item
382-
label="Open Pull Request Changes"
383-
icon="request-changes"
384-
href=${this.createCommandLink('gitlens.home.openPullRequestChanges')}
385-
></action-item>`,
386-
html`<action-item
387-
label="Compare Pull Request"
388-
icon="git-compare"
389-
href=${this.createCommandLink('gitlens.home.openPullRequestComparison')}
390-
></action-item>`,
391-
html`<action-item
392-
label="Open Pull Request Details"
393-
icon="eye"
394-
href=${this.createCommandLink('gitlens.home.openPullRequestDetails')}
395-
></action-item>`,
382+
{
383+
label: 'Open Pull Request Changes',
384+
icon: 'request-changes',
385+
href: this.createCommandLink('gitlens.home.openPullRequestChanges'),
386+
},
387+
{
388+
label: 'Compare Pull Request',
389+
icon: 'git-compare',
390+
href: this.createCommandLink('gitlens.home.openPullRequestComparison'),
391+
},
392+
{
393+
label: 'Open Pull Request Details',
394+
icon: 'eye',
395+
href: this.createCommandLink('gitlens.home.openPullRequestDetails'),
396+
},
396397
];
397398
}
398399
}

0 commit comments

Comments
 (0)