Skip to content

Commit

Permalink
DEVPROD-8371 Rename all spruce analytics events (#242)
Browse files Browse the repository at this point in the history
  • Loading branch information
khelif96 authored Jul 24, 2024
1 parent f578939 commit de87f9f
Show file tree
Hide file tree
Showing 127 changed files with 579 additions and 466 deletions.
3 changes: 3 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ DEVPROD-NNNNN
### Testing
<!-- add a description of how you tested it -->

<!-- Have you have updated the analytics documentation if necessary?
https://docs.google.com/spreadsheets/d/1s4_nq8ZiphXp5Uq_-9HT6GPqz-KOyaq6HuvmXYaSNzg/edit?usp=sharing -->

### Evergreen PR
<!-- link to a corresponding Evergreen PR if applicable -->
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe("Dropdown Menu of Patch Actions", () => {
getPatchCardByDescription(patchWithVersionOnCommitQueue).within(() => {
cy.dataCy("patch-card-dropdown").click();
});
cy.dataCy("reconfigure-link").should("be.disabled");
cy.dataCy("reconfigure-link").should("have.attr", "aria-disabled", "true");
});

it("'Schedule' link opens modal and clicking on 'Cancel' closes it.", () => {
Expand Down
7 changes: 6 additions & 1 deletion apps/spruce/cypress/integration/version/action_buttons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,12 @@ describe("Action Buttons", () => {
cy.dataCy("card-dropdown").should("be.visible");
});
it("Reconfigure link is disabled for mainline commits", () => {
cy.dataCy("reconfigure-link").should("have.attr", "disabled");
cy.dataCy("reconfigure-link").should("be.visible");
cy.dataCy("reconfigure-link").should(
"have.attr",
"aria-disabled",
"true",
);
});
it("Should not be able to enqueue the version", () => {
cy.dataCy("enqueue-patch").should("be.disabled");
Expand Down
18 changes: 16 additions & 2 deletions apps/spruce/src/analytics/addPageAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ export interface Analytics<Action> {
}

export type AnalyticsObject =
| "AllHostsPage"
| "Annotations"
| "April Fools"
| "Breadcrumb"
| "CommitQueue"
| "Configure"
| "DistroSettings"
| "HostPage"
| "HostsTable"
| "JobLogs"
| "Navbar"
| "Patch"
Expand All @@ -34,8 +34,22 @@ interface RequiredProperties {
object: AnalyticsObject;
}

type ActionTypePrefixes =
| "Changed"
| "Clicked"
| "Created"
| "Deleted"
| "Redirected"
| "Filtered"
| "Saved"
| "Sorted"
| "Toggled"
| "Viewed"
| "Used"
| "System Event";

export interface ActionType {
name: string;
name: `${ActionTypePrefixes}${string}`;
}

export interface Properties {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useAnalyticsRoot } from "analytics/useAnalyticsRoot";

type Action = { name: "2024 Boilerplate!" };
type Action = { name: "Used 2024 Boilerplate!" };

export const useAprilFoolsAnalytics = () =>
useAnalyticsRoot<Action>("April Fools");
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useAnalyticsRoot } from "analytics/useAnalyticsRoot";

type Action = {
name: "Click Link";
name: "Clicked link";
link: "myPatches" | "patch" | "version" | "waterfall" | "displayTask";
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { useAnalyticsRoot } from "analytics/useAnalyticsRoot";
import { slugs } from "constants/routes";

type Action =
| { name: "Save distro"; section: string }
| { name: "Create new distro"; newDistroId: string }
| { name: "Duplicate distro"; newDistroId: string };
| { name: "Saved distro"; section: string }
| { name: "Created new distro"; newDistroId: string }
| { name: "Clicked duplicate distro"; newDistroId: string };

export const useDistroSettingsAnalytics = () => {
const { [slugs.distroId]: distroId } = useParams();
Expand Down
14 changes: 7 additions & 7 deletions apps/spruce/src/analytics/hostsTable/useHostsTableAnalytics.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { useAnalyticsRoot } from "analytics/useAnalyticsRoot";

type Action =
| { name: "Filter Hosts"; filterBy: string | string[] }
| { name: "Sort Hosts" }
| { name: "Change Page Size" }
| { name: "Restart Jasper" }
| { name: "Reprovision Host" }
| { name: "Update Status"; status: string };
| { name: "Filtered hosts table"; filterBy: string | string[] }
| { name: "Sorted hosts table" }
| { name: "Changed page size"; pageSize: number }
| { name: "Clicked restart jasper button" }
| { name: "Clicked reprovision host button" }
| { name: "Clicked update host status button"; status: string };

export const useHostsTableAnalytics = (isHostPage?: boolean) =>
useAnalyticsRoot<Action>(isHostPage ? "HostPage" : "HostsTable");
useAnalyticsRoot<Action>(isHostPage ? "HostPage" : "AllHostsPage");
2 changes: 0 additions & 2 deletions apps/spruce/src/analytics/joblogs/useJobLogsAnalytics.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { useAnalyticsRoot } from "analytics/useAnalyticsRoot";

type Action =
| { name: "Filter Job Logs"; filterBy: string }
| { name: "Clicked HTML testlog url"; testId: string }
| {
name: "Clicked complete logs link";
buildId?: string;
Expand Down
31 changes: 15 additions & 16 deletions apps/spruce/src/analytics/navbar/useNavbarAnalytics.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
import { useAnalyticsRoot } from "analytics/useAnalyticsRoot";

type Action =
| { name: "Click Admin Link" }
| { name: "Click Legacy UI Link" }
| { name: "Click Logo Link" }
| { name: "Click Waterfall Link" }
| { name: "Click Legacy Waterfall Link" }
| { name: "Click My Patches Link" }
| { name: "Click My Hosts Link" }
| { name: "Click All Hosts Link" }
| { name: "Click Distros Link" }
| { name: "Click Projects Link" }
| { name: "Click Project Patches Link" }
| { name: "Click EVG Wiki Link" }
| { name: "Click Preferences Link" }
| { name: "Click Notifications Link" }
| { name: "Click Task Queue Link" }
| { name: "Click Commit Queue Link" };
| { name: "Clicked admin settings link" }
| { name: "Clicked legacy UI link" }
| { name: "Clicked logo link" }
| { name: "Clicked waterfall link" }
| { name: "Clicked my patches link" }
| { name: "Clicked my hosts link" }
| { name: "Clicked all hosts link" }
| { name: "Clicked distro settings link" }
| { name: "Clicked project settings link" }
| { name: "Clicked project patches link" }
| { name: "Clicked EVG wiki link" }
| { name: "Clicked preferences link" }
| { name: "Clicked notifications link" }
| { name: "Clicked task queue link" }
| { name: "Clicked commit queue link" };

export const useNavbarAnalytics = () => useAnalyticsRoot<Action>("Navbar");
37 changes: 4 additions & 33 deletions apps/spruce/src/analytics/patch/usePatchAnalytics.ts
Original file line number Diff line number Diff line change
@@ -1,52 +1,23 @@
import { useQuery } from "@apollo/client";
import { useAnalyticsRoot } from "analytics/useAnalyticsRoot";
import {
SaveSubscriptionForUserMutationVariables,
PatchQuery,
PatchQueryVariables,
TaskSortCategory,
} from "gql/generated/types";
import { PATCH } from "gql/queries";

type Action =
| { name: "Filter Tasks"; filterBy: string }
| {
name: "Sort Tasks Table";
sortBy:
| TaskSortCategory.Name
| TaskSortCategory.Status
| TaskSortCategory.BaseStatus
| TaskSortCategory.Variant;
}
| {
name: "Filter Downstream Tasks Table";
name: "Filtered downstream tasks table";
filterBy: string | string[];
}
| {
name: "Sort Downstream Tasks Table";
name: "Sorted downstream tasks table";
sortBy: TaskSortCategory | TaskSortCategory[];
}
| { name: "Restart"; abort: boolean }
| { name: "Schedule" }
| { name: "Set Priority"; priority: number }
| { name: "Unschedule"; abort: boolean }
| { name: "Change Page Size" }
| { name: "Change Tab"; tab: string }
| { name: "Click Grouped Task Square"; taskSquareStatuses: string | string[] }
| { name: "Click Build Variant Grid Link" }
| { name: "Click Reconfigure Link" }
| { name: "Enqueue" }
| { name: "Open Notification Modal" }
| { name: "Click Task Table Link"; taskId: string }
| { name: "Clear all filter" }
| {
name: "Add Notification";
subscription: SaveSubscriptionForUserMutationVariables["subscription"];
}
| { name: "Toggle Display Task Dropdown"; expanded: boolean }
| { name: "Set Patch Visibility"; hidden: boolean }
| { name: "Click Base Commit Link" }
| { name: "Open Schedule Tasks Modal" };
| { name: "Toggled patch visibility"; hidden: boolean }
| { name: "Clicked patch reconfigure link" };

export const usePatchAnalytics = (id: string) => {
const { data: eventData } = useQuery<PatchQuery, PatchQueryVariables>(PATCH, {
Expand Down
16 changes: 9 additions & 7 deletions apps/spruce/src/analytics/patches/useProjectPatchesAnalytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import { useAnalyticsRoot } from "analytics/useAnalyticsRoot";
import { slugs } from "constants/routes";

type Action =
| { name: "Change Page Size" }
| { name: "Change Project" }
| { name: "Click Patch Link" }
| { name: "Click Variant Icon"; variantIconStatus: string }
| { name: "Filter Commit Queue" }
| { name: "Filter Hidden"; includeHidden: boolean }
| { name: "Filter Patches"; filterBy: string };
| { name: "Changed page size" }
| { name: "Changed project"; projectIdentifier: string }
| { name: "Clicked patch link" }
| {
name: "Filtered for patches";
filterBy: string;
includeHidden: boolean;
includeCommitQueue: boolean;
};

export const useProjectPatchesAnalytics = () => {
const { [slugs.projectIdentifier]: projectIdentifier } = useParams();
Expand Down
14 changes: 8 additions & 6 deletions apps/spruce/src/analytics/patches/useUserPatchesAnalytics.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { useAnalyticsRoot } from "analytics/useAnalyticsRoot";

type Action =
| { name: "Change Page Size" }
| { name: "Click Patch Link" }
| { name: "Click Variant Icon"; variantIconStatus: string }
| { name: "Filter Commit Queue" }
| { name: "Filter Hidden"; includeHidden: boolean }
| { name: "Filter Patches"; filterBy: string };
| { name: "Changed page size" }
| { name: "Clicked patch link" }
| {
name: "Filtered for patches";
filterBy: string;
includeHidden: boolean;
includeCommitQueue: boolean;
};

export const useUserPatchesAnalytics = () =>
useAnalyticsRoot<Action>("UserPatches");
25 changes: 12 additions & 13 deletions apps/spruce/src/analytics/preferences/usePreferencesAnalytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@ import { useAnalyticsRoot } from "analytics/useAnalyticsRoot";
import { UpdateUserSettingsMutationVariables } from "gql/generated/types";

type Action =
| { name: "Change Tab"; tab: string }
| { name: "Save Profile Info"; params: UpdateUserSettingsMutationVariables }
| { name: "Save Notifications"; params: UpdateUserSettingsMutationVariables }
| { name: "Clear Subscriptions" }
| { name: "CLI Download Link"; downloadName: string }
| { name: "Download Auth File" }
| { name: "Reset Key" }
| { name: "Create new public key" }
| { name: "Update public key" }
| { name: "Delete public key" }
| { name: "Opt into Spruce" }
| { name: "Opt out of Spruce" }
| { name: "Toggle polling"; value: "Enabled" | "Disabled" };
| { name: "Changed tab"; tab: string }
| { name: "Saved profile info"; params: UpdateUserSettingsMutationVariables }
| { name: "Saved notifications"; params: UpdateUserSettingsMutationVariables }
| { name: "Deleted subscriptions" }
| { name: "Clicked CLI download link"; downloadName: string }
| { name: "Clicked download auth file" }
| { name: "Clicked reset API key" }
| { name: "Created new public key" }
| { name: "Changed public key" }
| { name: "Deleted public key" }
| { name: "Toggled spruce"; value: "Enabled" | "Disabled" }
| { name: "Toggled polling"; value: "Enabled" | "Disabled" };

export const usePreferencesAnalytics = () =>
useAnalyticsRoot<Action>("PreferencesPages");
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,49 @@ import {
SaveSubscriptionForUserMutationVariables,
} from "gql/generated/types";

// The comments below are used to indicate which pageType the action is relevant to (e.g. "Commit chart")
type pageType = "Commit chart" | "Task history" | "Variant history";
type Action =
| { name: "Changed page"; direction: "previous" | "next" } // "Commit chart"
| { name: "Changed project"; project: string } // "Commit chart"
| { name: "Clicked column header" } // "Task history" | "Variant history"
| { name: "Clicked task cell"; taskStatus: string } // "Task history" | "Variant history"
| {
name: "Click task cell";
taskStatus: string;
}
| { name: "Paginate"; direction: "previous" | "next" }
| { name: "Select project" }
| { name: "Submit failed test filter" }
| { name: "Clear all badges" }
| { name: "Click grouped task status badge"; statuses: string[] }
| { name: "Click task status icon"; status: string }
| {
name: "Click commit label";
name: "Clicked commit label";
link: "jira" | "githash" | "upstream project";
commitType: "active" | "inactive";
}
| { name: "Click variant label" }
| { name: "Select chart view option"; viewOption: string }
| { name: "Click column header" }
| { name: "Filter by task" }
| { name: "Filter by requester"; requesters: string[] }
| { name: "Filter by task status"; statuses: string[] }
| { name: "Toggle task icons legend"; toggle: "open" | "close" }
| { name: "Open hidden commits modal" }
| { name: "Remove badge" }
| {
name: "Filter by build variant";
}
| { name: "Toggle folded commit"; toggle: "open" | "close" }
| {
name: "Toggle commit chart label tooltip";
}
| { name: "Open Notification Modal" }
| { name: "Open Git Commit Search Modal" }
| { name: "Search for commit"; commit: string }
} // "Task history" | "Variant history" | "Commit chart"
| { name: "Clicked grouped task status badge"; statuses: string[] }
| { name: "Clicked task status icon"; status: string } // "Commit chart"
| { name: "Clicked variant label" } // "Commit chart"
| {
name: "Add Notification";
name: "Created notification";
subscription: SaveSubscriptionForUserMutationVariables["subscription"];
}
| { name: "Toggle view"; toggle: ProjectHealthView }
} // "Commit chart"
| { name: "Deleted a badge" } // "Variant history" | "Task history" | "Commit chart"
| { name: "Deleted all badges" } // "Variant history" | "Task history" | "Commit chart"
| { name: "Filtered by build variant" } // "Variant history" | "Task history"
| { name: "Filtered by requester"; requesters: string[] } // "Commit chart"
| { name: "Filtered by task" } // "Commit chart"
| { name: "Filtered by task status"; statuses: string[] } // "Commit chart"
| { name: "Filtered failed tests" } // "Variant history" | "Task history"
| { name: "Filtered for git commit"; commit: string } // "Commit chart"
| {
name: "Redirect to project identifier";
name: "Redirected to project identifier";
projectId: string;
projectIdentifier: string;
};
} // "Commit chart"
| { name: "Toggled chart view option"; viewOption: string } // "Commit chart"
| { name: "Toggled folded commit"; toggle: "open" | "close" } // "Variant history" | "Task history"
| { name: "Toggled icon view mode"; iconView: ProjectHealthView } // "Commit chart"
| { name: "Toggled task icon legend"; open: boolean } // "Task history" | "Variant history" | "Commit chart"
| { name: "Viewed commit chart label tooltip" } // "Commit chart"
| { name: "Viewed git commit search modal" } // "Commit chart"
| { name: "Viewed hidden commits modal" } // "Commit chart"
| { name: "Viewed notification modal" } // "Commit chart"
| { name: "Viewed project health page" } // "Commit chart"
| { name: "Viewed variant history page" } // "Commit chart"
| { name: "Viewed task history page" }; // "Commit chart"

export const useProjectHealthAnalytics = (p: { page: pageType }) =>
useAnalyticsRoot<Action>("ProjectHealthPages", { page: p.page });
Loading

0 comments on commit de87f9f

Please sign in to comment.