Skip to content

Commit 21775f2

Browse files
committed
Update API contracts
1 parent 42a3021 commit 21775f2

File tree

5 files changed

+68
-48
lines changed

5 files changed

+68
-48
lines changed

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

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@ import type { ColumnMeta } from "../types";
2121
import * as s from "./styles";
2222

2323
// const mockData: {
24-
// issues: {
25-
// type: InsightType;
26-
// spanUid: string;
27-
// criticality: number;
28-
// }[];
24+
// issues: IncidentIssue[];
2925
// } = {
3026
// issues: [
3127
// {
@@ -63,10 +59,8 @@ export const RelatedIssues = () => {
6359
);
6460

6561
const issues = useMemo(
66-
() =>
67-
data?.relatedIssues.filter((x) => Boolean(getInsightTypeInfo(x.type))) ??
68-
[],
69-
[data?.relatedIssues]
62+
() => data?.related_issues ?? [],
63+
[data?.related_issues]
7064
);
7165

7266
const columns = [
@@ -77,25 +71,29 @@ export const RelatedIssues = () => {
7771
},
7872
cell: (info) => {
7973
const issue = info.getValue();
80-
const insightTypeInfo = getInsightTypeInfo(issue.type);
81-
82-
if (!insightTypeInfo) {
83-
return null;
84-
}
74+
const insightTypeInfo = getInsightTypeInfo(issue.insight_type);
75+
const label =
76+
issue.type === "issue"
77+
? insightTypeInfo?.label
78+
: issue.type === "error"
79+
? "Error"
80+
: undefined;
8581

8682
return (
8783
<s.IssueInfoContainer>
88-
<InsightIcon
89-
insightTypeInfo={insightTypeInfo}
90-
criticality={issue.criticality}
91-
/>
92-
<Tooltip title={insightTypeInfo.label}>
93-
{issue.spanUid ? (
94-
<s.Link href={getIdeLauncherLinkForSpan(issue.spanUid)}>
95-
{insightTypeInfo.label}
84+
{insightTypeInfo && (
85+
<InsightIcon
86+
insightTypeInfo={insightTypeInfo}
87+
criticality={issue.criticality}
88+
/>
89+
)}
90+
<Tooltip title={label}>
91+
{issue.span_id ? (
92+
<s.Link href={getIdeLauncherLinkForSpan(issue.span_id)}>
93+
{label}
9694
</s.Link>
9795
) : (
98-
<s.IssueTypeTitle>{insightTypeInfo.label}</s.IssueTypeTitle>
96+
<s.IssueTypeTitle>{label}</s.IssueTypeTitle>
9997
)}
10098
</Tooltip>
10199
</s.IssueInfoContainer>

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

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,14 @@ const REFRESH_INTERVAL = 10 * 1000; // in milliseconds
145145

146146
const getFlowChartNodeData = (
147147
agent?: Agent,
148-
sideContainerPosition?: Position
148+
sideContainerPosition?: Position,
149+
selectedAgentId?: string | null
149150
): Partial<FlowChartNodeData> => {
150151
return agent
151152
? {
152153
label: agent.display_name,
153-
isActive: agent.running,
154+
isActive: agent.name === selectedAgentId,
155+
isRunning: agent.running,
154156
isDisabled: agent.status === "inactive",
155157
sideContainer: {
156158
isVisible: agent.mcp_servers.length > 0,
@@ -173,6 +175,7 @@ const getFlowChartNodeData = (
173175

174176
export const AgentFlowChart = () => {
175177
const incidentId = useAgenticSelector((state) => state.incidents.incidentId);
178+
const agentId = useAgenticSelector((state) => state.incidents.agentId);
176179
const dispatch = useAgenticDispatch();
177180

178181
const { data } = useGetIncidentAgentsQuery(
@@ -224,7 +227,11 @@ export const AgentFlowChart = () => {
224227
id: "digma",
225228
position: { x: 0, y: -31 }, // TODO: find a way to center this
226229
data: {
227-
...getFlowChartNodeData(agents?.find((a) => a.name === "digma")),
230+
...getFlowChartNodeData(
231+
agents?.find((a) => a.name === "digma"),
232+
Position.Top,
233+
agentId
234+
),
228235
orientation: "vertical",
229236
type: "input"
230237
}
@@ -233,22 +240,32 @@ export const AgentFlowChart = () => {
233240
id: "watchman",
234241
position: { x: 200, y: 0 },
235242
data: {
236-
...getFlowChartNodeData(agents?.find((a) => a.name === "watchman"))
243+
...getFlowChartNodeData(
244+
agents?.find((a) => a.name === "watchman"),
245+
Position.Top,
246+
agentId
247+
)
237248
}
238249
},
239250
{
240251
id: "triager",
241252
position: { x: 500, y: 0 },
242253
data: {
243-
...getFlowChartNodeData(agents?.find((a) => a.name === "triager"))
254+
...getFlowChartNodeData(
255+
agents?.find((a) => a.name === "triager"),
256+
Position.Top,
257+
agentId
258+
)
244259
}
245260
},
246261
{
247262
id: "infra_resolver",
248263
position: { x: 800, y: -50 },
249264
data: {
250265
...getFlowChartNodeData(
251-
agents?.find((a) => a.name === "infra_resolver")
266+
agents?.find((a) => a.name === "infra_resolver"),
267+
Position.Top,
268+
agentId
252269
)
253270
}
254271
},
@@ -258,7 +275,8 @@ export const AgentFlowChart = () => {
258275
data: {
259276
...getFlowChartNodeData(
260277
agents?.find((a) => a.name === "code_resolver"),
261-
Position.Bottom
278+
Position.Bottom,
279+
agentId
262280
)
263281
}
264282
},
@@ -267,7 +285,9 @@ export const AgentFlowChart = () => {
267285
position: { x: 1100, y: 0 },
268286
data: {
269287
...getFlowChartNodeData(
270-
agents?.find((a) => a.name === "validator")
288+
agents?.find((a) => a.name === "validator"),
289+
Position.Top,
290+
agentId
271291
),
272292
type: "output"
273293
}

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,35 +49,35 @@ export const IncidentMetaData = () => {
4949
return null;
5050
}
5151

52-
const hiddenServices = data.affectedServices.slice(SERVICE_TAGS_TO_SHOW);
52+
const hiddenServices = data.affected_services.slice(SERVICE_TAGS_TO_SHOW);
5353

5454
return (
5555
<s.Container>
5656
<s.DateAttribute>
5757
<s.DateLabel>Incident start time:</s.DateLabel>
58-
<Tooltip title={new Date(data.createdAt).toString()}>
59-
<s.DateValue>{format(data.createdAt, DATE_FORMAT)}</s.DateValue>
58+
<Tooltip title={new Date(data.created_at).toString()}>
59+
<s.DateValue>{format(data.created_at, DATE_FORMAT)}</s.DateValue>
6060
</Tooltip>
6161
</s.DateAttribute>
6262
<s.DividerContainer>
6363
<Divider color={"currentColor"} />
6464
</s.DividerContainer>
6565
<s.DateAttribute>
6666
<s.DateLabel>Incident close time:</s.DateLabel>
67-
{data.closedAt && (
68-
<Tooltip title={new Date(data.closedAt).toString()}>
69-
<s.DateValue>{format(data.closedAt, DATE_FORMAT)}</s.DateValue>
67+
{data.closed_at && (
68+
<Tooltip title={new Date(data.closed_at).toString()}>
69+
<s.DateValue>{format(data.closed_at, DATE_FORMAT)}</s.DateValue>
7070
</Tooltip>
7171
)}
7272
</s.DateAttribute>
73-
{data.affectedServices.length > 0 && (
73+
{data.affected_services.length > 0 && (
7474
<>
7575
<s.DividerContainer>
7676
<Divider color={"currentColor"} />
7777
</s.DividerContainer>
7878
<s.ServicesContainer>
7979
<span>Affected services:</span>
80-
{data.affectedServices.slice(0, 2).map((x) => (
80+
{data.affected_services.slice(0, 2).map((x) => (
8181
<Tooltip key={x} title={x}>
8282
<s.ServiceTag>{x}</s.ServiceTag>
8383
</Tooltip>

src/components/Agentic/common/FlowChart/FlowChartNode/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export type FlowChartNodeData = {
1818
orientation?: Orientation;
1919
type?: "default" | "input" | "output";
2020
isActive?: boolean;
21+
isRunning?: boolean;
2122
isDisabled?: boolean;
2223
sideContainer?: {
2324
element: ReactNode;
@@ -38,7 +39,7 @@ export const FlowChartNode = ({ data }: NodeProps<FlowChartNode>) => {
3839
{data.label && (
3940
<s.Label $orientation={data.orientation}>{data.label}</s.Label>
4041
)}
41-
{data.isActive && <s.StyledPulsatingDot />}
42+
{data.isRunning && <s.StyledPulsatingDot />}
4243
{data.type !== "input" && (
4344
<s.InputHandle type={"target"} position={Position.Left} id={"a"}>
4445
<ChevronIcon

src/redux/services/types.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,9 +1104,10 @@ export interface GetIncidentPayload {
11041104
}
11051105

11061106
export interface IncidentIssue {
1107-
issueId: string;
1108-
spanUid: string | null;
1109-
type: InsightType;
1107+
issue_id: string;
1108+
span_id: string | null;
1109+
type: "issue" | "error";
1110+
insight_type: InsightType;
11101111
criticality: number;
11111112
}
11121113

@@ -1115,11 +1116,11 @@ export interface GetIncidentResponse {
11151116
name: string;
11161117
status: string;
11171118
summary: string;
1118-
activeStatus: IncidentActivityStatus;
1119-
relatedIssues: IncidentIssue[];
1120-
affectedServices: string[];
1121-
createdAt: string;
1122-
closedAt: string | null;
1119+
active_status: IncidentActivityStatus;
1120+
related_issues: IncidentIssue[];
1121+
affected_services: string[];
1122+
created_at: string;
1123+
closed_at: string | null;
11231124
}
11241125

11251126
export type AgentStatus = "pending" | "active" | "inactive";

0 commit comments

Comments
 (0)