Skip to content

Commit c2d747b

Browse files
authored
Replaces "Open in Editor" link in Launchpad with a link to gk.dev
[GLVSC-504] (#3349) * Replaces the "open in editor" link with "open on web" link * Opens Launchpad on the domain that corresponds to the configured environment * Moves `getGkDevUri` from the ServerConnection to the Container * Removes unused code from FocusCommand * Removes the gkdev urls from constants * Updates changelog
1 parent a3b1131 commit c2d747b

File tree

10 files changed

+43
-41
lines changed

10 files changed

+43
-41
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
1717
- Renames _Open Inspect_ to _Inspect Commit Details_
1818
- Renames _Open Line Inspect_ to _Inspect Line Commit Details_
1919
- Renames _Open Details_ to _Inspect Commit Details_
20+
- Replaces _Open in Editor_ link in the Launchpad with a link to _gitkraken.dev_
2021

2122
### Fixed
2223

src/constants.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ export const urls = Object.freeze({
4545
cli: 'https://gitkraken.com/cli?utm_source=gitlens-extension&utm_medium=in-app-links',
4646
browserExtension: 'https://gitkraken.com/browser-extension?utm_source=gitlens-extension&utm_medium=in-app-links',
4747
desktop: 'https://gitkraken.com/git-client?utm_source=gitlens-extension&utm_medium=in-app-links',
48-
gkdev: 'https://gitkraken.dev?utm_source=gitlens-extension&utm_medium=in-app-links',
4948

5049
releaseNotes: 'https://help.gitkraken.com/gitlens/gitlens-release-notes-current/',
5150
releaseAnnouncement:
@@ -1286,7 +1285,7 @@ export type TelemetryEvents = {
12861285

12871286
/** Sent when the user takes an action on a launchpad item */
12881287
'launchpad/title/action': LaunchpadEventData & {
1289-
action: 'feedback' | 'open-in-editor' | 'refresh' | 'settings';
1288+
action: 'feedback' | 'open-on-gkdev' | 'refresh' | 'settings';
12901289
};
12911290

12921291
/** Sent when the user takes an action on a launchpad item */

src/container.ts

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { ConfigurationChangeEvent, Disposable, Event, ExtensionContext } from 'vscode';
2-
import { EventEmitter, ExtensionMode } from 'vscode';
2+
import { EventEmitter, ExtensionMode, Uri } from 'vscode';
33
import { getSupportedGitProviders, getSupportedRepositoryPathMappingProvider } from '@env/providers';
44
import type { AIProviderService } from './ai/aiProviderService';
55
import { Autolinks } from './annotations/autolinks';
@@ -645,7 +645,7 @@ export class Container {
645645
private _integrations: IntegrationService | undefined;
646646
get integrations(): IntegrationService {
647647
if (this._integrations == null) {
648-
this._disposables.push((this._integrations = new IntegrationService(this, this._connection)));
648+
this._disposables.push((this._integrations = new IntegrationService(this)));
649649
}
650650
return this._integrations;
651651
}
@@ -918,6 +918,31 @@ export class Container {
918918
},
919919
});
920920
}
921+
922+
@memoize()
923+
private get baseGkDevUri(): Uri {
924+
if (this.env === 'staging') {
925+
return Uri.parse('https://staging.gitkraken.dev');
926+
}
927+
928+
if (this.env === 'dev') {
929+
return Uri.parse('https://dev.gitkraken.dev');
930+
}
931+
932+
return Uri.parse('https://gitkraken.dev');
933+
}
934+
935+
getGkDevUri(path?: string, query?: string): Uri {
936+
let uri = path != null ? Uri.joinPath(this.baseGkDevUri, path) : this.baseGkDevUri;
937+
if (query != null) {
938+
uri = uri.with({ query: query });
939+
}
940+
return uri;
941+
}
942+
943+
generateWebGkDevUrl(path?: string): string {
944+
return this.getGkDevUri(path, '?source=gitlens').toString();
945+
}
921946
}
922947

923948
export function isContainer(container: any): container is Container {

src/plus/drafts/draftsService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,7 @@ export class DraftService implements Disposable {
910910
generateWebUrl(draft: Draft): string;
911911
generateWebUrl(draftOrDraftId: Draft | string): string {
912912
const id = typeof draftOrDraftId === 'string' ? draftOrDraftId : draftOrDraftId.id;
913-
return this.connection.getGkDevUri(`/drafts/${id}`, `?source=gitlens`).toString();
913+
return this.container.generateWebGkDevUrl(`/drafts/${id}`);
914914
}
915915
}
916916

src/plus/focus/focus.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import {
1919
FeedbackQuickInputButton,
2020
LaunchpadSettingsQuickInputButton,
2121
MergeQuickInputButton,
22-
OpenInEditorQuickInputButton,
2322
OpenOnGitHubQuickInputButton,
2423
OpenOnWebQuickInputButton,
2524
PinQuickInputButton,
@@ -29,13 +28,12 @@ import {
2928
UnsnoozeQuickInputButton,
3029
} from '../../commands/quickCommand.buttons';
3130
import type { LaunchpadTelemetryContext, Source, Sources, TelemetryEvents } from '../../constants';
32-
import { Commands, previewBadge } from '../../constants';
31+
import { previewBadge } from '../../constants';
3332
import type { Container } from '../../container';
3433
import type { QuickPickItemOfT } from '../../quickpicks/items/common';
3534
import { createQuickPickItemOfT, createQuickPickSeparator } from '../../quickpicks/items/common';
3635
import type { DirectiveQuickPickItem } from '../../quickpicks/items/directive';
3736
import { createDirectiveQuickPickItem, Directive } from '../../quickpicks/items/directive';
38-
import { executeCommand } from '../../system/command';
3937
import { getScopedCounter } from '../../system/counter';
4038
import { fromNow } from '../../system/date';
4139
import { interpolate, pluralize } from '../../system/string';
@@ -463,7 +461,7 @@ export class FocusCommand extends QuickCommand<State> {
463461
items: items,
464462
buttons: [
465463
FeedbackQuickInputButton,
466-
OpenInEditorQuickInputButton,
464+
OpenOnWebQuickInputButton,
467465
LaunchpadSettingsQuickInputButton,
468466
RefreshQuickInputButton,
469467
],
@@ -480,9 +478,9 @@ export class FocusCommand extends QuickCommand<State> {
480478
void openUrl('https://github.com/gitkraken/vscode-gitlens/discussions/3286');
481479
break;
482480

483-
case OpenInEditorQuickInputButton:
484-
this.sendTitleActionTelemetry('open-in-editor', context);
485-
void executeCommand(Commands.ShowFocusPage);
481+
case OpenOnWebQuickInputButton:
482+
this.sendTitleActionTelemetry('open-on-gkdev', context);
483+
void openUrl(this.container.focus.generateWebUrl());
486484
break;
487485
case RefreshQuickInputButton:
488486
this.sendTitleActionTelemetry('refresh', context);

src/plus/focus/focusProvider.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,10 @@ export class FocusProvider implements Disposable {
472472
await this.container.deepLinks.processDeepLinkUri(deepLinkUrl, false);
473473
}
474474

475+
generateWebUrl(): string {
476+
return this.container.generateWebGkDevUrl('/launchpad');
477+
}
478+
475479
private getItemBranchDeepLink(item: FocusItem, action?: DeepLinkActionType): Uri | undefined {
476480
if (item.type !== 'pullrequest' || item.headRef == null || item.repoIdentity?.remote?.url == null)
477481
return undefined;

src/plus/gk/account/authenticationConnection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export class AuthenticationConnection implements Disposable {
7373
Uri.parse(`${env.uriScheme}://${this.container.context.extension.id}/${AuthenticationUriPathPrefix}`),
7474
);
7575

76-
const uri = this.connection.getGkDevUri(
76+
const uri = this.container.getGkDevUri(
7777
signUp ? 'register' : 'login',
7878
`${scopes.includes('gitlens') ? 'source=gitlens&' : ''}state=${encodeURIComponent(
7979
gkstate,

src/plus/gk/account/subscriptionService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ export class SubscriptionService implements Disposable {
684684
} else {
685685
const activeOrgId = this._subscription.activeOrganization?.id;
686686
void env.openExternal(
687-
this.connection.getGkDevUri(
687+
this.container.getGkDevUri(
688688
'purchase',
689689
activeOrgId ? `source=gitlens&org=${activeOrgId}` : 'source=gitlens',
690690
),

src/plus/gk/serverConnection.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,6 @@ export class ServerConnection implements Disposable {
2626

2727
dispose() {}
2828

29-
@memoize()
30-
private get baseGkDevUri(): Uri {
31-
if (this.container.env === 'staging') {
32-
return Uri.parse('https://staging.gitkraken.dev');
33-
}
34-
35-
if (this.container.env === 'dev') {
36-
return Uri.parse('https://dev.gitkraken.dev');
37-
}
38-
39-
return Uri.parse('https://gitkraken.dev');
40-
}
41-
42-
getGkDevUri(path?: string, query?: string) {
43-
let uri = path != null ? Uri.joinPath(this.baseGkDevUri, path) : this.baseGkDevUri;
44-
if (query != null) {
45-
uri = uri.with({ query: query });
46-
}
47-
return uri;
48-
}
49-
5029
@memoize()
5130
private get accountsUri(): Uri {
5231
if (this.container.env === 'staging') {

src/plus/integrations/integrationService.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { debug, log } from '../../system/decorators/log';
1212
import { take } from '../../system/event';
1313
import { filterMap, flatten } from '../../system/iterable';
1414
import type { SubscriptionChangeEvent } from '../gk/account/subscriptionService';
15-
import type { ServerConnection } from '../gk/serverConnection';
1615
import { supportedCloudIntegrationIds, toIntegrationId } from './authentication/models';
1716
import type {
1817
HostingIntegration,
@@ -52,10 +51,7 @@ export class IntegrationService implements Disposable {
5251
private readonly _disposable: Disposable;
5352
private _integrations = new Map<IntegrationKey, Integration>();
5453

55-
constructor(
56-
private readonly container: Container,
57-
private readonly connection: ServerConnection,
58-
) {
54+
constructor(private readonly container: Container) {
5955
this._disposable = Disposable.from(
6056
configuration.onDidChange(e => {
6157
if (configuration.changed(e, 'remotes')) {
@@ -126,7 +122,7 @@ export class IntegrationService implements Disposable {
126122
query += `&connect=${integrationId}`;
127123
}
128124

129-
await env.openExternal(this.connection.getGkDevUri('settings/integrations', query));
125+
await env.openExternal(this.container.getGkDevUri('settings/integrations', query));
130126
take(
131127
window.onDidChangeWindowState,
132128
2,

0 commit comments

Comments
 (0)