From 593d666d71e5233f7551ce34fb9665a66ce6bcd6 Mon Sep 17 00:00:00 2001 From: SagarRajput-7 Date: Fri, 17 Jan 2025 08:51:03 +0530 Subject: [PATCH 1/2] feat: added celery task feature - with task garphs and details --- frontend/src/AppRoutes/pageComponents.ts | 7 + frontend/src/AppRoutes/routes.ts | 8 + .../CeleryTaskConfigOptions.styles.scss | 39 ++ .../CeleryTaskConfigOptions.tsx | 89 ++++ .../useGetCeleryFilters.ts | 49 +++ .../CeleryTaskDetail.style.scss | 5 + .../CeleryTaskDetail/CeleryTaskDetail.tsx | 59 +++ .../CeleryTaskGraph.style.scss | 36 ++ .../CeleryTaskGraph/CeleryTaskGraph.tsx | 65 +++ .../CeleryTaskGraph/CeleryTaskGraphGrid.tsx | 47 ++ .../CeleryTaskGraph/CeleryTaskGraphUtils.ts | 410 ++++++++++++++++++ .../src/components/CeleryTask/CeleryUtils.ts | 22 + .../CeleryTask/useCeleryFilterOptions.ts | 32 ++ frontend/src/constants/query.ts | 1 + frontend/src/constants/routes.ts | 1 + frontend/src/container/AppLayout/index.tsx | 4 +- frontend/src/container/SideNav/config.ts | 1 + .../TopNav/DateTimeSelectionV2/config.ts | 1 + .../Celery/CeleryTask/CeleryTask.styles.scss | 44 ++ .../pages/Celery/CeleryTask/CeleryTask.tsx | 41 ++ .../MQDetails/MetricPage/MetricPageUtil.ts | 5 +- frontend/src/utils/permission/index.ts | 1 + 22 files changed, 964 insertions(+), 3 deletions(-) create mode 100644 frontend/src/components/CeleryTask/CeleryTaskConfigOptions/CeleryTaskConfigOptions.styles.scss create mode 100644 frontend/src/components/CeleryTask/CeleryTaskConfigOptions/CeleryTaskConfigOptions.tsx create mode 100644 frontend/src/components/CeleryTask/CeleryTaskConfigOptions/useGetCeleryFilters.ts create mode 100644 frontend/src/components/CeleryTask/CeleryTaskDetail/CeleryTaskDetail.style.scss create mode 100644 frontend/src/components/CeleryTask/CeleryTaskDetail/CeleryTaskDetail.tsx create mode 100644 frontend/src/components/CeleryTask/CeleryTaskGraph/CeleryTaskGraph.style.scss create mode 100644 frontend/src/components/CeleryTask/CeleryTaskGraph/CeleryTaskGraph.tsx create mode 100644 frontend/src/components/CeleryTask/CeleryTaskGraph/CeleryTaskGraphGrid.tsx create mode 100644 frontend/src/components/CeleryTask/CeleryTaskGraph/CeleryTaskGraphUtils.ts create mode 100644 frontend/src/components/CeleryTask/CeleryUtils.ts create mode 100644 frontend/src/components/CeleryTask/useCeleryFilterOptions.ts create mode 100644 frontend/src/pages/Celery/CeleryTask/CeleryTask.styles.scss create mode 100644 frontend/src/pages/Celery/CeleryTask/CeleryTask.tsx diff --git a/frontend/src/AppRoutes/pageComponents.ts b/frontend/src/AppRoutes/pageComponents.ts index 0857ea4664..cafbbd2ba4 100644 --- a/frontend/src/AppRoutes/pageComponents.ts +++ b/frontend/src/AppRoutes/pageComponents.ts @@ -247,3 +247,10 @@ export const InfrastructureMonitoring = Loadable( /* webpackChunkName: "InfrastructureMonitoring" */ 'pages/InfrastructureMonitoring' ), ); + +export const CeleryTask = Loadable( + () => + import( + /* webpackChunkName: "CeleryTask" */ 'pages/Celery/CeleryTask/CeleryTask' + ), +); diff --git a/frontend/src/AppRoutes/routes.ts b/frontend/src/AppRoutes/routes.ts index dda546167f..998ba3e34a 100644 --- a/frontend/src/AppRoutes/routes.ts +++ b/frontend/src/AppRoutes/routes.ts @@ -8,6 +8,7 @@ import { AllErrors, APIKeys, BillingPage, + CeleryTask, CreateAlertChannelAlerts, CreateNewAlerts, CustomDomainSettings, @@ -401,6 +402,13 @@ const routes: AppRoutes[] = [ key: 'MESSAGING_QUEUES', isPrivate: true, }, + { + path: ROUTES.MESSAGING_QUEUES_CELERY_TASK, + exact: true, + component: CeleryTask, + key: 'MESSAGING_QUEUES_CELERY_TASK', + isPrivate: true, + }, { path: ROUTES.MESSAGING_QUEUES_DETAIL, exact: true, diff --git a/frontend/src/components/CeleryTask/CeleryTaskConfigOptions/CeleryTaskConfigOptions.styles.scss b/frontend/src/components/CeleryTask/CeleryTaskConfigOptions/CeleryTaskConfigOptions.styles.scss new file mode 100644 index 0000000000..1ffd4af3ff --- /dev/null +++ b/frontend/src/components/CeleryTask/CeleryTaskConfigOptions/CeleryTaskConfigOptions.styles.scss @@ -0,0 +1,39 @@ +.celery-task-filters { + display: flex; + justify-content: space-between; + width: 100%; + + .celery-filters { + display: flex; + align-items: center; + gap: 8px; + + .config-select-option { + width: 100%; + .ant-select-selector { + display: flex; + min-height: 32px; + align-items: center; + gap: 16px; + min-width: 164px; + + border-radius: 2px; + border: 1px solid var(--bg-slate-400); + background: var(--bg-ink-300); + } + } + } +} + +.lightMode { + .celery-task-filters { + .celery-filters { + .config-select-option { + .ant-select-selector { + border: 1px solid var(--bg-vanilla-300); + background: var(--bg-vanilla-100); + } + } + } + } +} diff --git a/frontend/src/components/CeleryTask/CeleryTaskConfigOptions/CeleryTaskConfigOptions.tsx b/frontend/src/components/CeleryTask/CeleryTaskConfigOptions/CeleryTaskConfigOptions.tsx new file mode 100644 index 0000000000..5088f9ea5f --- /dev/null +++ b/frontend/src/components/CeleryTask/CeleryTaskConfigOptions/CeleryTaskConfigOptions.tsx @@ -0,0 +1,89 @@ +import './CeleryTaskConfigOptions.styles.scss'; + +import { Color } from '@signozhq/design-tokens'; +import { Button, Select, Spin, Tooltip } from 'antd'; +import { SelectMaxTagPlaceholder } from 'components/MessagingQueues/MQCommon/MQCommon'; +import { QueryParams } from 'constants/query'; +import useUrlQuery from 'hooks/useUrlQuery'; +import { Check, Share2 } from 'lucide-react'; +import { useState } from 'react'; +import { useHistory, useLocation } from 'react-router-dom'; +import { useCopyToClipboard } from 'react-use'; + +import { + getValuesFromQueryParams, + setQueryParamsFromOptions, +} from '../CeleryUtils'; +import { useCeleryFilterOptions } from '../useCeleryFilterOptions'; + +function CeleryTaskConfigOptions(): JSX.Element { + const { handleSearch, isFetching, options } = useCeleryFilterOptions( + 'celery.task_name', + ); + const history = useHistory(); + const location = useLocation(); + + const [isURLCopied, setIsURLCopied] = useState(false); + const urlQuery = useUrlQuery(); + + const [, handleCopyToClipboard] = useCopyToClipboard(); + + return ( +
+
+