Skip to content

Commit 93660ab

Browse files
committed
Fix error score
1 parent 9f47eaf commit 93660ab

File tree

2 files changed

+47
-15
lines changed
  • src/components/Agentic/IncidentDetails

2 files changed

+47
-15
lines changed

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

Lines changed: 46 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ import type { GenericIncidentIssue } from "../../../../../redux/services/types";
1111
import { getIdeLauncherLinkForSpan } from "../../../../../utils/getIdeLauncherLinkForSpan";
1212
import { getInsightTypeInfo } from "../../../../../utils/getInsightTypeInfo";
1313
import { roundTo } from "../../../../../utils/roundTo";
14+
import type { TagType } from "../../../../common/v3/Tag/types";
1415
import { Tooltip } from "../../../../common/v3/Tooltip";
16+
import { getTagType as getErrorTagType } from "../../../../Errors/Score";
1517
import {
16-
getTagType,
18+
getTagType as getIssueTagType,
1719
InsightIcon
1820
} from "../../../../Insights/InsightsCatalog/InsightsPage/InsightCardRenderer/insightCards/common/InsightCard/InsightHeader/InsightIcon";
1921
import { getValueLabel } from "../../../../Insights/InsightsCatalog/InsightsPage/InsightCardRenderer/insightCards/common/InsightCard/InsightHeader/InsightIcon/getValueLabel";
@@ -43,6 +45,19 @@ import { isErrorIncidentIssue, isInsightIncidentIssue } from "./typeGuards";
4345
// ]
4446
// };
4547

48+
const getErrorTagLabel = (tagType: TagType): string => {
49+
switch (tagType) {
50+
case "lowSeverity":
51+
return "Low";
52+
case "mediumSeverity":
53+
return "Medium";
54+
case "highSeverity":
55+
return "High";
56+
default:
57+
return "";
58+
}
59+
};
60+
4661
const REFRESH_INTERVAL = 10 * 1000; // in milliseconds
4762

4863
const columnHelper = createColumnHelper<GenericIncidentIssue>();
@@ -82,8 +97,8 @@ export const RelatedIssues = () => {
8297
const label = isInsightIncidentIssue(issue)
8398
? insightTypeInfo?.label
8499
: isErrorIncidentIssue(issue)
85-
? issue.issue_type
86-
: undefined;
100+
? issue.issue_type
101+
: undefined;
87102

88103
return (
89104
<s.IssueInfoContainer>
@@ -118,17 +133,35 @@ export const RelatedIssues = () => {
118133
},
119134
cell: (info) => {
120135
const issue = info.getValue();
121-
const tagTitle = `${roundTo(issue.criticality * 100, 0)}%`;
122-
const tagLabel = getValueLabel(issue.criticality);
123-
const tagType = getTagType(tagLabel);
124136

125-
return (
126-
<s.CriticalityTag
127-
title={tagTitle}
128-
type={tagType}
129-
content={<s.CriticalityLabel>{tagLabel}</s.CriticalityLabel>}
130-
/>
131-
);
137+
switch (issue.type) {
138+
case "issue": {
139+
const tagLabel = getValueLabel(issue.criticality);
140+
141+
return (
142+
<s.CriticalityTag
143+
title={`${roundTo(issue.criticality * 100, 0)}%`}
144+
type={getIssueTagType(tagLabel)}
145+
content={<s.CriticalityLabel>{tagLabel}</s.CriticalityLabel>}
146+
/>
147+
);
148+
}
149+
case "error": {
150+
const tagType = getErrorTagType(issue.criticality);
151+
152+
return (
153+
<s.CriticalityTag
154+
title={issue.criticality}
155+
type={tagType}
156+
content={
157+
<s.CriticalityLabel>
158+
{getErrorTagLabel(tagType)}
159+
</s.CriticalityLabel>
160+
}
161+
/>
162+
);
163+
}
164+
}
132165
}
133166
})
134167
];

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import { Accordion } from "./Accordion";
1515
import * as s from "./styles";
1616

1717
const REFRESH_INTERVAL = 10 * 1000; // in milliseconds
18-
const AUTO_SCROLL_THRESHOLD = 10; // in pixels
1918
const TYPING_SPEED = 3; // in milliseconds per character
2019

2120
const convertToMarkdown = (text: string) => {
@@ -91,7 +90,7 @@ export const AgentEvents = () => {
9190
return false;
9291
}
9392
const { scrollTop, scrollHeight, clientHeight } = containerRef.current;
94-
return scrollHeight - scrollTop <= clientHeight + AUTO_SCROLL_THRESHOLD;
93+
return scrollHeight - scrollTop <= clientHeight + 1; // Allow a small buffer for precision issues
9594
};
9695

9796
if (!containerRef.current) {

0 commit comments

Comments
 (0)