Skip to content

Commit

Permalink
Add telemetry for change base on both new and old views
Browse files Browse the repository at this point in the history
Add for compare only on new view
Part of #4403
  • Loading branch information
alexr00 committed Jun 26, 2023
1 parent 29488be commit 0d586fd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/github/createPRViewProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
PUSH_BRANCH,
SET_AUTO_MERGE,
} from '../common/settingKeys';
import { compareIgnoreCase } from '../common/utils';
import { getNonce, IRequestMessage, WebviewViewBase } from '../common/webview';
import {
byRemoteName,
Expand Down Expand Up @@ -397,6 +398,12 @@ export class CreatePullRequestViewProvider extends WebviewViewBase implements vs
if (isBase) {
newBranch = defaultBranch;
this._baseBranch = defaultBranch;
if (compareIgnoreCase(this._baseRemote.owner, owner) !== 0 || compareIgnoreCase(this._baseRemote.repositoryName, repositoryName)) {
/* __GDPR__
"pr.create.changedBaseRemote" : {}
*/
this._folderRepositoryManager.telemetry.sendTelemetryEvent('pr.create.changedBaseRemote');
}
this._baseRemote = { owner, repositoryName };
this._onDidChangeBaseRemote.fire({ owner, repositoryName });
this._onDidChangeBaseBranch.fire(defaultBranch);
Expand Down Expand Up @@ -614,6 +621,12 @@ export class CreatePullRequestViewProvider extends WebviewViewBase implements vs
private async changeBranch(newBranch: string, isBase: boolean): Promise<{ title: string, description: string }> {
let compareBranch: Branch | undefined;
if (isBase) {
if (this._baseBranch !== newBranch) {
/* __GDPR__
"pr.create.changedBaseBranch" : {}
*/
this._folderRepositoryManager.telemetry.sendTelemetryEvent('pr.create.changedBaseBranch');
}
this._baseBranch = newBranch;
this._onDidChangeBaseBranch.fire(newBranch);
} else {
Expand Down
12 changes: 12 additions & 0 deletions src/github/createPRViewProviderNew.ts
Original file line number Diff line number Diff line change
Expand Up @@ -437,9 +437,17 @@ export class CreatePullRequestViewProviderNew extends WebviewViewBase implements
defaultDescription: titleAndDescription.description
};
if (baseRemoteChanged) {
/* __GDPR__
"pr.create.changedBaseRemote" : {}
*/
this._folderRepositoryManager.telemetry.sendTelemetryEvent('pr.create.changedBaseRemote');
this._onDidChangeBaseRemote.fire(this._baseRemote);
}
if (baseBranchChanged) {
/* __GDPR__
"pr.create.changedBaseBranch" : {}
*/
this._folderRepositoryManager.telemetry.sendTelemetryEvent('pr.create.changedBaseBranch');
this._onDidChangeBaseBranch.fire(this._baseBranch);
}
} else {
Expand All @@ -449,6 +457,10 @@ export class CreatePullRequestViewProviderNew extends WebviewViewBase implements
compareBranch: result.branch,
defaultCompareBranch: defaultBranch
};
/* __GDPR__
"pr.create.changedCompare" : {}
*/
this._folderRepositoryManager.telemetry.sendTelemetryEvent('pr.create.changedCompare');
this._onDidChangeCompareRemote.fire(result.remote);
this._onDidChangeCompareBranch.fire(this._compareBranch);
}
Expand Down

0 comments on commit 0d586fd

Please sign in to comment.