Skip to content

Commit

Permalink
Adds learn more view menu entries
Browse files Browse the repository at this point in the history
  • Loading branch information
eamodio committed May 10, 2024
1 parent 755fa0b commit 7e99c95
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 11 deletions.
45 changes: 44 additions & 1 deletion package.json
Expand Up @@ -7709,6 +7709,22 @@
"category": "GitLens",
"icon": "$(refresh)"
},
{
"command": "gitlens.views.drafts.info",
"title": "Learn about Cloud Patches...",
"category": "GitLens",
"icon": "$(info)"
},
{
"command": "gitlens.views.drafts.setShowAvatarsOn",
"title": "Show Avatars",
"category": "GitLens"
},
{
"command": "gitlens.views.drafts.setShowAvatarsOff",
"title": "Hide Avatars",
"category": "GitLens"
},
{
"command": "gitlens.views.drafts.create",
"title": "Create Cloud Patch...",
Expand Down Expand Up @@ -8349,7 +8365,7 @@
},
{
"command": "gitlens.views.workspaces.info",
"title": "Learn more about GitKraken Workspaces...",
"title": "Learn about GitKraken Workspaces...",
"category": "GitLens",
"icon": "$(info)"
},
Expand Down Expand Up @@ -11048,6 +11064,18 @@
"command": "gitlens.views.drafts.refresh",
"when": "false"
},
{
"command": "gitlens.views.drafts.info",
"when": "false"
},
{
"command": "gitlens.views.drafts.setShowAvatarsOn",
"when": "false"
},
{
"command": "gitlens.views.drafts.setShowAvatarsOff",
"when": "false"
},
{
"command": "gitlens.views.drafts.create",
"when": "false"
Expand Down Expand Up @@ -12823,6 +12851,21 @@
"when": "view =~ /^gitlens\\.views\\.drafts/ && gitlens:plus",
"group": "navigation@1"
},
{
"command": "gitlens.views.drafts.setShowAvatarsOn",
"when": "view =~ /^gitlens\\.views\\.drafts/ && !config.gitlens.views.drafts.avatars",
"group": "5_gitlens@0"
},
{
"command": "gitlens.views.drafts.setShowAvatarsOff",
"when": "view =~ /^gitlens\\.views\\.drafts/ && config.gitlens.views.drafts.avatars",
"group": "5_gitlens@0"
},
{
"command": "gitlens.views.drafts.info",
"when": "view =~ /^gitlens\\.views\\.drafts/",
"group": "8_info@1"
},
{
"command": "gitlens.views.fileHistory.setEditorFollowingOn",
"when": "view =~ /^gitlens\\.views\\.fileHistory/ && gitlens:views:fileHistory:canPin && !gitlens:views:fileHistory:editorFollowing",
Expand Down
2 changes: 1 addition & 1 deletion src/constants.ts
Expand Up @@ -403,7 +403,7 @@ export type TreeViewCommands = `gitlens.views.${
| `setShowAvatars${'On' | 'Off'}`
| `setShowMergeCommits${'On' | 'Off'}`
| `setShowStatistics${'On' | 'Off'}`}`
| `drafts.${'copy' | 'refresh' | 'create' | 'delete'}`
| `drafts.${'copy' | 'refresh' | 'info' | 'create' | 'delete' | `setShowAvatars${'On' | 'Off'}`}`
| `fileHistory.${
| 'copy'
| 'refresh'
Expand Down
18 changes: 13 additions & 5 deletions src/views/draftsView.ts
Expand Up @@ -8,8 +8,10 @@ import { unknownGitUri } from '../git/gitUri';
import type { Draft } from '../gk/models/drafts';
import { ensurePlusFeaturesEnabled } from '../plus/gk/utils';
import { executeCommand } from '../system/command';
import { configuration } from '../system/configuration';
import { gate } from '../system/decorators/gate';
import { groupByFilterMap } from '../system/iterable';
import { openUrl } from '../system/utils';
import { CacheableChildrenViewNode } from './nodes/abstract/cacheableChildrenViewNode';
import { DraftNode } from './nodes/draftNode';
import { GroupingNode } from './nodes/groupingNode';
Expand Down Expand Up @@ -115,11 +117,11 @@ export class DraftsView extends ViewBase<'drafts', DraftsViewNode, DraftsViewCon
void this.container.viewCommands;

return [
// registerViewCommand(
// this.getQualifiedCommand('info'),
// () => env.openExternal(Uri.parse('https://help.gitkraken.com/gitlens/side-bar/#drafts-☁%ef%b8%8f')),
// this,
// ),
registerViewCommand(
this.getQualifiedCommand('info'),
() => openUrl('https://help.gitkraken.com/gitlens/side-bar/#drafts-☁%ef%b8%8f'),
this,
),
registerViewCommand(
this.getQualifiedCommand('copy'),
() => executeCommand(Commands.ViewsCopy, this.activeSelection, this.selection),
Expand Down Expand Up @@ -153,6 +155,8 @@ export class DraftsView extends ViewBase<'drafts', DraftsViewNode, DraftsViewCon
},
this,
),
registerViewCommand(this.getQualifiedCommand('setShowAvatarsOn'), () => this.setShowAvatars(true), this),
registerViewCommand(this.getQualifiedCommand('setShowAvatarsOff'), () => this.setShowAvatars(false), this),
];
}

Expand Down Expand Up @@ -185,4 +189,8 @@ export class DraftsView extends ViewBase<'drafts', DraftsViewNode, DraftsViewCon

return node;
}

private setShowAvatars(enabled: boolean) {
return configuration.updateEffective(`views.${this.configKey}.avatars` as const, enabled);
}
}
7 changes: 3 additions & 4 deletions src/views/workspacesView.ts
@@ -1,5 +1,5 @@
import type { CancellationToken, Disposable } from 'vscode';
import { env, ProgressLocation, TreeItem, TreeItemCollapsibleState, Uri, window } from 'vscode';
import { ProgressLocation, TreeItem, TreeItemCollapsibleState, window } from 'vscode';
import type { WorkspacesViewConfig } from '../config';
import { Commands, previewBadge } from '../constants';
import type { Container } from '../container';
Expand All @@ -9,7 +9,7 @@ import { ensurePlusFeaturesEnabled } from '../plus/gk/utils';
import { executeCommand } from '../system/command';
import { gate } from '../system/decorators/gate';
import { debug } from '../system/decorators/log';
import { openWorkspace } from '../system/utils';
import { openUrl, openWorkspace } from '../system/utils';
import { ViewNode } from './nodes/abstract/viewNode';
import { MessageNode } from './nodes/common';
import { RepositoriesNode } from './nodes/repositoriesNode';
Expand Down Expand Up @@ -147,8 +147,7 @@ export class WorkspacesView extends ViewBase<'workspaces', WorkspacesViewNode, W
return [
registerViewCommand(
this.getQualifiedCommand('info'),
() =>
env.openExternal(Uri.parse('https://help.gitkraken.com/gitlens/side-bar/#workspaces-☁%ef%b8%8f')),
() => openUrl('https://help.gitkraken.com/gitlens/side-bar/#workspaces-☁%ef%b8%8f'),
this,
),
registerViewCommand(
Expand Down

0 comments on commit 7e99c95

Please sign in to comment.