Add logging for when check result cards are rendered in the diff
Release-Notes: skip
Change-Id: I1041138b226307f6adea78becc5359f5593c5158
diff --git a/polygerrit-ui/app/constants/reporting.ts b/polygerrit-ui/app/constants/reporting.ts
index 98dd592..ee9b041 100644
--- a/polygerrit-ui/app/constants/reporting.ts
+++ b/polygerrit-ui/app/constants/reporting.ts
@@ -118,6 +118,7 @@
CHECKS_CHIP_CLICKED = 'checks-chip-clicked',
CHECKS_CHIP_LINK_CLICKED = 'checks-chip-link-clicked',
CHECKS_RESULT_ROW_TOGGLE = 'checks-result-row-toggle',
+ CHECKS_RESULT_DIFF_RENDERED = 'checks-result-diff-rendered',
CHECKS_ACTION_TRIGGERED = 'checks-action-triggered',
CHECKS_TAG_CLICKED = 'checks-tag-clicked',
CHECKS_RESULT_FILTER_CHANGED = 'checks-result-filter-changed',
diff --git a/polygerrit-ui/app/elements/checks/gr-diff-check-result.ts b/polygerrit-ui/app/elements/checks/gr-diff-check-result.ts
index 16d3d3e..2a6f024 100644
--- a/polygerrit-ui/app/elements/checks/gr-diff-check-result.ts
+++ b/polygerrit-ui/app/elements/checks/gr-diff-check-result.ts
@@ -24,6 +24,8 @@
import {commentsModelToken} from '../../models/comments/comments-model';
import {subscribe} from '../lit/subscription-controller';
import {changeModelToken} from '../../models/change/change-model';
+import {getAppContext} from '../../services/app-context';
+import {Interaction} from '../../constants/reporting';
@customElement('gr-diff-check-result')
export class GrDiffCheckResult extends LitElement {
@@ -50,6 +52,8 @@
private readonly getCommentsModel = resolve(this, commentsModelToken);
+ private readonly reporting = getAppContext().reportingService;
+
static override get styles() {
return [
fontStyles,
@@ -144,6 +148,14 @@
);
}
+ protected override firstUpdated(_changedProperties: PropertyValues): void {
+ // This component is only used in gr-diff-host, so we can assume that the
+ // result is always rendered in the diff.
+ this.reporting.reportInteraction(Interaction.CHECKS_RESULT_DIFF_RENDERED, {
+ checkName: this.result?.checkName,
+ });
+ }
+
override render() {
if (!this.result) return;
const cat = this.result.category.toLowerCase();
diff --git a/polygerrit-ui/app/models/checks/checks-fakes.ts b/polygerrit-ui/app/models/checks/checks-fakes.ts
index f6fe242..2b187f4 100644
--- a/polygerrit-ui/app/models/checks/checks-fakes.ts
+++ b/polygerrit-ui/app/models/checks/checks-fakes.ts
@@ -101,7 +101,7 @@
checkName: 'FAKE Super Check',
startedTimestamp: new Date(new Date().getTime() - 5 * 60 * 1000),
finishedTimestamp: new Date(new Date().getTime() + 5 * 60 * 1000),
- patchset: 3,
+ patchset: 1,
labelName: 'Verified',
isSingleAttempt: true,
isLatestAttempt: true,