From 30b82d1888d16ec1211ba3c496f30a9a53dc389a Mon Sep 17 00:00:00 2001 From: Kyrylo Shmidt Date: Wed, 29 Jan 2025 11:02:27 +0100 Subject: [PATCH] Fix Slow endpoint insight metric, update insight icons --- .../SlowEndpointInsightCard/index.tsx | 14 +++++++--- .../common/icons/16px/SoundWaveIcon.tsx | 26 +++++++++++++++++++ .../icons/16px/TwoHorizontalEndpointsIcon.tsx | 26 ------------------- src/utils/getInsightTypeInfo.ts | 4 +-- 4 files changed, 38 insertions(+), 32 deletions(-) create mode 100644 src/components/common/icons/16px/SoundWaveIcon.tsx delete mode 100644 src/components/common/icons/16px/TwoHorizontalEndpointsIcon.tsx diff --git a/src/components/Insights/InsightsCatalog/InsightsPage/InsightCardRenderer/insightCards/SlowEndpointInsightCard/index.tsx b/src/components/Insights/InsightsCatalog/InsightsPage/InsightCardRenderer/insightCards/SlowEndpointInsightCard/index.tsx index c8ee7945e..27bc8bd3e 100644 --- a/src/components/Insights/InsightsCatalog/InsightsPage/InsightCardRenderer/insightCards/SlowEndpointInsightCard/index.tsx +++ b/src/components/Insights/InsightsCatalog/InsightsPage/InsightCardRenderer/insightCards/SlowEndpointInsightCard/index.tsx @@ -1,3 +1,4 @@ +import { convertToDuration } from "../../../../../../../utils/convertToDuration"; import { getDurationString } from "../../../../../../../utils/getDurationString"; import { roundTo } from "../../../../../../../utils/roundTo"; import { Tag } from "../../../../../../common/v3/Tag"; @@ -21,7 +22,9 @@ export const SlowEndpointInsightCard = ({ const diff = (insight.median.raw / insight.endpointsMedianOfMedians.raw - 1) * 100; - const durationString = getDurationString(insight.median); + const slowerByDurationString = getDurationString( + convertToDuration(insight.median.raw - insight.endpointsMedianOfMedians.raw) + ); return ( - + @@ -45,8 +51,8 @@ export const SlowEndpointInsightCard = ({ isMarkAsReadButtonEnabled={isMarkAsReadButtonEnabled} viewMode={viewMode} mainMetric={ - - {durationString} + + {slowerByDurationString} } onDismissalChange={onDismissalChange} diff --git a/src/components/common/icons/16px/SoundWaveIcon.tsx b/src/components/common/icons/16px/SoundWaveIcon.tsx new file mode 100644 index 000000000..a7bc24cc3 --- /dev/null +++ b/src/components/common/icons/16px/SoundWaveIcon.tsx @@ -0,0 +1,26 @@ +import React from "react"; +import { useIconProps } from "../hooks"; +import type { IconProps } from "../types"; + +const SoundWaveIconComponent = (props: IconProps) => { + const { size, color } = useIconProps(props); + + return ( + + + + ); +}; + +export const SoundWaveIcon = React.memo(SoundWaveIconComponent); diff --git a/src/components/common/icons/16px/TwoHorizontalEndpointsIcon.tsx b/src/components/common/icons/16px/TwoHorizontalEndpointsIcon.tsx deleted file mode 100644 index 8be9b845e..000000000 --- a/src/components/common/icons/16px/TwoHorizontalEndpointsIcon.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import React from "react"; -import { useIconProps } from "../hooks"; -import type { IconProps } from "../types"; - -const TwoHorizontalEndpointsIconComponent = (props: IconProps) => { - const { size, color } = useIconProps(props); - - return ( - - - - ); -}; - -export const TwoHorizontalEndpointsIcon = React.memo( - TwoHorizontalEndpointsIconComponent -); diff --git a/src/utils/getInsightTypeInfo.ts b/src/utils/getInsightTypeInfo.ts index 3c92f71a9..ad5bdb346 100644 --- a/src/utils/getInsightTypeInfo.ts +++ b/src/utils/getInsightTypeInfo.ts @@ -1,7 +1,7 @@ import type { MemoExoticComponent } from "react"; import * as descriptionProvider from "../components/common/InsightsDescription"; import { PulseIcon } from "../components/common/icons/16px/PulseIcon"; -import { TwoHorizontalEndpointsIcon } from "../components/common/icons/16px/TwoHorizontalEndpointsIcon"; +import { SoundWaveIcon } from "../components/common/icons/16px/SoundWaveIcon"; import { AlarmClockIcon } from "../components/common/icons/AlarmClockIcon"; import { BottleneckIcon } from "../components/common/icons/BottleneckIcon"; import { ClockWithTicksIcon } from "../components/common/icons/ClockWithTicksIcon"; @@ -153,7 +153,7 @@ export const getInsightTypeInfo = ( documentationLink: SESSION_IN_VIEW_DOCUMENTATION_URL }, [InsightType.EndpointChattyApiV2]: { - icon: TwoHorizontalEndpointsIcon, + icon: SoundWaveIcon, label: "Excessive API Calls Detected", description: descriptionProvider.ChattyApiDescription, documentationLink: CHATTY_API_ISSUE_DOCUMENTATION_URL