Skip to content

Commit 5ad286f

Browse files
committed
Add links to the errors
1 parent 6ffa761 commit 5ad286f

File tree

4 files changed

+64
-34
lines changed

4 files changed

+64
-34
lines changed

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

Lines changed: 47 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { useMemo } from "react";
33
import { useParams } from "react-router";
44
import { useGetIncidentQuery } from "../../../../../redux/services/digma";
55
import type { GenericIncidentIssue } from "../../../../../redux/services/types";
6+
import { getIdeLauncherLinkForError } from "../../../../../utils/getIdeLauncherLinkForError";
67
import { getIdeLauncherLinkForSpan } from "../../../../../utils/getIdeLauncherLinkForSpan";
78
import { getInsightTypeInfo } from "../../../../../utils/getInsightTypeInfo";
89
import { roundTo } from "../../../../../utils/roundTo";
@@ -16,7 +17,6 @@ import {
1617
import { getValueLabel } from "../../../../Insights/InsightsCatalog/InsightsPage/InsightCardRenderer/insightCards/common/InsightCard/InsightHeader/InsightIcon/getValueLabel";
1718
import { Table } from "../Table";
1819
import * as s from "./styles";
19-
import { isErrorIncidentIssue, isInsightIncidentIssue } from "./typeGuards";
2020

2121
const getErrorTagLabel = (tagType: TagType): string => {
2222
switch (tagType) {
@@ -65,39 +65,54 @@ export const RelatedIssues = () => {
6565
},
6666
cell: (info) => {
6767
const issue = info.getValue();
68-
const insightTypeInfo = isInsightIncidentIssue(issue)
69-
? getInsightTypeInfo(issue.issue_type)
70-
: undefined;
7168

72-
const label = isInsightIncidentIssue(issue)
73-
? insightTypeInfo?.label
74-
: isErrorIncidentIssue(issue)
75-
? issue.issue_type
76-
: undefined;
69+
switch (issue.type) {
70+
case "issue": {
71+
const insightTypeInfo = getInsightTypeInfo(issue.issue_type);
72+
const label = insightTypeInfo?.label;
7773

78-
return (
79-
<s.IssueInfoContainer>
80-
{insightTypeInfo && (
81-
<InsightIcon
82-
insightTypeInfo={insightTypeInfo}
83-
criticality={issue.criticality}
84-
/>
85-
)}
86-
<Tooltip title={label}>
87-
{issue.span_uid ? (
88-
<s.Link
89-
href={getIdeLauncherLinkForSpan(issue.span_uid)}
90-
target={"_blank"}
91-
rel={"noopener noreferrer"}
92-
>
93-
{label}
94-
</s.Link>
95-
) : (
96-
<s.IssueTypeTitle>{label}</s.IssueTypeTitle>
97-
)}
98-
</Tooltip>
99-
</s.IssueInfoContainer>
100-
);
74+
return (
75+
<s.IssueInfoContainer>
76+
{insightTypeInfo && (
77+
<InsightIcon
78+
insightTypeInfo={insightTypeInfo}
79+
criticality={issue.criticality}
80+
/>
81+
)}
82+
<Tooltip title={label}>
83+
{issue.span_uid ? (
84+
<s.Link
85+
href={getIdeLauncherLinkForSpan(issue.span_uid)}
86+
target={"_blank"}
87+
rel={"noopener noreferrer"}
88+
>
89+
{label}
90+
</s.Link>
91+
) : (
92+
<s.IssueTypeTitle>{label}</s.IssueTypeTitle>
93+
)}
94+
</Tooltip>
95+
</s.IssueInfoContainer>
96+
);
97+
}
98+
case "error": {
99+
const label = issue.issue_type;
100+
101+
return (
102+
<s.IssueInfoContainer>
103+
<Tooltip title={label}>
104+
<s.Link
105+
href={getIdeLauncherLinkForError(issue.issue_id)}
106+
target={"_blank"}
107+
rel={"noopener noreferrer"}
108+
>
109+
{label}
110+
</s.Link>
111+
</Tooltip>
112+
</s.IssueInfoContainer>
113+
);
114+
}
115+
}
101116
}
102117
}),
103118
columnHelper.accessor((x) => x, {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Tooltip } from "../../../common/v3/Tooltip";
66
import { Divider } from "./Divider";
77
import * as s from "./styles";
88

9-
const DATE_FORMAT = "dd MMM, yyyy";
9+
const DATE_FORMAT = "dd MMM, yyyy HH:mm";
1010
const SERVICE_TAGS_TO_SHOW = 2;
1111
const REFRESH_INTERVAL = 10 * 1000; // in milliseconds
1212

src/containers/Agentic/store.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const persistPrefix = `${PERSIST_PREFIX}${APP_ID}-`;
2020
const reducer = rememberReducer({
2121
app: appSlice.reducer,
2222
auth: authSlice.reducer,
23-
incidents: incidentsSlice.reducer,
23+
incidents: incidentsSlice.reducer, // not in use
2424
persist: persistSlice.reducer,
2525
[authApi.reducerPath]: authApi.reducer,
2626
[digmaApi.reducerPath]: digmaApi.reducer
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
export const getIdeLauncherLinkForError = (
2+
errorId?: string
3+
): string | undefined => {
4+
if (!errorId) {
5+
return;
6+
}
7+
8+
const baseURL = `${window.location.origin}/ide-launcher`;
9+
const url = new URL(baseURL);
10+
11+
url.searchParams.append("plugin.action", "GoToError");
12+
url.searchParams.append("plugin.errorId", errorId);
13+
14+
return url.toString();
15+
};

0 commit comments

Comments
 (0)