Skip to content

Commit 7507418

Browse files
committed
Migrate Errors tab to REST API
1 parent 0ef1f13 commit 7507418

File tree

43 files changed

+718
-851
lines changed

Some content is hidden

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

43 files changed

+718
-851
lines changed

src/components/Errors/ErrorCard/mockData.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import type { Error } from "../types";
1+
import type { Error } from "../../../redux/services/types";
22

33
export const mockedError: Error = {
44
uid: "1",
55
name: "Very long long long long long long long error name",
66
scoreInfo: {
77
score: 100,
88
scoreParams: {
9-
param1: "value1",
10-
param2: "value2"
9+
param1: 1,
10+
param2: 2
1111
}
1212
},
1313
codeObjectId: "codeObjectId1",

src/components/Errors/ErrorCard/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Error } from "../types";
1+
import type { Error } from "../../../redux/services/types";
22

33
export interface ErrorCardProps {
44
data: Error;

src/components/Errors/ErrorDetails/ErrorDetails.stories.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { Meta, StoryObj } from "@storybook/react";
22
import { ErrorDetails } from ".";
33
import { actions } from "../actions";
4-
import { mockedErrorDetails } from "./mockData";
54

65
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction
76
const meta: Meta<typeof ErrorDetails> = {
@@ -20,13 +19,6 @@ type Story = StoryObj<typeof ErrorDetails>;
2019
// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
2120
export const Default: Story = {
2221
play: () => {
23-
window.setTimeout(() => {
24-
window.postMessage({
25-
type: "digma",
26-
action: actions.SET_ERROR_DETAILS,
27-
payload: mockedErrorDetails
28-
});
29-
}, 1000);
3022
window.setTimeout(() => {
3123
window.postMessage({
3224
type: "digma",

src/components/Errors/ErrorDetails/ErrorDetailsCardContent/FlowStack/SpanFrameGroup/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import type { MouseEvent } from "react";
22
import { v4 as uuidv4 } from "uuid";
3+
import type { ErrorFlowFrame } from "../../../../../../redux/services/types";
34
import { isString } from "../../../../../../typeGuards/isString";
45
import { sendUserActionTrackingEvent } from "../../../../../../utils/actions/sendUserActionTrackingEvent";
56
import { CodeIcon } from "../../../../../common/icons/12px/CodeIcon";
67
import { OpenTelemetryLogoIcon } from "../../../../../common/icons/12px/OpenTelemetryLogoIcon";
78
import { Tooltip } from "../../../../../common/v3/Tooltip";
89
import { trackingEvents } from "../../../../tracking";
9-
import type { Frame } from "../../../types";
1010
import * as s from "./styles";
1111
import type { FrameItemCodeLocation, SpanFrameGroupProps } from "./types";
1212

13-
const getFrameItemText = (frame: Frame) => {
13+
const getFrameItemText = (frame: ErrorFlowFrame) => {
1414
if (window.ide === "PyCharm" && frame.executedCode) {
1515
return frame.executedCode;
1616
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
import type { ErrorOriginService } from "../../../../../../redux/services/digmaCodeGen";
12
import { isObject } from "../../../../../../typeGuards/isObject";
23
import { isString } from "../../../../../../typeGuards/isString";
3-
import type { ServiceInfo } from "../../../types";
44

55
export const isServiceInfoWithName = (
6-
x: ServiceInfo | null
7-
): x is Omit<ServiceInfo, "serviceName"> & { serviceName: string } =>
6+
x: ErrorOriginService | null
7+
): x is Omit<ErrorOriginService, "serviceName"> & { serviceName: string } =>
88
isObject(x) && isString(x.serviceName);
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import type { FilesURIsMap, Frame } from "../../../types";
1+
import type { ErrorFlowFrame } from "../../../../../../redux/services/types";
2+
import type { FilesURIsMap } from "../../../types";
23

34
export interface FrameItemCodeLocation {
45
URI: string;
@@ -7,7 +8,7 @@ export interface FrameItemCodeLocation {
78

89
export interface SpanFrameGroupProps {
910
spanName: string;
10-
frames: Frame[];
11+
frames: ErrorFlowFrame[];
1112
filesURIs: FilesURIsMap;
1213
onGoCodeLocation: (location: FrameItemCodeLocation) => void;
1314
}

src/components/Errors/ErrorDetails/ErrorDetailsCardContent/FlowStack/index.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ import { useEffect, useMemo, useRef } from "react";
22
import { v4 as uuidv4 } from "uuid";
33
import type { DataFetcherConfiguration } from "../../../../../hooks/useFetchData";
44
import { useFetchData } from "../../../../../hooks/useFetchData";
5+
import type {
6+
ErrorFlowFrame,
7+
ErrorFlowFrameStack
8+
} from "../../../../../redux/services/types";
59
import { useErrorsSelector } from "../../../../../store/errors/useErrorsSelector";
610
import { useStore } from "../../../../../store/useStore";
711
import { isNull } from "../../../../../typeGuards/isNull";
@@ -15,8 +19,6 @@ import { actions } from "../../../actions";
1519
import { trackingEvents } from "../../../tracking";
1620
import type {
1721
FilesURIsMap,
18-
Frame,
19-
FrameStack,
2022
GetFilesURIsPayload,
2123
GoToCodeLocationPayload,
2224
GoToTracePayload,
@@ -41,7 +43,7 @@ export const FlowStack = ({ data }: FlowStackProps) => {
4143
const stacksContainerRef = useRef<HTMLDivElement>(null);
4244

4345
const frameStacks = useMemo(
44-
() => data.frameStacks.filter(Boolean) as FrameStack[],
46+
() => data.frameStacks.filter(Boolean) as ErrorFlowFrameStack[],
4547
[data]
4648
);
4749

@@ -131,7 +133,7 @@ export const FlowStack = ({ data }: FlowStackProps) => {
131133
<s.Container>
132134
<s.StacksContainer ref={stacksContainerRef}>
133135
{frameStacks.map((x) => {
134-
const frames = x.frames.filter(Boolean) as Frame[];
136+
const frames = x.frames.filter(Boolean) as ErrorFlowFrame[];
135137
const visibleFrames = showWorkspaceOnly
136138
? frames.filter((x) => x.codeObjectId && filesURIs[x.codeObjectId])
137139
: frames;
@@ -143,7 +145,7 @@ export const FlowStack = ({ data }: FlowStackProps) => {
143145
acc[acc.length - 1].push(frame);
144146
}
145147
return acc;
146-
}, [] as Frame[][]);
148+
}, [] as ErrorFlowFrame[][]);
147149

148150
return (
149151
<s.StackContainer key={uuidv4()}>

src/components/Errors/ErrorDetails/ErrorDetailsCardContent/FlowStack/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import type { FlowInfo } from "../../types";
1+
import type { ErrorFlowInfo } from "../../../../../redux/services/types";
22

33
export interface FlowProps {
4-
data: FlowInfo;
4+
data: ErrorFlowInfo;
55
}
66

77
export interface ShowOnlyWorkspaceErrorStackTraceItemsPayload {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type { ErrorDetails } from "../types";
1+
import type { GetErrorResponse } from "../../../../redux/services/types";
22

33
export interface ErrorDetailsCardContentProps {
44
id: string;
5-
data: ErrorDetails;
5+
data: GetErrorResponse;
66
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type { ErrorDetails } from "../types";
1+
import type { GetErrorResponse } from "../../../../redux/services/types";
22

33
export interface ErrorDetailsCardHeaderProps {
44
onGoBack: () => void;
5-
data: ErrorDetails;
5+
data: GetErrorResponse;
66
}

0 commit comments

Comments
 (0)