Skip to content

Commit ae6b5ed

Browse files
Add Incident template Edit dialog, improve styling (#1384)
* Add Incident template Edit dialog, improve styling
1 parent a07d414 commit ae6b5ed

File tree

44 files changed

+921
-246
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+921
-246
lines changed

src/components/Admin/Environments/ActionsMenuButton/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useState } from "react";
22
import { useAdminDispatch } from "../../../../containers/Admin/hooks";
3-
import { setEnvironmentToDelete } from "../../../../redux/slices/environmentsSlice";
3+
import { setEnvironmentToDelete } from "../../../../redux/slices/environmentsManagerSlice";
44
import { TrashBinIcon } from "../../../common/icons/16px/TrashBinIcon";
55
import { ThreeDotsVerticalIcon } from "../../../common/icons/ThreeDotsVerticalIcon";
66
import { NewPopover } from "../../../common/NewPopover";

src/components/Admin/Environments/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import type { Environment } from "../../../redux/services/types";
2121
import {
2222
setEnvironmentToDelete,
2323
setIsSidebarOpen
24-
} from "../../../redux/slices/environmentsSlice";
24+
} from "../../../redux/slices/environmentsManagerSlice";
2525
import { FeatureFlag } from "../../../types";
2626
import { sortEnvironments } from "../../common/IssuesReport/utils";
2727
import { Pagination } from "../../common/v3/Pagination";
@@ -38,7 +38,7 @@ export const Environments = () => {
3838
const containerRef = useRef<HTMLDivElement>(null);
3939
const { data: about } = useGetAboutQuery();
4040
const isCreateEnvironmentSidebarOpen = useAdminSelector(
41-
(state) => state.environmentsSlice.isSidebarOpen
41+
(state) => state.environmentsManager.isSidebarOpen
4242
);
4343

4444
const dispatch = useAdminDispatch();
@@ -48,7 +48,7 @@ export const Environments = () => {
4848
);
4949
const [deleteEnvironment] = useDeleteEnvironmentMutation();
5050
const environmentToDelete = useAdminSelector(
51-
(state) => state.environmentsSlice.environmentToDelete
51+
(state) => state.environmentsManager.environmentToDelete
5252
);
5353
const { data: environments } = useGetEnvironmentsQuery();
5454

src/components/Admin/Header/CreateEnvironmentButton/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useAdminDispatch } from "../../../../containers/Admin/hooks";
2-
import { setIsSidebarOpen } from "../../../../redux/slices/environmentsSlice";
2+
import { setIsSidebarOpen } from "../../../../redux/slices/environmentsManagerSlice";
33
import { PlusIcon } from "../../../common/icons/16px/PlusIcon";
44
import { NewIconButton } from "../../../common/v3/NewIconButton";
55
import { Tooltip } from "../../../common/v3/Tooltip";

src/components/Admin/common/RepositorySidebarOverlay/RepositorySidebar/Issues/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ export const Issues = ({
5050
const drawerRef = useRef<HTMLDivElement>(null);
5151
const dispatch = useAdminDispatch();
5252
const insightInfoToOpenTicket = useAdminSelector(
53-
(state) => state.repositorySlice.issues.insightInfoToOpenTicket
53+
(state) => state.repository.issues.insightInfoToOpenTicket
5454
);
5555
const insightIdToOpenSuggestion = useAdminSelector(
56-
(state) => state.repositorySlice.issues.insightIdToOpenSuggestion
56+
(state) => state.repository.issues.insightIdToOpenSuggestion
5757
);
5858
const isInsightJiraTicketHintShown = useAdminSelector(
5959
(state) => state.persist.isInsightJiraTicketHintShown

src/components/Admin/common/RepositorySidebarOverlay/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ export const RepositorySidebarOverlay = ({
6464
sidebarQuery?.query?.scopedSpanCodeObjectId
6565
);
6666
const insightInfoToOpenTicket = useAdminSelector(
67-
(state) => state.repositorySlice.issues.insightInfoToOpenTicket
67+
(state) => state.repository.issues.insightInfoToOpenTicket
6868
);
6969
const insightIdToOpenSuggestion = useAdminSelector(
70-
(state) => state.repositorySlice.issues.insightIdToOpenSuggestion
70+
(state) => state.repository.issues.insightIdToOpenSuggestion
7171
);
7272
const { resetInsights, resetAssets, resetGlobalErrors } = useStore.getState();
7373
const dispatch = useAdminDispatch();
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import { Position } from "@xyflow/react";
2+
import { PlusIcon } from "../../../../common/icons/16px/PlusIcon";
3+
import { MCPServersSideContainer } from "../MCPServersSideContainer";
4+
import { MCPServersToolbar } from "../MCPServersToolbar";
5+
import * as s from "./styles";
6+
import type { AgentFlowChartNodeToolbarProps } from "./types";
7+
8+
export const AgentFlowChartNodeToolbar = ({
9+
servers,
10+
position,
11+
isEditMode,
12+
onAddMCPServer,
13+
onEditMCPServers,
14+
showPlusButton
15+
}: AgentFlowChartNodeToolbarProps) => {
16+
const handleAddMCPServer = () => {
17+
onAddMCPServer(position);
18+
};
19+
20+
const handleEditMCPServers = () => {
21+
onEditMCPServers(position);
22+
};
23+
24+
const toolbarItems = [
25+
...(servers.length > 0
26+
? [
27+
<MCPServersToolbar
28+
key={"mcp-servers-toolbar"}
29+
servers={servers}
30+
onAddMCPServer={handleAddMCPServer}
31+
onEditMCPServers={handleEditMCPServers}
32+
/>
33+
]
34+
: []),
35+
...(showPlusButton
36+
? [
37+
<s.PlusButton
38+
key={"add-mcp-server-button"}
39+
buttonType={"secondaryBorderless"}
40+
icon={PlusIcon}
41+
onClick={handleAddMCPServer}
42+
/>
43+
]
44+
: [])
45+
];
46+
47+
const sortedToolbarItems =
48+
position === Position.Top ? toolbarItems.reverse() : toolbarItems;
49+
50+
return (
51+
<>
52+
{isEditMode ? (
53+
[Position.Top, Position.Bottom].includes(position) && (
54+
<s.NodeToolbarContainer>{sortedToolbarItems}</s.NodeToolbarContainer>
55+
)
56+
) : (
57+
<MCPServersSideContainer servers={servers} />
58+
)}
59+
</>
60+
);
61+
};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import styled from "styled-components";
2+
import { NewButton } from "../../../../common/v3/NewButton";
3+
4+
export const PlusButton = styled(NewButton)`
5+
padding: 5px;
6+
`;
7+
8+
export const NodeToolbarContainer = styled.div`
9+
display: flex;
10+
flex-direction: column;
11+
align-items: center;
12+
gap: 11px;
13+
`;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import type { Position } from "@xyflow/react";
2+
import type { ExtendedAgentMCPServer } from "../types";
3+
4+
export interface AgentFlowChartNodeToolbarProps {
5+
isEditMode?: boolean;
6+
position: Position;
7+
servers: ExtendedAgentMCPServer[];
8+
onAddMCPServer: (position: Position) => void;
9+
onEditMCPServers: (position: Position) => void;
10+
showPlusButton?: boolean;
11+
}

src/components/Agentic/IncidentDetails/AgentFlowChart/MCPServerBlock/types.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/components/Agentic/IncidentDetails/AgentFlowChart/MCPServerBlock/index.tsx renamed to src/components/Agentic/IncidentDetails/AgentFlowChart/MCPServerIcon/index.tsx

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1-
import { useViewport } from "@xyflow/react";
21
import { DigmaLogoThemeableIcon } from "../../../../common/icons/24px/DigmaLogoThemeableIcon";
32
import { MCPLogoIcon } from "../../../../common/icons/24px/MCPLogoIcon";
43
import { KubernetesLogoIcon } from "../../../../common/icons/25px/KubernetesLogoIcon";
54
import { PostgresLogoIcon } from "../../../../common/icons/25px/PostgresLogoIcon";
65
import { GitHubLogoIcon } from "../../../../common/icons/28px/GitHubLogoIcon";
7-
import * as s from "./styles";
8-
import type { MCPServerBlockProps, MCPServerIconProps } from "./types";
6+
import type { MCPServerIconProps } from "./types";
97

10-
export const MCPServerIcon = ({ type, isActive }: MCPServerIconProps) => {
11-
const DEFAULT_SIZE = 27; // in pixels
12-
const viewport = useViewport();
13-
14-
const size = viewport.zoom * DEFAULT_SIZE;
8+
export const DEFAULT_SIZE = 12; // in pixels
159

10+
export const MCPServerIcon = ({
11+
type,
12+
isActive,
13+
size = DEFAULT_SIZE
14+
}: MCPServerIconProps) => {
1615
switch (type) {
1716
case "github":
1817
return <GitHubLogoIcon size={size} color={"currentColor"} />;
@@ -34,13 +33,3 @@ export const MCPServerIcon = ({ type, isActive }: MCPServerIconProps) => {
3433
return null;
3534
}
3635
};
37-
38-
export const MCPServerBlock = ({ type, isActive }: MCPServerBlockProps) => {
39-
const viewport = useViewport();
40-
41-
return (
42-
<s.MCPServerBlock $isActive={isActive} $zoomLevel={viewport.zoom}>
43-
<MCPServerIcon type={type} isActive={isActive} />
44-
</s.MCPServerBlock>
45-
);
46-
};

0 commit comments

Comments
 (0)