Skip to content

Commit ec06db2

Browse files
Add investigate button to the insight card (#1403)
* Add an investigate button to the insight card * Show server with the MCP logo only for user-defined servers * Add Close button to Directives and Template pages * Format test MCP error --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 2b8b8af commit ec06db2

File tree

24 files changed

+197
-45
lines changed

24 files changed

+197
-45
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ To set environment variables use .env file
6060
| JAEGER_UI_PATH | string | - | Path to custom Jaeger UI build |
6161
| IS_SANDBOX_ENABLED | boolean | false | Enable Sandbox (demo) mode |
6262
| ARE_INSIGHT_SUGGESTIONS_ENABLED | boolean | false | Enable insight suggestions |
63+
| IS_AGENTIC_ENABLED | boolean | false | Enable Agentic service capabilities |
6364
| GOOGLE_CLIENT_ID | string | - | Google client ID |
6465
| POSTHOG_API_KEY | string | - | PostHog API key |
6566
| POSTHOG_URL | string | - | PostHog URL |

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "digma-ui",
3-
"version": "16.1.0",
3+
"version": "16.2.0-alpha.1",
44
"description": "Digma UI",
55
"scripts": {
66
"lint:eslint": "eslint --cache .",

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,14 @@ export const DEFAULT_SIZE = 12; // in pixels
99

1010
export const MCPServerIcon = ({
1111
type,
12+
isCustom,
1213
isActive,
1314
size = DEFAULT_SIZE
1415
}: MCPServerIconProps) => {
16+
if (isCustom) {
17+
return <MCPLogoIcon size={size} color={"currentColor"} />;
18+
}
19+
1520
switch (type) {
1621
case "github":
1722
return <GitHubLogoIcon size={size} color={"currentColor"} />;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export interface MCPServerIconProps {
22
type: string;
33
isActive?: boolean;
4+
isCustom?: boolean;
45
size?: number;
56
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ export const MCPServersContainer = ({ servers }: MCPServersContainerProps) => {
1616

1717
return (
1818
<s.Container $zoomLevel={zoomLevel}>
19-
{servers?.map((x) => (
20-
<Tooltip title={x.display_name} key={x.name}>
19+
{servers?.map((x, i) => (
20+
<Tooltip title={x.display_name} key={`${x.name}__${i}`}>
2121
<s.MCPServerBlock $isActive={x.active} $zoomLevel={viewport.zoom}>
2222
<MCPServerIcon
2323
type={x.name}
2424
isActive={x.active}
25+
isCustom={x.isEditable}
2526
size={DEFAULT_ICON_SIZE * viewport.zoom}
2627
/>
2728
</s.MCPServerBlock>

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ export const MCPServersToolbar = ({
8282

8383
return (
8484
<s.Container $zoomLevel={zoomLevel}>
85-
{servers.map((x) => (
85+
{servers.map((x, i) => (
8686
<NewPopover
87-
key={x.name}
87+
key={`${x.name}__${i}`}
8888
placement={"bottom-end"}
8989
content={
9090
<Popup>
@@ -99,7 +99,12 @@ export const MCPServersToolbar = ({
9999
<div>
100100
<Tooltip title={x.display_name}>
101101
<s.MCPServerIconContainer $isEditable={x.isEditable}>
102-
<MCPServerIcon type={x.name} isActive={x.active} size={17} />
102+
<MCPServerIcon
103+
type={x.name}
104+
isActive={x.active}
105+
size={17}
106+
isCustom={x.isEditable}
107+
/>
103108
</s.MCPServerIconContainer>
104109
</Tooltip>
105110
</div>

src/components/Agentic/IncidentDirectives/index.tsx

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
useReactTable
1111
} from "@tanstack/react-table";
1212
import { useEffect, useMemo, useRef, useState } from "react";
13-
import { useBlocker } from "react-router";
13+
import { useBlocker, useNavigate } from "react-router";
1414
import { useAgenticDispatch } from "../../../containers/Agentic/hooks";
1515
import {
1616
digmaApi,
@@ -22,12 +22,14 @@ import {
2222
import type { IncidentAgentEvent } from "../../../redux/services/types";
2323
import { isString } from "../../../typeGuards/isString";
2424
import { CancelConfirmation } from "../../common/CancelConfirmation";
25+
import { CrossIcon } from "../../common/icons/16px/CrossIcon";
2526
import { SortIcon } from "../../common/icons/16px/SortIcon";
2627
import { TrashBinIcon } from "../../common/icons/16px/TrashBinIcon";
2728
import { Direction } from "../../common/icons/types";
2829
import { KebabMenu } from "../../common/KebabMenu";
2930
import { Checkmark } from "../../common/v3/Checkmark";
3031
import { Spinner } from "../../common/v3/Spinner";
32+
import { Tooltip } from "../../common/v3/Tooltip";
3133
import type { MenuItem } from "../../Navigation/common/MenuList/types";
3234
import * as s from "./styles";
3335
import type { ColumnMeta, ExtendedDirective } from "./types";
@@ -50,6 +52,7 @@ export const IncidentDirectives = () => {
5052
>([]);
5153
const [isCurrentConversationEnded, setIsCurrentConversationEnded] =
5254
useState(false);
55+
const navigate = useNavigate();
5356

5457
const dispatch = useAgenticDispatch();
5558

@@ -87,6 +90,10 @@ export const IncidentDirectives = () => {
8790
const [deleteIncidentAgentDirective] =
8891
useDeleteIncidentAgentDirectiveMutation();
8992

93+
const handleCloseButtonClick = () => {
94+
void navigate("/agentic/incidents");
95+
};
96+
9097
const handleSearchInputChange = (value: string) => {
9198
setSearchInputValue(value);
9299
};
@@ -407,11 +414,16 @@ export const IncidentDirectives = () => {
407414
<s.Container>
408415
<s.Header>
409416
Directives
410-
<s.StyledSearchInput
411-
onChange={handleSearchInputChange}
412-
value={searchInputValue}
413-
/>
417+
<Tooltip title={"Close"}>
418+
<s.CloseButton onClick={handleCloseButtonClick}>
419+
<CrossIcon color={"currentColor"} size={24} />
420+
</s.CloseButton>
421+
</Tooltip>
414422
</s.Header>
423+
<s.StyledSearchInput
424+
onChange={handleSearchInputChange}
425+
value={searchInputValue}
426+
/>
415427
<s.TableContainer>
416428
{directives ? (
417429
<s.Table>

src/components/Agentic/IncidentDirectives/styles.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,28 @@ export const Header = styled.header`
2525
display: flex;
2626
align-items: center;
2727
justify-content: space-between;
28-
padding: 32px 24px 24px;
28+
padding: 32px 0 24px;
2929
gap: 24px;
3030
color: ${({ theme }) => theme.colors.v3.text.primary};
3131
`;
3232

3333
export const StyledSearchInput = styled(SearchInput)`
3434
width: 251px;
35+
margin-left: auto;
3536
flex-grow: 0;
3637
`;
3738

39+
export const CloseButton = styled.button`
40+
display: flex;
41+
align-items: center;
42+
justify-content: center;
43+
color: ${({ theme }) => theme.colors.v3.text.secondary};
44+
background: none;
45+
border: none;
46+
cursor: pointer;
47+
margin-left: auto;
48+
`;
49+
3850
export const TableContainer = styled.div`
3951
display: flex;
4052
flex-direction: column;

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

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,20 @@ import { ServerStep } from "./ServerStep";
1515
import { ToolsStep } from "./ToolsStep";
1616
import type { MCPServerDialogProps } from "./types";
1717

18+
const formatErrorMessage = (error: FetchBaseQueryError, prefix: string) => {
19+
let errorDetails = "";
20+
21+
if (isString(error.data)) {
22+
errorDetails = error.data;
23+
}
24+
25+
if (isObject(error.data) && isString(error.data.detail)) {
26+
errorDetails = error.data.detail;
27+
}
28+
29+
return [prefix, errorDetails].filter(Boolean).join(": ");
30+
};
31+
1832
export const MCPServerDialog = ({
1933
agentId,
2034
serverData,
@@ -57,7 +71,9 @@ export const MCPServerDialog = ({
5771
setCurrentStep((prev) => prev + 1);
5872
})
5973
.catch((error: FetchBaseQueryError) => {
60-
setTestServerError(`Failed to test MCP server: ${String(error.data)}`);
74+
setTestServerError(
75+
formatErrorMessage(error, "Failed to test MCP server")
76+
);
6177
});
6278
};
6379

@@ -79,19 +95,8 @@ export const MCPServerDialog = ({
7995
onComplete();
8096
})
8197
.catch((error: FetchBaseQueryError) => {
82-
const errorPrefix = "Failed to add MCP server";
83-
84-
let errorDetails = "";
85-
if (isString(error.data)) {
86-
errorDetails = error.data;
87-
}
88-
89-
if (isObject(error.data) && isString(error.data.detail)) {
90-
errorDetails = error.data.detail;
91-
}
92-
9398
setAddServerError(
94-
[errorPrefix, errorDetails].filter(Boolean).join(": ")
99+
formatErrorMessage(error, "Failed to add MCP server")
95100
);
96101
});
97102
} else {
@@ -105,19 +110,8 @@ export const MCPServerDialog = ({
105110
onComplete();
106111
})
107112
.catch((error: FetchBaseQueryError) => {
108-
const errorPrefix = "Failed to add MCP server";
109-
110-
let errorDetails = "";
111-
if (isString(error.data)) {
112-
errorDetails = error.data;
113-
}
114-
115-
if (isObject(error.data) && isString(error.data.detail)) {
116-
errorDetails = error.data.detail;
117-
}
118-
119113
setAddServerError(
120-
[errorPrefix, errorDetails].filter(Boolean).join(": ")
114+
formatErrorMessage(error, "Failed to update MCP server")
121115
);
122116
});
123117
}

0 commit comments

Comments
 (0)