Skip to content

Commit 69a150f

Browse files
committed
Implements actions-list component
1 parent 06f8cf2 commit 69a150f

File tree

11 files changed

+636
-130
lines changed

11 files changed

+636
-130
lines changed

contributions.json

+117
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

+126
Original file line numberDiff line numberDiff line change
@@ -6880,6 +6880,51 @@
68806880
"icon": "$(discard)",
68816881
"enablement": "!operationInProgress"
68826882
},
6883+
{
6884+
"command": "gitlens.home.createPullRequest",
6885+
"title": "Create Pull Request...",
6886+
"icon": "$(git-pull-request-create)"
6887+
},
6888+
{
6889+
"command": "gitlens.home.fetch",
6890+
"title": "Fetch",
6891+
"icon": "$(gl-repo-fetch)"
6892+
},
6893+
{
6894+
"command": "gitlens.home.openInGraph",
6895+
"title": "Open in Commit Graph",
6896+
"icon": "$(gl-graph)"
6897+
},
6898+
{
6899+
"command": "gitlens.home.openPullRequestChanges",
6900+
"title": "Open Pull Request Changes",
6901+
"icon": "$(request-changes)"
6902+
},
6903+
{
6904+
"command": "gitlens.home.openPullRequestOnRemote",
6905+
"title": "Open Pull Request on Remote",
6906+
"icon": "$(globe)"
6907+
},
6908+
{
6909+
"command": "gitlens.home.openWorktree",
6910+
"title": "Open Worktree",
6911+
"icon": "$(browser)"
6912+
},
6913+
{
6914+
"command": "gitlens.home.openWorktreeInNewWindow",
6915+
"title": "Open Worktree in New Window",
6916+
"icon": "$(empty-window)"
6917+
},
6918+
{
6919+
"command": "gitlens.home.pull",
6920+
"title": "Pull",
6921+
"icon": "$(gl-repo-pull)"
6922+
},
6923+
{
6924+
"command": "gitlens.home.switchToBranch",
6925+
"title": "Switch to Branch...",
6926+
"icon": "$(gl-switch)"
6927+
},
68836928
{
68846929
"command": "gitlens.inviteToLiveShare",
68856930
"title": "Invite to Live Share",
@@ -10793,6 +10838,42 @@
1079310838
"command": "gitlens.graph.undoCommit",
1079410839
"when": "false"
1079510840
},
10841+
{
10842+
"command": "gitlens.home.createPullRequest",
10843+
"when": "false"
10844+
},
10845+
{
10846+
"command": "gitlens.home.fetch",
10847+
"when": "false"
10848+
},
10849+
{
10850+
"command": "gitlens.home.openInGraph",
10851+
"when": "false"
10852+
},
10853+
{
10854+
"command": "gitlens.home.openPullRequestChanges",
10855+
"when": "false"
10856+
},
10857+
{
10858+
"command": "gitlens.home.openPullRequestOnRemote",
10859+
"when": "false"
10860+
},
10861+
{
10862+
"command": "gitlens.home.openWorktree",
10863+
"when": "false"
10864+
},
10865+
{
10866+
"command": "gitlens.home.openWorktreeInNewWindow",
10867+
"when": "false"
10868+
},
10869+
{
10870+
"command": "gitlens.home.pull",
10871+
"when": "false"
10872+
},
10873+
{
10874+
"command": "gitlens.home.switchToBranch",
10875+
"when": "false"
10876+
},
1079610877
{
1079710878
"command": "gitlens.inviteToLiveShare",
1079810879
"when": "false"
@@ -18736,6 +18817,51 @@
1873618817
"when": "webviewItem =~ /gitlens:graph:(columns|settings)\\b/",
1873718818
"group": "3_columns@2"
1873818819
},
18820+
{
18821+
"command": "gitlens.home.openPullRequestChanges",
18822+
"when": "webviewItem =~ /gitlens:home\\b(?=.*?\\b\\+.*gitlens\\.home\\.openPullRequestChanges\\b)/",
18823+
"group": "10_gitlens_action@1"
18824+
},
18825+
{
18826+
"command": "gitlens.home.openPullRequestOnRemote",
18827+
"when": "webviewItem =~ /gitlens:home\\b(?=.*?\\b\\+.*gitlens\\.home\\.openPullRequestOnRemote\\b)/",
18828+
"group": "20_gitlens_action@1"
18829+
},
18830+
{
18831+
"command": "gitlens.home.createPullRequest",
18832+
"when": "webviewItem =~ /gitlens:home\\b(?=.*?\\b\\+.*gitlens\\.home\\.createPullRequest\\b)/",
18833+
"group": "30_gitlens_action@1"
18834+
},
18835+
{
18836+
"command": "gitlens.home.openWorktree",
18837+
"when": "webviewItem =~ /gitlens:home\\b(?=.*?\\b\\+.*gitlens\\.home\\.openWorktree\\b)/",
18838+
"group": "40_gitlens_action@1"
18839+
},
18840+
{
18841+
"command": "gitlens.home.openWorktreeInNewWindow",
18842+
"when": "webviewItem =~ /gitlens:home\\b(?=.*?\\b\\+.*gitlens\\.home\\.openWorktreeInNewWindow\\b)/",
18843+
"group": "40_gitlens_action@1"
18844+
},
18845+
{
18846+
"command": "gitlens.home.switchToBranch",
18847+
"when": "webviewItem =~ /gitlens:home\\b(?=.*?\\b\\+.*gitlens\\.home\\.switchToBranch\\b)/",
18848+
"group": "50_gitlens_action@1"
18849+
},
18850+
{
18851+
"command": "gitlens.home.fetch",
18852+
"when": "webviewItem =~ /gitlens:home\\b(?=.*?\\b\\+.*gitlens\\.home\\.fetch\\b)/",
18853+
"group": "60_gitlens_action@1"
18854+
},
18855+
{
18856+
"command": "gitlens.home.pull",
18857+
"when": "webviewItem =~ /gitlens:home\\b(?=.*?\\b\\+.*gitlens\\.home\\.pull\\b)/",
18858+
"group": "60_gitlens_action@1"
18859+
},
18860+
{
18861+
"command": "gitlens.home.openInGraph",
18862+
"when": "webviewItem =~ /gitlens:home\\b(?=.*?\\b\\+.*gitlens\\.home\\.openInGraph\\b)/",
18863+
"group": "80_gitlens_action@1"
18864+
},
1873918865
{
1874018866
"command": "gitlens.graph.openPullRequestChanges",
1874118867
"when": "webviewItem =~ /gitlens:pullrequest\\b(?=.*?\\b\\+refs\\b)/ && config.multiDiffEditor.experimental.enabled",

src/constants.commands.ts

+2
Original file line numberDiff line numberDiff line change
@@ -695,8 +695,10 @@ type HomeWebviewCommands = `home.${
695695
| 'openPullRequestDetails'
696696
| 'createPullRequest'
697697
| 'openWorktree'
698+
| 'openWorktreeInNewWindow'
698699
| 'switchToBranch'
699700
| 'fetch'
701+
| 'pull'
700702
| 'openInGraph'
701703
| 'createBranch'
702704
| 'mergeIntoCurrent'

src/webviews/apps/home/home.html

+1-1
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

+24-23
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 { GetActiveOverviewResponse, 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 { ActiveOverviewState } from './overviewState';
15-
import { activeOverviewStateContext } 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 { ActiveOverviewState } from './overviewState';
28+
import { activeOverviewStateContext } from './overviewState';
2829

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

@@ -376,27 +377,27 @@ export class GlActiveBranchCard extends GlBranchCardBase {
376377
></gl-merge-rebase-status>`;
377378
}
378379

379-
protected getBranchActions(): TemplateResult[] {
380+
protected getBranchActions(): (typeof ActionList.ItemProps)[] {
380381
return [];
381382
}
382383

383-
protected getPrActions(): TemplateResult[] {
384+
protected getPrActions(): (typeof ActionList.ItemProps)[] {
384385
return [
385-
html`<action-item
386-
label="Open Pull Request Changes"
387-
icon="request-changes"
388-
href=${this.createCommandLink('gitlens.home.openPullRequestChanges')}
389-
></action-item>`,
390-
html`<action-item
391-
label="Compare Pull Request"
392-
icon="git-compare"
393-
href=${this.createCommandLink('gitlens.home.openPullRequestComparison')}
394-
></action-item>`,
395-
html`<action-item
396-
label="Open Pull Request Details"
397-
icon="eye"
398-
href=${this.createCommandLink('gitlens.home.openPullRequestDetails')}
399-
></action-item>`,
386+
{
387+
label: 'Open Pull Request Changes',
388+
icon: 'request-changes',
389+
href: this.createCommandLink('gitlens.home.openPullRequestChanges'),
390+
},
391+
{
392+
label: 'Compare Pull Request',
393+
icon: 'git-compare',
394+
href: this.createCommandLink('gitlens.home.openPullRequestComparison'),
395+
},
396+
{
397+
label: 'Open Pull Request Details',
398+
icon: 'eye',
399+
href: this.createCommandLink('gitlens.home.openPullRequestDetails'),
400+
},
400401
];
401402
}
402403
}

0 commit comments

Comments
 (0)