Skip to content

Commit 656f4bf

Browse files
Removes todo on comment and sets up similar event for startWork
1 parent b97eba7 commit 656f4bf

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

src/constants.commands.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,8 @@ export type CustomViewCommands =
337337
| 'gitlens.home.createPullRequest'
338338
| 'gitlens.home.openWorktree'
339339
| 'gitlens.home.switchToBranch'
340-
| 'gitlens.home.createBranch';
340+
| 'gitlens.home.createBranch'
341+
| 'gitlens.home.startWork';
341342

342343
export type TreeViewCommands = `gitlens.views.${
343344
| `branches.${

src/constants.telemetry.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,10 @@ export type TelemetryEvents = {
229229
enabled: boolean;
230230
version: string;
231231
};
232-
/** Temporary - sent when the user chooses to create a branch from the home view */
233-
/** TODO: Replace this once we have source on all git commands*/
232+
/** Sent when the user chooses to create a branch from the home view */
234233
'home/createBranch': void;
234+
/** Sent when the user chooses to start work on an issue from the home view */
235+
'home/startWork': void;
235236

236237
/** Sent when the Commit Graph is shown */
237238
'timeline/shown': WebviewShownEventData & TimelineShownEventData;

src/webviews/apps/plus/home/components/launchpad.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ import { SignalWatcher } from '@lit-labs/signals';
33
import type { TemplateResult } from 'lit';
44
import { css, html, LitElement, nothing } from 'lit';
55
import { customElement, state } from 'lit/decorators.js';
6-
import { Commands } from '../../../../../constants.commands';
76
import type { LaunchpadCommandArgs } from '../../../../../plus/launchpad/launchpad';
8-
import type { StartWorkCommandArgs } from '../../../../../plus/startWork/startWork';
97
import { createCommandLink } from '../../../../../system/commands';
108
import { pluralize } from '../../../../../system/string';
119
import type { GetLaunchpadSummaryResponse, State } from '../../../../home/protocol';
@@ -112,10 +110,7 @@ export class GlLaunchpad extends SignalWatcher(LitElement) {
112110
});
113111

114112
get startWorkCommand() {
115-
return createCommandLink<StartWorkCommandArgs>(Commands.StartWork, {
116-
command: 'startWork',
117-
source: 'home',
118-
});
113+
return createCommandLink<undefined>('gitlens.home.startWork', undefined);
119114
}
120115

121116
get createBranchCommand() {

src/webviews/home/homeWebview.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import type { Subscription } from '../../plus/gk/account/subscription';
2929
import { isSubscriptionStatePaidOrTrial } from '../../plus/gk/account/subscription';
3030
import type { SubscriptionChangeEvent } from '../../plus/gk/account/subscriptionService';
3131
import { getLaunchpadSummary } from '../../plus/launchpad/utils';
32+
import type { StartWorkCommandArgs } from '../../plus/startWork/startWork';
3233
import type { ShowInCommitGraphCommandArgs } from '../../plus/webviews/graph/protocol';
3334
import { showRepositoryPicker } from '../../quickpicks/repositoryPicker';
3435
import type { Deferrable } from '../../system/function';
@@ -279,6 +280,7 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
279280
registerCommand('gitlens.home.fetch', this.fetch, this),
280281
registerCommand('gitlens.home.openInGraph', this.openInGraph, this),
281282
registerCommand('gitlens.home.createBranch', this.createBranch, this),
283+
registerCommand('gitlens.home.startWork', this.startWork, this),
282284
];
283285
}
284286

@@ -391,6 +393,14 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
391393
});
392394
}
393395

396+
private startWork() {
397+
this.container.telemetry.sendEvent('home/startWork');
398+
void executeCommand<StartWorkCommandArgs>(Commands.StartWork, {
399+
command: 'startWork',
400+
source: 'home',
401+
});
402+
}
403+
394404
private onTogglePreviewEnabled(isEnabled?: boolean) {
395405
if (isEnabled === undefined) {
396406
isEnabled = !this.getPreviewEnabled();

0 commit comments

Comments
 (0)