Add reporting to apply fixes in checks
This is consistent with applying user or AI fixes with 1-click
Release-Notes: skip
Change-Id: Ic879f65969188115685b9cea9de8f856ff5d0f9c
diff --git a/polygerrit-ui/app/elements/checks/gr-checks-fix-preview.ts b/polygerrit-ui/app/elements/checks/gr-checks-fix-preview.ts
index c13ef70..e91d9c9 100644
--- a/polygerrit-ui/app/elements/checks/gr-checks-fix-preview.ts
+++ b/polygerrit-ui/app/elements/checks/gr-checks-fix-preview.ts
@@ -9,6 +9,7 @@
import {getAppContext} from '../../services/app-context';
import {EDIT, BasePatchSetNum, RepoName} from '../../types/common';
import {anyLineTooLong} from '../../utils/diff-util';
+import {Timing} from '../../constants/reporting';
import {
DiffInfo,
DiffLayer,
@@ -89,6 +90,8 @@
hide_line_length_indicator: true,
};
+ private readonly reporting = getAppContext().reportingService;
+
private readonly restApiService = getAppContext().restApiService;
private readonly getChangeModel = resolve(this, changeModelToken);
@@ -265,12 +268,17 @@
if (!changeNum || !basePatchNum || !this.fixSuggestionInfo) return;
this.applyingFix = true;
+ this.reporting.time(Timing.APPLY_FIX_LOAD);
const res = await this.restApiService.applyFixSuggestion(
changeNum,
basePatchNum,
this.fixSuggestionInfo.replacements
);
this.applyingFix = false;
+ this.reporting.timeEnd(Timing.APPLY_FIX_LOAD, {
+ method: '1-click',
+ description: this.fixSuggestionInfo.description,
+ });
if (res?.ok) this.navigateToEditPatchset();
}