Skip to content

Commit fd42a4b

Browse files
committed
Add GitHub issue icon, add tracking events
1 parent 10d4c3f commit fd42a4b

File tree

12 files changed

+187
-24
lines changed

12 files changed

+187
-24
lines changed

src/components/Agentic/IncidentDetails/AdditionalInfo/Artifacts/index.tsx

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
import { createColumnHelper } from "@tanstack/react-table";
22
import { useMemo } from "react";
33
import { useParams } from "react-router";
4+
import { useStableSearchParams } from "../../../../../hooks/useStableSearchParams";
45
import { useGetIncidentQuery } from "../../../../../redux/services/digma";
56
import type {
67
ArtifactType,
78
IncidentArtifact
89
} from "../../../../../redux/services/types";
9-
import { PullRequestIcon } from "../../../../common/icons/24px/PullRequestIcon";
10+
import { sendUserActionTrackingEvent } from "../../../../../utils/actions/sendUserActionTrackingEvent";
11+
import { GitHubIssueIcon } from "../../../../common/icons/24px/GitHubIssueIcon";
12+
import { GitHubPullRequestIcon } from "../../../../common/icons/24px/GitHubPullRequestIcon";
1013
import { Tooltip } from "../../../../common/v3/Tooltip";
14+
import { trackingEvents } from "../../../tracking";
1115
import { Table } from "../Table";
1216
import * as s from "./styles";
1317

@@ -18,7 +22,9 @@ const columnHelper = createColumnHelper<IncidentArtifact>();
1822
const getArtifactIcon = (type: ArtifactType) => {
1923
switch (type) {
2024
case "pr":
21-
return <PullRequestIcon color={"currentColor"} size={24} />;
25+
return <GitHubPullRequestIcon color={"currentColor"} size={24} />;
26+
case "issue":
27+
return <GitHubIssueIcon color={"currentColor"} size={24} />;
2228
default:
2329
return null;
2430
}
@@ -27,6 +33,8 @@ const getArtifactIcon = (type: ArtifactType) => {
2733
export const Artifacts = () => {
2834
const params = useParams();
2935
const incidentId = params.id;
36+
const [searchParams] = useStableSearchParams();
37+
const agentId = searchParams.get("agent");
3038

3139
const { data } = useGetIncidentQuery(
3240
{
@@ -52,13 +60,23 @@ export const Artifacts = () => {
5260
cell: (info) => {
5361
const artifact = info.getValue();
5462

63+
const handleArtifactLinkClick = () => {
64+
sendUserActionTrackingEvent(
65+
trackingEvents.INCIDENT_ARTIFACTS_TABLE_ITEM_LINK_CLICKED,
66+
{
67+
agentId: agentId ?? ""
68+
}
69+
);
70+
};
71+
5572
return (
5673
<s.ArtifactInfoContainer>
5774
<s.ArtifactIconContainer>
5875
{getArtifactIcon(artifact.type)}
5976
</s.ArtifactIconContainer>
6077
<Tooltip title={artifact.display_name}>
6178
<s.Link
79+
onClick={handleArtifactLinkClick}
6280
href={artifact.url}
6381
target={"_blank"}
6482
rel={"noopener noreferrer"}

src/components/Agentic/IncidentDetails/AdditionalInfo/RelatedIssues/index.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import { createColumnHelper } from "@tanstack/react-table";
22
import { useMemo } from "react";
33
import { useParams } from "react-router";
4+
import { useStableSearchParams } from "../../../../../hooks/useStableSearchParams";
45
import { useGetIncidentQuery } from "../../../../../redux/services/digma";
56
import type { GenericIncidentIssue } from "../../../../../redux/services/types";
7+
import { sendUserActionTrackingEvent } from "../../../../../utils/actions/sendUserActionTrackingEvent";
68
import { getIdeLauncherLinkForError } from "../../../../../utils/getIdeLauncherLinkForError";
79
import { getIdeLauncherLinkForSpan } from "../../../../../utils/getIdeLauncherLinkForSpan";
810
import { getInsightTypeInfo } from "../../../../../utils/getInsightTypeInfo";
@@ -15,6 +17,7 @@ import {
1517
InsightIcon
1618
} from "../../../../Insights/InsightsCatalog/InsightsPage/InsightCardRenderer/insightCards/common/InsightCard/InsightHeader/InsightIcon";
1719
import { getValueLabel } from "../../../../Insights/InsightsCatalog/InsightsPage/InsightCardRenderer/insightCards/common/InsightCard/InsightHeader/InsightIcon/getValueLabel";
20+
import { trackingEvents } from "../../../tracking";
1821
import { Table } from "../Table";
1922
import * as s from "./styles";
2023

@@ -38,6 +41,8 @@ const columnHelper = createColumnHelper<GenericIncidentIssue>();
3841
export const RelatedIssues = () => {
3942
const params = useParams();
4043
const incidentId = params.id;
44+
const [searchParams] = useStableSearchParams();
45+
const agentId = searchParams.get("agent");
4146

4247
const { data } = useGetIncidentQuery(
4348
{
@@ -66,6 +71,15 @@ export const RelatedIssues = () => {
6671
cell: (info) => {
6772
const issue = info.getValue();
6873

74+
const handleIssueLinkClick = () => {
75+
sendUserActionTrackingEvent(
76+
trackingEvents.INCIDENT_RELATED_ISSUES_TABLE_ITEM_LINK_CLICKED,
77+
{
78+
agentId: agentId ?? ""
79+
}
80+
);
81+
};
82+
6983
switch (issue.type) {
7084
case "issue": {
7185
const insightTypeInfo = getInsightTypeInfo(issue.issue_type);
@@ -82,6 +96,7 @@ export const RelatedIssues = () => {
8296
<Tooltip title={label}>
8397
{issue.span_uid ? (
8498
<s.Link
99+
onClick={handleIssueLinkClick}
85100
href={getIdeLauncherLinkForSpan(issue.span_uid)}
86101
target={"_blank"}
87102
rel={"noopener noreferrer"}
@@ -102,6 +117,7 @@ export const RelatedIssues = () => {
102117
<s.IssueInfoContainer>
103118
<Tooltip title={label}>
104119
<s.Link
120+
onClick={handleIssueLinkClick}
105121
href={getIdeLauncherLinkForError(issue.issue_id)}
106122
target={"_blank"}
107123
rel={"noopener noreferrer"}

src/components/Agentic/IncidentDetails/AdditionalInfo/index.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import { useState, type ReactNode } from "react";
2+
import { useStableSearchParams } from "../../../../hooks/useStableSearchParams";
3+
import { sendUserActionTrackingEvent } from "../../../../utils/actions/sendUserActionTrackingEvent";
4+
import { trackingEvents } from "../../tracking";
25
import { Artifacts } from "./Artifacts";
36
import { RelatedIssues } from "./RelatedIssues";
47
import * as s from "./styles";
@@ -11,8 +14,17 @@ const tabs: { id: TabId; name: string; content: ReactNode }[] = [
1114

1215
export const AdditionalInfo = () => {
1316
const [selectedTabId, setSelectedTabId] = useState<TabId>("relatedIssues");
17+
const [searchParams] = useStableSearchParams();
18+
const agentId = searchParams.get("agent");
1419

1520
const handleTabChange = (tabId: TabId) => () => {
21+
sendUserActionTrackingEvent(
22+
trackingEvents.INCIDENT_RELATED_ASSETS_TAB_CLICKED,
23+
{
24+
agentId: agentId ?? "",
25+
tabId
26+
}
27+
);
1628
const newTab = tabs.find((tab) => tab.id === tabId);
1729

1830
if (newTab) {

src/components/Agentic/IncidentDetails/AgentFlowChart/index.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import { Position, type Edge } from "@xyflow/react";
22
import { useState } from "react";
3+
import { sendUserActionTrackingEvent } from "../../../../utils/actions/sendUserActionTrackingEvent";
34
import { groupBy } from "../../../../utils/groupBy";
45
import { PlusIcon } from "../../../common/icons/16px/PlusIcon";
56
import { FlowChart } from "../../common/FlowChart";
67
import type {
78
FlowChartNode,
89
FlowChartNodeData
910
} from "../../common/FlowChart/FlowChartNode";
11+
import { trackingEvents } from "../../tracking";
1012
import { MCPServerBlock } from "./MCPServerBlock";
1113
import * as s from "./styles";
1214
import type { AgentFlowChartProps, ExtendedAgent } from "./types";
@@ -27,6 +29,14 @@ const getFlowChartNodeData = ({
2729
onAddMCPServer?: (agentName: string, position: Position) => void;
2830
}): Partial<FlowChartNodeData> => {
2931
const handleAddMCPServerButtonClick = (position: Position) => () => {
32+
sendUserActionTrackingEvent(
33+
trackingEvents.AGENT_FLOW_CHART_NODE_ADD_MCP_SERVER_BUTTON_CLICKED,
34+
{
35+
agentName: agent?.name,
36+
position
37+
}
38+
);
39+
3040
if (!agent) {
3141
return;
3242
}

src/components/Agentic/IncidentDetails/Chat/index.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ import {
77
} from "../../../../redux/services/digma";
88
import type { IncidentAgentChatEvent } from "../../../../redux/services/types";
99
import { isNumber } from "../../../../typeGuards/isNumber";
10+
import { sendUserActionTrackingEvent } from "../../../../utils/actions/sendUserActionTrackingEvent";
1011
import { ThreeCirclesSpinner } from "../../../common/ThreeCirclesSpinner";
1112
import { Spinner } from "../../../common/v3/Spinner";
1213
import { PromptInput } from "../../common/PromptInput";
14+
import { trackingEvents } from "../../tracking";
1315
import { Accordion } from "../AgentEvents/Accordion";
1416
import { TypingMarkdown } from "../TypingMarkdown";
1517
import { useAutoScroll } from "../useAutoScroll";
@@ -45,6 +47,12 @@ export const Chat = () => {
4547
);
4648

4749
const handleInputSubmit = () => {
50+
sendUserActionTrackingEvent(
51+
trackingEvents.INCIDENT_AGENT_MESSAGE_SUBMITTED,
52+
{
53+
agentName: agentId ?? ""
54+
}
55+
);
4856
setInputValue("");
4957
scrollToBottom();
5058

src/components/Agentic/IncidentDetails/index.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ import {
88
useGetIncidentAgentsQuery,
99
useGetIncidentQuery
1010
} from "../../../redux/services/digma";
11+
import { sendUserActionTrackingEvent } from "../../../utils/actions/sendUserActionTrackingEvent";
1112
import { TwoVerticalLinesIcon } from "../../common/icons/16px/TwoVerticalLinesIcon";
1213
import { Direction } from "../../common/icons/types";
1314
import { Spinner } from "../../common/v3/Spinner";
1415
import type { ToggleOption } from "../../common/v3/Toggle/types";
1516
import { Tooltip } from "../../common/v3/Tooltip";
17+
import { trackingEvents } from "../tracking";
1618
import { AdditionalInfo } from "./AdditionalInfo";
1719
import { AgentEvents } from "./AgentEvents";
1820
import { AgentFlowChart } from "./AgentFlowChart";
@@ -59,17 +61,21 @@ export const IncidentDetails = () => {
5961
);
6062

6163
const handleHomeBreadcrumbClick = () => {
64+
sendUserActionTrackingEvent(
65+
trackingEvents.INCIDENT_HOME_BREADCRUMB_CLICKED,
66+
{ agentName: agentId ?? "" }
67+
);
6268
setSearchParams((params) => {
6369
params.delete("agent");
6470
return params;
6571
});
6672
};
6773

68-
const handleAgentBreadcrumbClick = () => {
69-
setAgentViewMode("summary");
70-
};
71-
7274
const handleAgentViewModeChange = (value: AgentViewMode) => {
75+
sendUserActionTrackingEvent(
76+
trackingEvents.INCIDENT_AGENT_VIEW_MODE_TOGGLE_CHANGED,
77+
{ agentName: agentId ?? "", mode: value }
78+
);
7379
setAgentViewMode(value);
7480
};
7581

@@ -143,9 +149,7 @@ export const IncidentDetails = () => {
143149
{agentId && (
144150
<>
145151
<s.BreadcrumbsDivider>/</s.BreadcrumbsDivider>
146-
<s.AgentBreadcrumb onClick={handleAgentBreadcrumbClick}>
147-
{agentName}
148-
</s.AgentBreadcrumb>
152+
<s.AgentBreadcrumb>{agentName}</s.AgentBreadcrumb>
149153
</>
150154
)}
151155
</s.Breadcrumbs>

src/components/Agentic/IncidentTemplate/AddMCPServerDialog/index.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { useState, type ChangeEvent } from "react";
2+
import { sendUserActionTrackingEvent } from "../../../../utils/actions/sendUserActionTrackingEvent";
23
import { CrossIcon } from "../../../common/icons/12px/CrossIcon";
34
import { NewButton } from "../../../common/v3/NewButton";
5+
import { trackingEvents } from "../../tracking";
46
import * as s from "./styles";
57
import type { AddMCPServerDialogProps } from "./types";
68

@@ -15,11 +17,24 @@ export const AddMCPServerDialog = ({
1517
};
1618

1719
const handleSaveButtonClick = () => {
20+
sendUserActionTrackingEvent(
21+
trackingEvents.INCIDENT_TEMPLATE_ADD_MCP_DIALOG_SAVE_BUTTON_CLICKED
22+
);
1823
onSave(textAreaValue);
1924
onClose();
2025
};
2126

27+
const handleCancelButtonClick = () => {
28+
sendUserActionTrackingEvent(
29+
trackingEvents.INCIDENT_TEMPLATE_ADD_MCP_DIALOG_CANCEL_BUTTON_CLICKED
30+
);
31+
onClose();
32+
};
33+
2234
const handleCloseButtonClick = () => {
35+
sendUserActionTrackingEvent(
36+
trackingEvents.INCIDENT_TEMPLATE_ADD_MCP_DIALOG_CLOSE_BUTTON_CLICKED
37+
);
2338
onClose();
2439
};
2540

@@ -38,7 +53,7 @@ export const AddMCPServerDialog = ({
3853
<NewButton
3954
buttonType={"secondary"}
4055
label={"Cancel"}
41-
onClick={handleCloseButtonClick}
56+
onClick={handleCancelButtonClick}
4257
/>
4358
<NewButton label={"Save"} onClick={handleSaveButtonClick} />
4459
</s.Footer>

src/components/Agentic/Sidebar/index.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,32 @@ export const Sidebar = () => {
3838
const [logout, result] = useLogoutMutation();
3939

4040
const handleLogoLinkClick = () => {
41-
sendUserActionTrackingEvent(trackingEvents.LOGO_LINK_CLICKED);
41+
sendUserActionTrackingEvent(trackingEvents.SIDEBAR_LOGO_LINK_CLICKED);
4242
};
4343

4444
const handleIncidentListItemClick = (id: string) => () => {
45+
sendUserActionTrackingEvent(
46+
trackingEvents.SIDEBAR_INCIDENTS_LIST_ITEM_CLICKED
47+
);
4548
void navigate(`/incidents/${id}`);
4649
};
4750

4851
const handleTemplateButtonClick = () => {
49-
sendUserActionTrackingEvent(trackingEvents.TEMPLATE_BUTTON_CLICKED);
52+
sendUserActionTrackingEvent(trackingEvents.SIDEBAR_TEMPLATE_BUTTON_CLICKED);
5053
void navigate("/incidents/template");
5154
};
5255

5356
const handleLogoutMenuItemClick = () => {
54-
sendUserActionTrackingEvent(trackingEvents.LOGOUT_MENU_ITEM_CLICKED);
57+
sendUserActionTrackingEvent(trackingEvents.SIDEBAR_USER_MENU_ITEM_CLICKED, {
58+
item: "logout"
59+
});
5560
void logout();
5661
};
5762

5863
const handleUserMenuOpenChange = (isOpen: boolean) => {
64+
sendUserActionTrackingEvent(trackingEvents.SIDEBAR_USER_MENU_OPEN_CHANGED, {
65+
isOpen
66+
});
5967
setIsUserMenuOpen(isOpen);
6068
};
6169

0 commit comments

Comments
 (0)