Skip to content

Commit 219d620

Browse files
axosoft-raminteamodio
authored andcommitted
Adds grouping support for launchpad view
1 parent aa129ab commit 219d620

File tree

14 files changed

+276
-33
lines changed

14 files changed

+276
-33
lines changed
Lines changed: 1 addition & 0 deletions
Loading

images/icons/launchpad-view.svg

Lines changed: 1 addition & 0 deletions
Loading

images/icons/template/mapping.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,7 @@
6262
"search-view-filled": 61755,
6363
"stashes-view-filled": 61756,
6464
"tags-view-filled": 61757,
65-
"worktrees-view-filled": 61758
65+
"worktrees-view-filled": 61758,
66+
"launchpad-view": 61759,
67+
"launchpad-view-filled": 61760
6668
}

package.json

Lines changed: 218 additions & 18 deletions
Large diffs are not rendered by default.

src/constants.views.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export type GroupableTreeViewTypes = Extract<
2626
| 'branches'
2727
| 'commits'
2828
| 'contributors'
29+
| 'launchpad'
2930
| 'remotes'
3031
| 'repositories'
3132
| 'searchAndCompare'

src/views/launchpadView.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { ConfigurationChangeEvent, TreeViewVisibilityChangeEvent } from 'vs
22
import { Disposable, ThemeIcon, TreeItem, TreeItemCollapsibleState, Uri, window } from 'vscode';
33
import type { OpenWalkthroughCommandArgs } from '../commands/walkthroughs';
44
import type { LaunchpadViewConfig, ViewFilesLayout } from '../config';
5+
import { proBadge } from '../constants';
56
import { Commands } from '../constants.commands';
67
import type { Container } from '../container';
78
import { AuthenticationRequiredError } from '../errors';
@@ -152,14 +153,17 @@ export class LaunchpadViewNode extends CacheableChildrenViewNode<
152153
}
153154

154155
async getChildren(): Promise<(GroupingNode | LaunchpadItemNode)[]> {
156+
this.view.description = this.view.grouped
157+
? `${this.view.name.toLocaleLowerCase()}\u00a0\u2022\u00a0 ${proBadge}`
158+
: proBadge;
159+
this.view.message = undefined;
160+
155161
if (this.children == null) {
156162
const access = await this.view.container.git.access(PlusFeatures.Launchpad);
157163
if (!access.allowed) return [];
158164

159165
const children: (GroupingNode | LaunchpadItemNode)[] = [];
160166

161-
this.view.message = undefined;
162-
163167
const hasIntegrations = await this.view.container.launchpad.hasConnectedIntegration();
164168
if (!hasIntegrations) {
165169
return [];
@@ -220,15 +224,20 @@ export class LaunchpadView extends ViewBase<'launchpad', LaunchpadViewNode, Laun
220224
protected readonly configKey = 'launchpad';
221225
private _disposable: Disposable | undefined;
222226

223-
constructor(container: Container) {
224-
super(container, 'launchpad', 'Launchpad', 'launchpadView');
227+
constructor(container: Container, grouped?: boolean) {
228+
super(container, 'launchpad', 'Launchpad', 'launchpadView', grouped);
225229
}
226230

227231
override dispose() {
228232
this._disposable?.dispose();
229233
super.dispose();
230234
}
231235

236+
override getViewDescription(count?: number): string {
237+
const description = super.getViewDescription(count);
238+
return description ? `${description} \u00a0\u2022\u00a0 ${proBadge}` : proBadge;
239+
}
240+
232241
protected getRoot() {
233242
return new LaunchpadViewNode(this);
234243
}

src/views/scmGroupedView.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { executeCommand, registerCommand } from '../system/vscode/command';
77
import { BranchesView } from './branchesView';
88
import { CommitsView } from './commitsView';
99
import { ContributorsView } from './contributorsView';
10+
import { LaunchpadView } from './launchpadView';
1011
import { RemotesView } from './remotesView';
1112
import { RepositoriesView } from './repositoriesView';
1213
import { SearchAndCompareView } from './searchAndCompareView';
@@ -33,6 +34,7 @@ export class ScmGroupedView implements Disposable {
3334
registerCommand('gitlens.views.scm.grouped.branches', () => this.setView('branches', true)),
3435
registerCommand('gitlens.views.scm.grouped.commits', () => this.setView('commits', true)),
3536
registerCommand('gitlens.views.scm.grouped.contributors', () => this.setView('contributors', true)),
37+
registerCommand('gitlens.views.scm.grouped.launchpad', () => this.setView('launchpad', true)),
3638
registerCommand('gitlens.views.scm.grouped.remotes', () => this.setView('remotes', true)),
3739
registerCommand('gitlens.views.scm.grouped.repositories', () => this.setView('repositories', true)),
3840
registerCommand('gitlens.views.scm.grouped.searchAndCompare', () => this.setView('searchAndCompare', true)),
@@ -77,6 +79,8 @@ export class ScmGroupedView implements Disposable {
7779
return new CommitsView(this.container, true);
7880
case 'contributors':
7981
return new ContributorsView(this.container, true);
82+
case 'launchpad':
83+
return new LaunchpadView(this.container, true);
8084
case 'remotes':
8185
return new RemotesView(this.container, true);
8286
case 'repositories':

src/views/views.ts

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ export class Views implements Disposable {
9797
this._branchesView?.dispose();
9898
this._commitsView?.dispose();
9999
this._contributorsView?.dispose();
100+
this._launchpadView?.dispose();
100101
this._remotesView?.dispose();
101102
this._repositoriesView?.dispose();
102103
this._searchAndCompareView?.dispose();
@@ -151,6 +152,16 @@ export class Views implements Disposable {
151152
registerCommand('gitlens.views.scm.grouped.contributors.setAsDefault', () =>
152153
this.setAsScmGroupedDefaultView('contributors'),
153154
),
155+
registerCommand('gitlens.views.launchpad.regroup', () => this.toggleScmViewGrouping('launchpad', true)),
156+
registerCommand('gitlens.views.scm.grouped.launchpad.detach', () =>
157+
this.toggleScmViewGrouping('launchpad', false),
158+
),
159+
registerCommand('gitlens.views.scm.grouped.launchpad.regroup', () =>
160+
this.toggleScmViewGrouping('launchpad', true),
161+
),
162+
registerCommand('gitlens.views.scm.grouped.launchpad.setAsDefault', () =>
163+
this.setAsScmGroupedDefaultView('launchpad'),
164+
),
154165
registerCommand('gitlens.views.remotes.regroup', () => this.toggleScmViewGrouping('remotes', true)),
155166
registerCommand('gitlens.views.scm.grouped.remotes.detach', () =>
156167
this.toggleScmViewGrouping('remotes', false),
@@ -218,7 +229,6 @@ export class Views implements Disposable {
218229
return [
219230
(this._draftsView = new DraftsView(this.container)),
220231
(this._fileHistoryView = new FileHistoryView(this.container)),
221-
(this._launchpadView = new LaunchpadView(this.container)),
222232
(this._lineHistoryView = new LineHistoryView(this.container)),
223233
(this._pullRequestView = new PullRequestView(this.container)),
224234
(this._workspacesView = new WorkspacesView(this.container)),
@@ -303,6 +313,13 @@ export class Views implements Disposable {
303313
this._contributorsView = undefined;
304314
}
305315

316+
if (!groupingEnabled || !this._scmGroupedViews.has('launchpad')) {
317+
this._launchpadView ??= new LaunchpadView(this.container);
318+
} else {
319+
this._launchpadView?.dispose();
320+
this._launchpadView = undefined;
321+
}
322+
306323
if (!groupingEnabled || !this._scmGroupedViews.has('remotes')) {
307324
this._remotesView ??= new RemotesView(this.container);
308325
} else {
@@ -398,9 +415,9 @@ export class Views implements Disposable {
398415
return this._homeView;
399416
}
400417

401-
private _launchpadView!: LaunchpadView;
418+
private _launchpadView!: LaunchpadView | undefined;
402419
get launchpad(): LaunchpadView {
403-
return this._launchpadView;
420+
return this._launchpadView ?? this._scmGroupedView.setView('launchpad');
404421
}
405422

406423
private _lineHistoryView!: LineHistoryView;
@@ -595,8 +612,9 @@ const defaultScmGroupedViews: Record<GroupableTreeViewTypes, boolean> = Object.f
595612
tags: true,
596613
worktrees: true,
597614
contributors: true,
598-
repositories: true,
615+
repositories: false,
599616
searchAndCompare: true,
617+
launchpad: false,
600618
});
601619

602620
function getScmGroupedViewsFromConfig() {
@@ -622,5 +640,6 @@ async function updateScmGroupedViewsInConfig(groupedViews: Set<GroupableTreeView
622640
contributors: groupedViews.has('contributors'),
623641
repositories: groupedViews.has('repositories'),
624642
searchAndCompare: groupedViews.has('searchAndCompare'),
643+
launchpad: groupedViews.has('launchpad'),
625644
});
626645
}

src/webviews/apps/commitDetails/commitDetails.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
@font-face {
1212
font-family: 'glicons';
1313
font-display: block;
14-
src: url('#{root}/dist/glicons.woff2?526ab4b01522255557001d936894ca47') format('woff2');
14+
src: url('#{root}/dist/glicons.woff2?888557bf00e2cc234c92d4643f1f0051') format('woff2');
1515
}
1616
</style>
1717
</head>

src/webviews/apps/home/home.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
@font-face {
1212
font-family: 'glicons';
1313
font-display: block;
14-
src: url('#{root}/dist/glicons.woff2?526ab4b01522255557001d936894ca47') format('woff2');
14+
src: url('#{root}/dist/glicons.woff2?888557bf00e2cc234c92d4643f1f0051') format('woff2');
1515
}
1616
</style>
1717
</head>

0 commit comments

Comments
 (0)