Skip to content

Commit 1846f8d

Browse files
committed
Adds enable AI features from integrations menu
1 parent 7be4a00 commit 1846f8d

File tree

5 files changed

+35
-6
lines changed

5 files changed

+35
-6
lines changed

docs/telemetry-events.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,6 +1199,14 @@ void
11991199
void
12001200
```
12011201

1202+
### home/enableAi
1203+
1204+
> Sent when the user chooses to enable AI from the integrations menu
1205+
1206+
```typescript
1207+
void
1208+
```
1209+
12021210
### home/preview/toggled
12031211

12041212
> Sent when the new Home view preview is toggled on/off

src/constants.commands.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ type InternalHomeWebviewCommands =
6262
| 'gitlens.home.abortPausedOperation'
6363
| 'gitlens.ai.explainWip:home'
6464
| 'gitlens.ai.explainBranch:home'
65-
| 'gitlens.home.openRebaseEditor';
65+
| 'gitlens.home.openRebaseEditor'
66+
| 'gitlens.home.enableAi';
6667

6768
type InternalHomeWebviewViewCommands =
6869
| 'gitlens.views.home.account.resync'

src/constants.telemetry.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ export interface TelemetryEvents extends WebviewShowAbortedEvents, WebviewShownE
159159
'home/startWork': void;
160160
/** Sent when the user starts defining a user-specific merge target branch */
161161
'home/changeBranchMergeTarget': void;
162+
/** Sent when the user chooses to enable AI from the integrations menu */
163+
'home/enableAi': void;
162164

163165
/** Sent when the user takes an action on the Launchpad title bar */
164166
'launchpad/title/action': LaunchpadTitleActionEvent;

src/webviews/apps/plus/shared/components/integrations-chip.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -384,11 +384,22 @@ export class GlIntegrationsChip extends LitElement {
384384
></gl-button>
385385
</span>`
386386
: html`<span class="integration__content">
387-
<span class="integration_details"
388-
>GitLens AI features have been
389-
disabled${!this.aiSettingEnabled ? ' via settings' : ' by your GitKraken admin'}</span
390-
>
391-
</span>`}
387+
<span class="integration_details"
388+
>GitLens AI features have been
389+
disabled${!this.aiSettingEnabled ? ' via settings' : ' by your GitKraken admin'}</span
390+
>
391+
</span>
392+
${!this.aiSettingEnabled
393+
? html` <span class="integration__actions">
394+
<gl-button
395+
appearance="toolbar"
396+
href="${createCommandLink<Source>('gitlens.home.enableAi', undefined)}"
397+
tooltip="Re-enable AI Features"
398+
aria-label="Re-enable AI Features"
399+
><code-icon icon="unlock"></code-icon
400+
></gl-button>
401+
</span>`
402+
: nothing}`}
392403
</div>`;
393404
}
394405
}

src/webviews/home/homeWebview.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
358358
registerCommand('gitlens.home.continuePausedOperation', this.continuePausedOperation, this),
359359
registerCommand('gitlens.home.abortPausedOperation', this.abortPausedOperation, this),
360360
registerCommand('gitlens.home.openRebaseEditor', this.openRebaseEditor, this),
361+
registerCommand('gitlens.home.enableAi', this.enableAi, this),
361362
registerCommand('gitlens.ai.explainWip:home', this.explainWip, this),
362363
registerCommand('gitlens.ai.explainBranch:home', this.explainBranch, this),
363364
];
@@ -577,6 +578,12 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
577578
});
578579
}
579580

581+
@log()
582+
private enableAi() {
583+
this.container.telemetry.sendEvent('home/enableAi');
584+
configuration.updateEffective('ai.enabled', true);
585+
}
586+
580587
@log()
581588
private startWork() {
582589
this.container.telemetry.sendEvent('home/startWork');

0 commit comments

Comments
 (0)