From 7411eb7f4c48814da8efad8a6cfcc1b1e5245e31 Mon Sep 17 00:00:00 2001 From: SagarRajput-7 Date: Wed, 11 Dec 2024 09:15:18 +0530 Subject: [PATCH 1/2] chore: restructure Kafka codebase --- .../messagingQueues}/getConsumerLagDetails.ts | 0 .../messagingQueues}/getKafkaSpanEval.tsx | 2 +- .../getPartitionLatencyDetails.ts | 0 .../getPartitionLatencyOverview.ts | 0 .../messagingQueues}/getTopicThroughputDetails.ts | 0 .../AttributeCheckList.tsx | 9 ++++----- .../MessagingQueueHealthCheck.styles.scss | 0 .../MessagingQueueHealthCheck.tsx | 2 +- .../MessagingQueues/MQCommon/MQCommon.styles.scss | 0 .../MessagingQueues/MQCommon/MQCommon.tsx | 0 .../Steps/ConnectionStatus/ConnectionStatus.tsx | 2 +- .../MQDetails/DropRateView/DropRateView.tsx | 4 ++-- .../MQDetails/MQTables/MQTables.tsx | 8 ++++---- .../MQDetails/MessagingQueueOverview.tsx | 6 +++--- .../MessagingQueues/MQGraph/MQConfigOptions.tsx | 2 +- .../src/pages/MessagingQueues/MessagingQueues.tsx | 2 +- .../pages/MessagingQueues/MessagingQueuesUtils.ts | 15 +++++++-------- 17 files changed, 25 insertions(+), 27 deletions(-) rename frontend/src/{pages/MessagingQueues/MQDetails/MQTables => api/messagingQueues}/getConsumerLagDetails.ts (100%) rename frontend/src/{pages/MessagingQueues/MQDetails/MQTables => api/messagingQueues}/getKafkaSpanEval.tsx (86%) rename frontend/src/{pages/MessagingQueues/MQDetails/MQTables => api/messagingQueues}/getPartitionLatencyDetails.ts (100%) rename frontend/src/{pages/MessagingQueues/MQDetails/MQTables => api/messagingQueues}/getPartitionLatencyOverview.ts (100%) rename frontend/src/{pages/MessagingQueues/MQDetails/MQTables => api/messagingQueues}/getTopicThroughputDetails.ts (100%) rename frontend/src/{pages/MessagingQueues => components}/MessagingQueueHealthCheck/AttributeCheckList.tsx (99%) rename frontend/src/{pages/MessagingQueues => components}/MessagingQueueHealthCheck/MessagingQueueHealthCheck.styles.scss (100%) rename frontend/src/{pages/MessagingQueues => components}/MessagingQueueHealthCheck/MessagingQueueHealthCheck.tsx (97%) rename frontend/src/{pages => components}/MessagingQueues/MQCommon/MQCommon.styles.scss (100%) rename frontend/src/{pages => components}/MessagingQueues/MQCommon/MQCommon.tsx (100%) diff --git a/frontend/src/pages/MessagingQueues/MQDetails/MQTables/getConsumerLagDetails.ts b/frontend/src/api/messagingQueues/getConsumerLagDetails.ts similarity index 100% rename from frontend/src/pages/MessagingQueues/MQDetails/MQTables/getConsumerLagDetails.ts rename to frontend/src/api/messagingQueues/getConsumerLagDetails.ts diff --git a/frontend/src/pages/MessagingQueues/MQDetails/MQTables/getKafkaSpanEval.tsx b/frontend/src/api/messagingQueues/getKafkaSpanEval.tsx similarity index 86% rename from frontend/src/pages/MessagingQueues/MQDetails/MQTables/getKafkaSpanEval.tsx rename to frontend/src/api/messagingQueues/getKafkaSpanEval.tsx index 1f77faff2d..8942429e95 100644 --- a/frontend/src/pages/MessagingQueues/MQDetails/MQTables/getKafkaSpanEval.tsx +++ b/frontend/src/api/messagingQueues/getKafkaSpanEval.tsx @@ -1,7 +1,7 @@ import axios from 'api'; +import { DropRateAPIResponse } from 'pages/MessagingQueues/MQDetails/DropRateView/dropRateViewUtils'; import { ErrorResponse, SuccessResponse } from 'types/api'; -import { DropRateAPIResponse } from '../DropRateView/dropRateViewUtils'; import { MessagingQueueServicePayload } from './getConsumerLagDetails'; export const getKafkaSpanEval = async ( diff --git a/frontend/src/pages/MessagingQueues/MQDetails/MQTables/getPartitionLatencyDetails.ts b/frontend/src/api/messagingQueues/getPartitionLatencyDetails.ts similarity index 100% rename from frontend/src/pages/MessagingQueues/MQDetails/MQTables/getPartitionLatencyDetails.ts rename to frontend/src/api/messagingQueues/getPartitionLatencyDetails.ts diff --git a/frontend/src/pages/MessagingQueues/MQDetails/MQTables/getPartitionLatencyOverview.ts b/frontend/src/api/messagingQueues/getPartitionLatencyOverview.ts similarity index 100% rename from frontend/src/pages/MessagingQueues/MQDetails/MQTables/getPartitionLatencyOverview.ts rename to frontend/src/api/messagingQueues/getPartitionLatencyOverview.ts diff --git a/frontend/src/pages/MessagingQueues/MQDetails/MQTables/getTopicThroughputDetails.ts b/frontend/src/api/messagingQueues/getTopicThroughputDetails.ts similarity index 100% rename from frontend/src/pages/MessagingQueues/MQDetails/MQTables/getTopicThroughputDetails.ts rename to frontend/src/api/messagingQueues/getTopicThroughputDetails.ts diff --git a/frontend/src/pages/MessagingQueues/MessagingQueueHealthCheck/AttributeCheckList.tsx b/frontend/src/components/MessagingQueueHealthCheck/AttributeCheckList.tsx similarity index 99% rename from frontend/src/pages/MessagingQueues/MessagingQueueHealthCheck/AttributeCheckList.tsx rename to frontend/src/components/MessagingQueueHealthCheck/AttributeCheckList.tsx index 08b2ce6cfa..8ab647ef34 100644 --- a/frontend/src/pages/MessagingQueues/MessagingQueueHealthCheck/AttributeCheckList.tsx +++ b/frontend/src/components/MessagingQueueHealthCheck/AttributeCheckList.tsx @@ -17,16 +17,15 @@ import { QueryParams } from 'constants/query'; import ROUTES from 'constants/routes'; import { History } from 'history'; import { Bolt, Check, OctagonAlert, X } from 'lucide-react'; +import { + KAFKA_SETUP_DOC_LINK, + MessagingQueueHealthCheckService, +} from 'pages/MessagingQueues/MessagingQueuesUtils'; import { ReactNode, useEffect, useState } from 'react'; import { useHistory } from 'react-router-dom'; import { isCloudUser } from 'utils/app'; import { v4 as uuid } from 'uuid'; -import { - KAFKA_SETUP_DOC_LINK, - MessagingQueueHealthCheckService, -} from '../MessagingQueuesUtils'; - interface AttributeCheckListProps { visible: boolean; onClose: () => void; diff --git a/frontend/src/pages/MessagingQueues/MessagingQueueHealthCheck/MessagingQueueHealthCheck.styles.scss b/frontend/src/components/MessagingQueueHealthCheck/MessagingQueueHealthCheck.styles.scss similarity index 100% rename from frontend/src/pages/MessagingQueues/MessagingQueueHealthCheck/MessagingQueueHealthCheck.styles.scss rename to frontend/src/components/MessagingQueueHealthCheck/MessagingQueueHealthCheck.styles.scss diff --git a/frontend/src/pages/MessagingQueues/MessagingQueueHealthCheck/MessagingQueueHealthCheck.tsx b/frontend/src/components/MessagingQueueHealthCheck/MessagingQueueHealthCheck.tsx similarity index 97% rename from frontend/src/pages/MessagingQueues/MessagingQueueHealthCheck/MessagingQueueHealthCheck.tsx rename to frontend/src/components/MessagingQueueHealthCheck/MessagingQueueHealthCheck.tsx index 346d4a666a..cf36ed74ac 100644 --- a/frontend/src/pages/MessagingQueues/MessagingQueueHealthCheck/MessagingQueueHealthCheck.tsx +++ b/frontend/src/components/MessagingQueueHealthCheck/MessagingQueueHealthCheck.tsx @@ -5,9 +5,9 @@ import { Button } from 'antd'; import cx from 'classnames'; import { useOnboardingStatus } from 'hooks/messagingQueue/useOnboardingStatus'; import { Bolt, FolderTree } from 'lucide-react'; +import { MessagingQueueHealthCheckService } from 'pages/MessagingQueues/MessagingQueuesUtils'; import { useEffect, useMemo, useState } from 'react'; -import { MessagingQueueHealthCheckService } from '../MessagingQueuesUtils'; import AttributeCheckList from './AttributeCheckList'; interface MessagingQueueHealthCheckProps { diff --git a/frontend/src/pages/MessagingQueues/MQCommon/MQCommon.styles.scss b/frontend/src/components/MessagingQueues/MQCommon/MQCommon.styles.scss similarity index 100% rename from frontend/src/pages/MessagingQueues/MQCommon/MQCommon.styles.scss rename to frontend/src/components/MessagingQueues/MQCommon/MQCommon.styles.scss diff --git a/frontend/src/pages/MessagingQueues/MQCommon/MQCommon.tsx b/frontend/src/components/MessagingQueues/MQCommon/MQCommon.tsx similarity index 100% rename from frontend/src/pages/MessagingQueues/MQCommon/MQCommon.tsx rename to frontend/src/components/MessagingQueues/MQCommon/MQCommon.tsx diff --git a/frontend/src/container/OnboardingContainer/Steps/ConnectionStatus/ConnectionStatus.tsx b/frontend/src/container/OnboardingContainer/Steps/ConnectionStatus/ConnectionStatus.tsx index b5b38c6948..3bfdf0c33b 100644 --- a/frontend/src/container/OnboardingContainer/Steps/ConnectionStatus/ConnectionStatus.tsx +++ b/frontend/src/container/OnboardingContainer/Steps/ConnectionStatus/ConnectionStatus.tsx @@ -6,6 +6,7 @@ import { LoadingOutlined, } from '@ant-design/icons'; import logEvent from 'api/common/logEvent'; +import MessagingQueueHealthCheck from 'components/MessagingQueueHealthCheck/MessagingQueueHealthCheck'; import { QueryParams } from 'constants/query'; import Header from 'container/OnboardingContainer/common/Header/Header'; import { useOnboardingContext } from 'container/OnboardingContainer/context/OnboardingContext'; @@ -14,7 +15,6 @@ import { useQueryService } from 'hooks/useQueryService'; import useResourceAttribute from 'hooks/useResourceAttribute'; import { convertRawQueriesToTraceSelectedTags } from 'hooks/useResourceAttribute/utils'; import useUrlQuery from 'hooks/useUrlQuery'; -import MessagingQueueHealthCheck from 'pages/MessagingQueues/MessagingQueueHealthCheck/MessagingQueueHealthCheck'; import { getAttributeDataFromOnboardingStatus } from 'pages/MessagingQueues/MessagingQueuesUtils'; import { useEffect, useMemo, useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; diff --git a/frontend/src/pages/MessagingQueues/MQDetails/DropRateView/DropRateView.tsx b/frontend/src/pages/MessagingQueues/MQDetails/DropRateView/DropRateView.tsx index d7eb3c2562..c30f1bb1ef 100644 --- a/frontend/src/pages/MessagingQueues/MQDetails/DropRateView/DropRateView.tsx +++ b/frontend/src/pages/MessagingQueues/MQDetails/DropRateView/DropRateView.tsx @@ -2,6 +2,8 @@ import '../MQDetails.style.scss'; import { Table, Typography } from 'antd'; +import { MessagingQueueServicePayload } from 'api/messagingQueues/getConsumerLagDetails'; +import { getKafkaSpanEval } from 'api/messagingQueues/getKafkaSpanEval'; import axios from 'axios'; import cx from 'classnames'; import { SOMETHING_WENT_WRONG } from 'constants/api'; @@ -19,8 +21,6 @@ import { useSelector } from 'react-redux'; import { AppState } from 'store/reducers'; import { GlobalReducer } from 'types/reducer/globalTime'; -import { MessagingQueueServicePayload } from '../MQTables/getConsumerLagDetails'; -import { getKafkaSpanEval } from '../MQTables/getKafkaSpanEval'; import { convertToMilliseconds, DropRateAPIResponse, diff --git a/frontend/src/pages/MessagingQueues/MQDetails/MQTables/MQTables.tsx b/frontend/src/pages/MessagingQueues/MQDetails/MQTables/MQTables.tsx index d4ee82b8b7..1430682bce 100644 --- a/frontend/src/pages/MessagingQueues/MQDetails/MQTables/MQTables.tsx +++ b/frontend/src/pages/MessagingQueues/MQDetails/MQTables/MQTables.tsx @@ -3,6 +3,10 @@ import './MQTables.styles.scss'; import { Skeleton, Table, Typography } from 'antd'; +import { + MessagingQueueServicePayload, + MessagingQueuesPayloadProps, +} from 'api/messagingQueues/getConsumerLagDetails'; import axios from 'axios'; import { isNumber } from 'chart.js/helpers'; import cx from 'classnames'; @@ -28,10 +32,6 @@ import { useMutation } from 'react-query'; import { useHistory, useLocation } from 'react-router-dom'; import { ErrorResponse, SuccessResponse } from 'types/api'; -import { - MessagingQueueServicePayload, - MessagingQueuesPayloadProps, -} from './getConsumerLagDetails'; import { getTableDataForProducerLatencyOverview } from './MQTableUtils'; const INITIAL_PAGE_SIZE = 10; diff --git a/frontend/src/pages/MessagingQueues/MQDetails/MessagingQueueOverview.tsx b/frontend/src/pages/MessagingQueues/MQDetails/MessagingQueueOverview.tsx index c4c9cfb253..4046226cd0 100644 --- a/frontend/src/pages/MessagingQueues/MQDetails/MessagingQueueOverview.tsx +++ b/frontend/src/pages/MessagingQueues/MQDetails/MessagingQueueOverview.tsx @@ -1,6 +1,9 @@ import './MQDetails.style.scss'; import { Radio } from 'antd'; +import { MessagingQueueServicePayload } from 'api/messagingQueues/getConsumerLagDetails'; +import { getKafkaSpanEval } from 'api/messagingQueues/getKafkaSpanEval'; +import { getPartitionLatencyOverview } from 'api/messagingQueues/getPartitionLatencyOverview'; import { getTopicThroughputOverview } from 'api/messagingQueues/getTopicThroughputOverview'; import useUrlQuery from 'hooks/useUrlQuery'; import { Dispatch, SetStateAction, useMemo } from 'react'; @@ -15,9 +18,6 @@ import { ProducerLatencyOptions, setConfigDetail, } from '../MessagingQueuesUtils'; -import { MessagingQueueServicePayload } from './MQTables/getConsumerLagDetails'; -import { getKafkaSpanEval } from './MQTables/getKafkaSpanEval'; -import { getPartitionLatencyOverview } from './MQTables/getPartitionLatencyOverview'; import MessagingQueuesTable from './MQTables/MQTables'; type SelectedViewType = keyof typeof MessagingQueuesViewType; diff --git a/frontend/src/pages/MessagingQueues/MQGraph/MQConfigOptions.tsx b/frontend/src/pages/MessagingQueues/MQGraph/MQConfigOptions.tsx index 72540f2f52..da83a197fc 100644 --- a/frontend/src/pages/MessagingQueues/MQGraph/MQConfigOptions.tsx +++ b/frontend/src/pages/MessagingQueues/MQGraph/MQConfigOptions.tsx @@ -3,6 +3,7 @@ import './MQConfigOptions.styles.scss'; import { Color } from '@signozhq/design-tokens'; import { Button, Select, Spin, Tooltip } from 'antd'; import { DefaultOptionType } from 'antd/es/select'; +import { SelectMaxTagPlaceholder } from 'components/MessagingQueues/MQCommon/MQCommon'; import { QueryParams } from 'constants/query'; import { History, Location } from 'history'; import useDebouncedFn from 'hooks/useDebouncedFunction'; @@ -12,7 +13,6 @@ import { useState } from 'react'; import { useHistory, useLocation } from 'react-router-dom'; import { useCopyToClipboard } from 'react-use'; -import { SelectMaxTagPlaceholder } from '../MQCommon/MQCommon'; import { useGetAllConfigOptions } from './useGetAllConfigOptions'; type ConfigOptionType = 'group' | 'topic' | 'partition'; diff --git a/frontend/src/pages/MessagingQueues/MessagingQueues.tsx b/frontend/src/pages/MessagingQueues/MessagingQueues.tsx index 74bc1f3796..a7e8681e9c 100644 --- a/frontend/src/pages/MessagingQueues/MessagingQueues.tsx +++ b/frontend/src/pages/MessagingQueues/MessagingQueues.tsx @@ -4,6 +4,7 @@ import './MessagingQueues.styles.scss'; import { Button } from 'antd'; import logEvent from 'api/common/logEvent'; import cx from 'classnames'; +import MessagingQueueHealthCheck from 'components/MessagingQueueHealthCheck/MessagingQueueHealthCheck'; import { QueryParams } from 'constants/query'; import ROUTES from 'constants/routes'; import DateTimeSelectionV2 from 'container/TopNav/DateTimeSelectionV2'; @@ -13,7 +14,6 @@ import { useTranslation } from 'react-i18next'; import { useHistory } from 'react-router-dom'; import { isCloudUser } from 'utils/app'; -import MessagingQueueHealthCheck from './MessagingQueueHealthCheck/MessagingQueueHealthCheck'; import { KAFKA_SETUP_DOC_LINK, MessagingQueueHealthCheckService, diff --git a/frontend/src/pages/MessagingQueues/MessagingQueuesUtils.ts b/frontend/src/pages/MessagingQueues/MessagingQueuesUtils.ts index e787739cb3..97e368ddb4 100644 --- a/frontend/src/pages/MessagingQueues/MessagingQueuesUtils.ts +++ b/frontend/src/pages/MessagingQueues/MessagingQueuesUtils.ts @@ -1,3 +1,10 @@ +import { + getConsumerLagDetails, + MessagingQueueServicePayload, + MessagingQueuesPayloadProps, +} from 'api/messagingQueues/getConsumerLagDetails'; +import { getPartitionLatencyDetails } from 'api/messagingQueues/getPartitionLatencyDetails'; +import { getTopicThroughputDetails } from 'api/messagingQueues/getTopicThroughputDetails'; import { OnboardingStatusResponse } from 'api/messagingQueues/onboarding/getOnboardingStatus'; import { QueryParams } from 'constants/query'; import { PANEL_TYPES } from 'constants/queryBuilder'; @@ -11,14 +18,6 @@ import { EQueryType } from 'types/common/dashboard'; import { DataSource } from 'types/common/queryBuilder'; import { v4 as uuid } from 'uuid'; -import { - getConsumerLagDetails, - MessagingQueueServicePayload, - MessagingQueuesPayloadProps, -} from './MQDetails/MQTables/getConsumerLagDetails'; -import { getPartitionLatencyDetails } from './MQDetails/MQTables/getPartitionLatencyDetails'; -import { getTopicThroughputDetails } from './MQDetails/MQTables/getTopicThroughputDetails'; - export const KAFKA_SETUP_DOC_LINK = 'https://signoz.io/docs/messaging-queues/kafka?utm_source=product&utm_medium=kafka-get-started'; From 29c93c79c3335a04f8c865dc996cd16f0211a8e3 Mon Sep 17 00:00:00 2001 From: SagarRajput-7 Date: Mon, 23 Dec 2024 10:55:30 +0530 Subject: [PATCH 2/2] chore: fixed eslint errors --- .../src/api/messagingQueues/getTopicThroughputOverview.ts | 5 +++-- .../MessagingQueues/MQDetails/MQTables/MQTableUtils.tsx | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/src/api/messagingQueues/getTopicThroughputOverview.ts b/frontend/src/api/messagingQueues/getTopicThroughputOverview.ts index 072f5eccf2..ac955e8405 100644 --- a/frontend/src/api/messagingQueues/getTopicThroughputOverview.ts +++ b/frontend/src/api/messagingQueues/getTopicThroughputOverview.ts @@ -1,9 +1,10 @@ import axios from 'api'; +import { ErrorResponse, SuccessResponse } from 'types/api'; + import { MessagingQueueServicePayload, MessagingQueuesPayloadProps, -} from 'pages/MessagingQueues/MQDetails/MQTables/getConsumerLagDetails'; -import { ErrorResponse, SuccessResponse } from 'types/api'; +} from './getConsumerLagDetails'; export const getTopicThroughputOverview = async ( props: Omit, diff --git a/frontend/src/pages/MessagingQueues/MQDetails/MQTables/MQTableUtils.tsx b/frontend/src/pages/MessagingQueues/MQDetails/MQTables/MQTableUtils.tsx index 1671baf7f9..6ee6890cad 100644 --- a/frontend/src/pages/MessagingQueues/MQDetails/MQTables/MQTableUtils.tsx +++ b/frontend/src/pages/MessagingQueues/MQDetails/MQTables/MQTableUtils.tsx @@ -1,7 +1,6 @@ +import { MessagingQueuesPayloadProps } from 'api/messagingQueues/getConsumerLagDetails'; import { RowData } from 'pages/MessagingQueues/MessagingQueuesUtils'; -import { MessagingQueuesPayloadProps } from './getConsumerLagDetails'; - export function getTableDataForProducerLatencyOverview( data: MessagingQueuesPayloadProps['payload'], ): RowData[] {