Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

chore: move types, constants to separate files, delete unused code (#10026)

Yunus M8629c959f0e4
diff --git a/frontend/src/components/CustomTimePicker/CustomTimePicker.tsx b/frontend/src/components/CustomTimePicker/CustomTimePicker.tsx
index 44494307f8..007891ee52 100644
--- a/frontend/src/components/CustomTimePicker/CustomTimePicker.tsx
+++ b/frontend/src/components/CustomTimePicker/CustomTimePicker.tsx
@@ -12,7 +12,7 @@ import {
FixedDurationSuggestionOptions,
Options,
RelativeDurationSuggestionOptions,
-} from 'container/TopNav/DateTimeSelectionV2/config';
+} from 'container/TopNav/DateTimeSelectionV2/constants';
import dayjs from 'dayjs';
import { isValidShortHandDateTimeFormat } from 'lib/getMinMax';
import { defaultTo, isFunction, noop } from 'lodash-es';
diff --git a/frontend/src/components/CustomTimePicker/CustomTimePickerPopoverContent.tsx b/frontend/src/components/CustomTimePicker/CustomTimePickerPopoverContent.tsx
index b18c06e9b1..7000424d9c 100644
--- a/frontend/src/components/CustomTimePicker/CustomTimePickerPopoverContent.tsx
+++ b/frontend/src/components/CustomTimePicker/CustomTimePickerPopoverContent.tsx
@@ -8,11 +8,11 @@ import { DATE_TIME_FORMATS } from 'constants/dateTimeFormats';
import { QueryParams } from 'constants/query';
import ROUTES from 'constants/routes';
import { DateTimeRangeType } from 'container/TopNav/CustomDateTimeModal';
+import { RelativeDurationSuggestionOptions } from 'container/TopNav/DateTimeSelectionV2/constants';
import {
LexicalContext,
Option,
- RelativeDurationSuggestionOptions,
-} from 'container/TopNav/DateTimeSelectionV2/config';
+} from 'container/TopNav/DateTimeSelectionV2/types';
import dayjs from 'dayjs';
import { Clock, PenLine, TriangleAlertIcon } from 'lucide-react';
import { useTimezone } from 'providers/Timezone';
diff --git a/frontend/src/components/CustomTimePicker/RangePickerModal.tsx b/frontend/src/components/CustomTimePicker/RangePickerModal.tsx
index e7b0c092ac..413bb1017a 100644
--- a/frontend/src/components/CustomTimePicker/RangePickerModal.tsx
+++ b/frontend/src/components/CustomTimePicker/RangePickerModal.tsx
@@ -8,7 +8,7 @@ import {
CustomTimeType,
LexicalContext,
Time,
-} from 'container/TopNav/DateTimeSelectionV2/config';
+} from 'container/TopNav/DateTimeSelectionV2/types';
import dayjs, { Dayjs } from 'dayjs';
import { useTimezone } from 'providers/Timezone';
import { Dispatch, SetStateAction, useMemo } from 'react';
diff --git a/frontend/src/components/HostMetricsDetail/HostMetricTraces/HostMetricTraces.tsx b/frontend/src/components/HostMetricsDetail/HostMetricTraces/HostMetricTraces.tsx
index 6d19596eb8..6944f12c0e 100644
--- a/frontend/src/components/HostMetricsDetail/HostMetricTraces/HostMetricTraces.tsx
+++ b/frontend/src/components/HostMetricsDetail/HostMetricTraces/HostMetricTraces.tsx
@@ -13,7 +13,7 @@ import DateTimeSelectionV2 from 'container/TopNav/DateTimeSelectionV2';
import {
CustomTimeType,
Time,
-} from 'container/TopNav/DateTimeSelectionV2/config';
+} from 'container/TopNav/DateTimeSelectionV2/types';
import TraceExplorerControls from 'container/TracesExplorer/Controls';
import { PER_PAGE_OPTIONS } from 'container/TracesExplorer/ListView/configs';
import { TracesLoading } from 'container/TracesExplorer/TraceLoading/TraceLoading';
diff --git a/frontend/src/components/HostMetricsDetail/HostMetricsDetails.tsx b/frontend/src/components/HostMetricsDetail/HostMetricsDetails.tsx
index a4dbb3e81a..d1384d7681 100644
--- a/frontend/src/components/HostMetricsDetail/HostMetricsDetails.tsx
+++ b/frontend/src/components/HostMetricsDetail/HostMetricsDetails.tsx
@@ -24,7 +24,7 @@ import { INFRA_MONITORING_K8S_PARAMS_KEYS } from 'container/InfraMonitoringK8s/c
import {
CustomTimeType,
Time,
-} from 'container/TopNav/DateTimeSelectionV2/config';
+} from 'container/TopNav/DateTimeSelectionV2/types';
import { useIsDarkMode } from 'hooks/useDarkMode';
import useUrlQuery from 'hooks/useUrlQuery';
import GetMinMax from 'lib/getMinMax';
diff --git a/frontend/src/components/HostMetricsDetail/HostMetricsLogs/HostMetricLogsDetailedView.tsx b/frontend/src/components/HostMetricsDetail/HostMetricsLogs/HostMetricLogsDetailedView.tsx
index fc47cbaf1a..8dc01456b2 100644
--- a/frontend/src/components/HostMetricsDetail/HostMetricsLogs/HostMetricLogsDetailedView.tsx
+++ b/frontend/src/components/HostMetricsDetail/HostMetricsLogs/HostMetricLogsDetailedView.tsx
@@ -5,7 +5,7 @@ import DateTimeSelectionV2 from 'container/TopNav/DateTimeSelectionV2';
import {
CustomTimeType,
Time,
-} from 'container/TopNav/DateTimeSelectionV2/config';
+} from 'container/TopNav/DateTimeSelectionV2/types';
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
import { useMemo } from 'react';
import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
diff --git a/frontend/src/components/HostMetricsDetail/Metrics/Metrics.tsx b/frontend/src/components/HostMetricsDetail/Metrics/Metrics.tsx
index a831457b52..59e65fc273 100644
--- a/frontend/src/components/HostMetricsDetail/Metrics/Metrics.tsx
+++ b/frontend/src/components/HostMetricsDetail/Metrics/Metrics.tsx
@@ -12,7 +12,7 @@ import DateTimeSelectionV2 from 'container/TopNav/DateTimeSelectionV2';
import {
CustomTimeType,
Time,
-} from 'container/TopNav/DateTimeSelectionV2/config';
+} from 'container/TopNav/DateTimeSelectionV2/types';
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
import { useIsDarkMode } from 'hooks/useDarkMode';
import { useResizeObserver } from 'hooks/useDimensions';
diff --git a/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/DomainDetails.tsx b/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/DomainDetails.tsx
index b5c110b973..146c349a77 100644
--- a/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/DomainDetails.tsx
+++ b/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/DomainDetails.tsx
@@ -7,7 +7,7 @@ import DateTimeSelectionV2 from 'container/TopNav/DateTimeSelectionV2';
import {
CustomTimeType,
Time,
-} from 'container/TopNav/DateTimeSelectionV2/config';
+} from 'container/TopNav/DateTimeSelectionV2/types';
import { useIsDarkMode } from 'hooks/useDarkMode';
import GetMinMax from 'lib/getMinMax';
import { ArrowDown, ArrowUp, X } from 'lucide-react';
diff --git a/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/EndPointDetails.tsx b/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/EndPointDetails.tsx
index acf928d06d..0e920543cc 100644
--- a/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/EndPointDetails.tsx
+++ b/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/EndPointDetails.tsx
@@ -13,7 +13,7 @@ import QueryBuilderSearchV2 from 'container/QueryBuilder/filters/QueryBuilderSea
import {
CustomTimeType,
Time,
-} from 'container/TopNav/DateTimeSelectionV2/config';
+} from 'container/TopNav/DateTimeSelectionV2/types';
import { GetMetricQueryRange } from 'lib/dashboard/getQueryResults';
import { useCallback, useEffect, useMemo, useState } from 'react';
import { useQueries } from 'react-query';
diff --git a/frontend/src/container/ApiMonitoring/__tests__/EndPointDetails.test.tsx b/frontend/src/container/ApiMonitoring/__tests__/EndPointDetails.test.tsx
index 1787abd963..2071b50e78 100644
--- a/frontend/src/container/ApiMonitoring/__tests__/EndPointDetails.test.tsx
+++ b/frontend/src/container/ApiMonitoring/__tests__/EndPointDetails.test.tsx
@@ -9,7 +9,7 @@ import {
import {
CustomTimeType,
Time,
-} from 'container/TopNav/DateTimeSelectionV2/config';
+} from 'container/TopNav/DateTimeSelectionV2/types';
import { useQueries } from 'react-query';
import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse';
import {
diff --git a/frontend/src/container/FormAlertRules/ChartPreview/index.tsx b/frontend/src/container/FormAlertRules/ChartPreview/index.tsx
index 8645a6a255..fffdb6326b 100644
--- a/frontend/src/container/FormAlertRules/ChartPreview/index.tsx
+++ b/frontend/src/container/FormAlertRules/ChartPreview/index.tsx
@@ -15,11 +15,10 @@ import GridPanelSwitch from 'container/GridPanelSwitch';
import { populateMultipleResults } from 'container/NewWidget/LeftContainer/WidgetGraph/util';
import { getFormatNameByOptionId } from 'container/NewWidget/RightContainer/alertFomatCategories';
import { timePreferenceType } from 'container/NewWidget/RightContainer/timeItems';
-import { Time } from 'container/TopNav/DateTimeSelection/config';
import {
CustomTimeType,
- Time as TimeV2,
-} from 'container/TopNav/DateTimeSelectionV2/config';
+ Time,
+} from 'container/TopNav/DateTimeSelectionV2/types';
import { useGetQueryRange } from 'hooks/queryBuilder/useGetQueryRange';
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
import { useIsDarkMode } from 'hooks/useDarkMode';
@@ -60,7 +59,7 @@ export interface ChartPreviewProps {
query: Query | null;
graphType?: PANEL_TYPES;
selectedTime?: timePreferenceType;
- selectedInterval?: Time | TimeV2 | CustomTimeType;
+ selectedInterval?: Time | CustomTimeType;
headline?: JSX.Element;
alertDef?: AlertDef;
userQueryKey?: string;
diff --git a/frontend/src/container/FormAlertRules/utils.ts b/frontend/src/container/FormAlertRules/utils.ts
index e66a9c870d..967b00a921 100644
--- a/frontend/src/container/FormAlertRules/utils.ts
+++ b/frontend/src/container/FormAlertRules/utils.ts
@@ -1,5 +1,5 @@
import { SelectProps } from 'antd';
-import { Time } from 'container/TopNav/DateTimeSelection/config';
+import { Time } from 'container/TopNav/DateTimeSelectionV2/types';
import getStartEndRangeTime from 'lib/getStartEndRangeTime';
import getStep from 'lib/getStep';
import {
diff --git a/frontend/src/container/GridCardLayout/GridCard/index.tsx b/frontend/src/container/GridCardLayout/GridCard/index.tsx
index b8ce67fb7e..7f9f94a591 100644
--- a/frontend/src/container/GridCardLayout/GridCard/index.tsx
+++ b/frontend/src/container/GridCardLayout/GridCard/index.tsx
@@ -3,7 +3,7 @@ import { DEFAULT_ENTITY_VERSION, ENTITY_VERSION_V5 } from 'constants/app';
import { QueryParams } from 'constants/query';
import { PANEL_TYPES } from 'constants/queryBuilder';
import { populateMultipleResults } from 'container/NewWidget/LeftContainer/WidgetGraph/util';
-import { CustomTimeType } from 'container/TopNav/DateTimeSelectionV2/config';
+import { CustomTimeType } from 'container/TopNav/DateTimeSelectionV2/types';
import { useGetQueryRange } from 'hooks/queryBuilder/useGetQueryRange';
import { useIntersectionObserver } from 'hooks/useIntersectionObserver';
import { getDashboardVariables } from 'lib/dashbaordVariables/getDashboardVariables';
diff --git a/frontend/src/container/InfraMonitoringK8s/Clusters/ClusterDetails/ClusterDetails.tsx b/frontend/src/container/InfraMonitoringK8s/Clusters/ClusterDetails/ClusterDetails.tsx
index ca08076985..3787f0f5ac 100644
--- a/frontend/src/container/InfraMonitoringK8s/Clusters/ClusterDetails/ClusterDetails.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/Clusters/ClusterDetails/ClusterDetails.tsx
@@ -26,7 +26,7 @@ import { QUERY_KEYS } from 'container/InfraMonitoringK8s/EntityDetailsUtils/util
import {
CustomTimeType,
Time,
-} from 'container/TopNav/DateTimeSelectionV2/config';
+} from 'container/TopNav/DateTimeSelectionV2/types';
import { useIsDarkMode } from 'hooks/useDarkMode';
import useUrlQuery from 'hooks/useUrlQuery';
import GetMinMax from 'lib/getMinMax';
diff --git a/frontend/src/container/InfraMonitoringK8s/DaemonSets/DaemonSetDetails/DaemonSetDetails.tsx b/frontend/src/container/InfraMonitoringK8s/DaemonSets/DaemonSetDetails/DaemonSetDetails.tsx
index 806852d13d..4f4b879d67 100644
--- a/frontend/src/container/InfraMonitoringK8s/DaemonSets/DaemonSetDetails/DaemonSetDetails.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/DaemonSets/DaemonSetDetails/DaemonSetDetails.tsx
@@ -21,7 +21,7 @@ import {
import {
CustomTimeType,
Time,
-} from 'container/TopNav/DateTimeSelectionV2/config';
+} from 'container/TopNav/DateTimeSelectionV2/types';
import { useIsDarkMode } from 'hooks/useDarkMode';
import useUrlQuery from 'hooks/useUrlQuery';
import GetMinMax from 'lib/getMinMax';
diff --git a/frontend/src/container/InfraMonitoringK8s/Deployments/DeploymentDetails/DeploymentDetails.tsx b/frontend/src/container/InfraMonitoringK8s/Deployments/DeploymentDetails/DeploymentDetails.tsx
index a0a4974804..2f17052704 100644
--- a/frontend/src/container/InfraMonitoringK8s/Deployments/DeploymentDetails/DeploymentDetails.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/Deployments/DeploymentDetails/DeploymentDetails.tsx
@@ -26,7 +26,7 @@ import { QUERY_KEYS } from 'container/InfraMonitoringK8s/EntityDetailsUtils/util
import {
CustomTimeType,
Time,
-} from 'container/TopNav/DateTimeSelectionV2/config';
+} from 'container/TopNav/DateTimeSelectionV2/types';
import { useIsDarkMode } from 'hooks/useDarkMode';
import useUrlQuery from 'hooks/useUrlQuery';
import GetMinMax from 'lib/getMinMax';
diff --git a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityEvents/EntityEvents.tsx b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityEvents/EntityEvents.tsx
index 5eca080ea4..be12fd243f 100644
--- a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityEvents/EntityEvents.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityEvents/EntityEvents.tsx
@@ -16,7 +16,7 @@ import DateTimeSelectionV2 from 'container/TopNav/DateTimeSelectionV2';
import {
CustomTimeType,
Time,
-} from 'container/TopNav/DateTimeSelectionV2/config';
+} from 'container/TopNav/DateTimeSelectionV2/types';
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
import { GetMetricQueryRange } from 'lib/dashboard/getQueryResults';
import { isArray } from 'lodash-es';
diff --git a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityEvents/__tests__/EntityEvents.test.tsx b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityEvents/__tests__/EntityEvents.test.tsx
index 797eb7acff..531ee6178f 100644
--- a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityEvents/__tests__/EntityEvents.test.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityEvents/__tests__/EntityEvents.test.tsx
@@ -4,7 +4,7 @@ import { fireEvent, render, screen } from '@testing-library/react';
import { initialQueriesMap } from 'constants/queryBuilder';
import ROUTES from 'constants/routes';
import { K8sCategory } from 'container/InfraMonitoringK8s/constants';
-import { Time } from 'container/TopNav/DateTimeSelectionV2/config';
+import { Time } from 'container/TopNav/DateTimeSelectionV2/types';
import * as useQueryBuilderHooks from 'hooks/queryBuilder/useQueryBuilder';
import * as appContextHooks from 'providers/App/App';
import { LicenseEvent } from 'types/api/licensesV3/getActive';
diff --git a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityLogs/EntityLogsDetailedView.tsx b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityLogs/EntityLogsDetailedView.tsx
index d7d3ad44de..380fbc952c 100644
--- a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityLogs/EntityLogsDetailedView.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityLogs/EntityLogsDetailedView.tsx
@@ -7,7 +7,7 @@ import DateTimeSelectionV2 from 'container/TopNav/DateTimeSelectionV2';
import {
CustomTimeType,
Time,
-} from 'container/TopNav/DateTimeSelectionV2/config';
+} from 'container/TopNav/DateTimeSelectionV2/types';
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
import { useMemo } from 'react';
import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
diff --git a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityMetrics/EntityMetrics.tsx b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityMetrics/EntityMetrics.tsx
index 41e1dd7981..c5a54ecb7b 100644
--- a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityMetrics/EntityMetrics.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityMetrics/EntityMetrics.tsx
@@ -14,7 +14,7 @@ import DateTimeSelectionV2 from 'container/TopNav/DateTimeSelectionV2';
import {
CustomTimeType,
Time,
-} from 'container/TopNav/DateTimeSelectionV2/config';
+} from 'container/TopNav/DateTimeSelectionV2/types';
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
import { useIsDarkMode } from 'hooks/useDarkMode';
import { useResizeObserver } from 'hooks/useDimensions';
diff --git a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityMetrics/__tests__/EntityMetrics.test.tsx b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityMetrics/__tests__/EntityMetrics.test.tsx
index 21ed2ecb55..555883d931 100644
--- a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityMetrics/__tests__/EntityMetrics.test.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityMetrics/__tests__/EntityMetrics.test.tsx
@@ -2,7 +2,7 @@
/* eslint-disable sonarjs/no-duplicate-string */
import { render, screen } from '@testing-library/react';
import { K8sCategory } from 'container/InfraMonitoringK8s/constants';
-import { Time } from 'container/TopNav/DateTimeSelectionV2/config';
+import { Time } from 'container/TopNav/DateTimeSelectionV2/types';
import * as appContextHooks from 'providers/App/App';
import { LicenseEvent } from 'types/api/licensesV3/getActive';
diff --git a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/EntityTraces.tsx b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/EntityTraces.tsx
index f1549cf93a..cfc2933d51 100644
--- a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/EntityTraces.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/EntityTraces.tsx
@@ -15,7 +15,7 @@ import DateTimeSelectionV2 from 'container/TopNav/DateTimeSelectionV2';
import {
CustomTimeType,
Time,
-} from 'container/TopNav/DateTimeSelectionV2/config';
+} from 'container/TopNav/DateTimeSelectionV2/types';
import TraceExplorerControls from 'container/TracesExplorer/Controls';
import { PER_PAGE_OPTIONS } from 'container/TracesExplorer/ListView/configs';
import { TracesLoading } from 'container/TracesExplorer/TraceLoading/TraceLoading';
diff --git a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/__tests__/EntityTraces.test.tsx b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/__tests__/EntityTraces.test.tsx
index 98f71ce427..d5e91be614 100644
--- a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/__tests__/EntityTraces.test.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/__tests__/EntityTraces.test.tsx
@@ -3,7 +3,7 @@
import { render, screen } from '@testing-library/react';
import { initialQueriesMap } from 'constants/queryBuilder';
import { K8sCategory } from 'container/InfraMonitoringK8s/constants';
-import { Time } from 'container/TopNav/DateTimeSelectionV2/config';
+import { Time } from 'container/TopNav/DateTimeSelectionV2/types';
import * as useQueryBuilderHooks from 'hooks/queryBuilder/useQueryBuilder';
import * as appContextHooks from 'providers/App/App';
import { LicenseEvent } from 'types/api/licensesV3/getActive';
diff --git a/frontend/src/container/InfraMonitoringK8s/Jobs/JobDetails/JobDetails.tsx b/frontend/src/container/InfraMonitoringK8s/Jobs/JobDetails/JobDetails.tsx
index e827090fc0..0f21e3c66e 100644
--- a/frontend/src/container/InfraMonitoringK8s/Jobs/JobDetails/JobDetails.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/Jobs/JobDetails/JobDetails.tsx
@@ -21,7 +21,7 @@ import {
import {
CustomTimeType,
Time,
-} from 'container/TopNav/DateTimeSelectionV2/config';
+} from 'container/TopNav/DateTimeSelectionV2/types';
import { useIsDarkMode } from 'hooks/useDarkMode';
import useUrlQuery from 'hooks/useUrlQuery';
import GetMinMax from 'lib/getMinMax';
diff --git a/frontend/src/container/InfraMonitoringK8s/Namespaces/NamespaceDetails/NamespaceDetails.tsx b/frontend/src/container/InfraMonitoringK8s/Namespaces/NamespaceDetails/NamespaceDetails.tsx
index 33a9d98a26..f29d46b82e 100644
--- a/frontend/src/container/InfraMonitoringK8s/Namespaces/NamespaceDetails/NamespaceDetails.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/Namespaces/NamespaceDetails/NamespaceDetails.tsx
@@ -23,7 +23,7 @@ import { QUERY_KEYS } from 'container/InfraMonitoringK8s/EntityDetailsUtils/util
import {
CustomTimeType,
Time,
-} from 'container/TopNav/DateTimeSelectionV2/config';
+} from 'container/TopNav/DateTimeSelectionV2/types';
import { useIsDarkMode } from 'hooks/useDarkMode';
import useUrlQuery from 'hooks/useUrlQuery';
import GetMinMax from 'lib/getMinMax';
diff --git a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/NodeDetails.tsx b/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/NodeDetails.tsx
index c3f6c904c2..3aea227dcf 100644
--- a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/NodeDetails.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/NodeDetails.tsx
@@ -26,7 +26,7 @@ import NodeEvents from 'container/InfraMonitoringK8s/EntityDetailsUtils/EntityEv
import {
CustomTimeType,
Time,
-} from 'container/TopNav/DateTimeSelectionV2/config';
+} from 'container/TopNav/DateTimeSelectionV2/types';
import { useIsDarkMode } from 'hooks/useDarkMode';
import useUrlQuery from 'hooks/useUrlQuery';
import GetMinMax from 'lib/getMinMax';
diff --git a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/PodDetails.tsx b/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/PodDetails.tsx
index e7441b7e44..b8b7f1af9b 100644
--- a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/PodDetails.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/PodDetails.tsx
@@ -27,7 +27,7 @@ import { QUERY_KEYS } from 'container/InfraMonitoringK8s/EntityDetailsUtils/util
import {
CustomTimeType,
Time,
-} from 'container/TopNav/DateTimeSelectionV2/config';
+} from 'container/TopNav/DateTimeSelectionV2/types';
import { useIsDarkMode } from 'hooks/useDarkMode';
import useUrlQuery from 'hooks/useUrlQuery';
import GetMinMax from 'lib/getMinMax';
diff --git a/frontend/src/container/InfraMonitoringK8s/StatefulSets/StatefulSetDetails/StatefulSetDetails.tsx b/frontend/src/container/InfraMonitoringK8s/StatefulSets/StatefulSetDetails/StatefulSetDetails.tsx
index 56d3bc6005..96d784d737 100644
--- a/frontend/src/container/InfraMonitoringK8s/StatefulSets/StatefulSetDetails/StatefulSetDetails.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/StatefulSets/StatefulSetDetails/StatefulSetDetails.tsx
@@ -26,7 +26,7 @@ import { QUERY_KEYS } from 'container/InfraMonitoringK8s/EntityDetailsUtils/util
import {
CustomTimeType,
Time,
-} from 'container/TopNav/DateTimeSelectionV2/config';
+} from 'container/TopNav/DateTimeSelectionV2/types';
import { useIsDarkMode } from 'hooks/useDarkMode';
import useUrlQuery from 'hooks/useUrlQuery';
import GetMinMax from 'lib/getMinMax';
diff --git a/frontend/src/container/InfraMonitoringK8s/Volumes/VolumeDetails/VolumeDetails.tsx b/frontend/src/container/InfraMonitoringK8s/Volumes/VolumeDetails/VolumeDetails.tsx
index 1be6cdbb7d..3a551f92ab 100644
--- a/frontend/src/container/InfraMonitoringK8s/Volumes/VolumeDetails/VolumeDetails.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/Volumes/VolumeDetails/VolumeDetails.tsx
@@ -9,7 +9,7 @@ import { K8sCategory } from 'container/InfraMonitoringK8s/constants';
import {
CustomTimeType,
Time,
-} from 'container/TopNav/DateTimeSelectionV2/config';
+} from 'container/TopNav/DateTimeSelectionV2/types';
import { useIsDarkMode } from 'hooks/useDarkMode';
import GetMinMax from 'lib/getMinMax';
import { X } from 'lucide-react';
diff --git a/frontend/src/container/LocalTopNav/index.tsx b/frontend/src/container/LocalTopNav/index.tsx
index ff864e94c7..73181ece80 100644
--- a/frontend/src/container/LocalTopNav/index.tsx
+++ b/frontend/src/container/LocalTopNav/index.tsx
@@ -4,7 +4,7 @@ import NewExplorerCTA from 'container/NewExplorerCTA';
import { FileText } from 'lucide-react';
import { useLocation } from 'react-use';
-import DateTimeSelector from '../TopNav/DateTimeSelection';
+import DateTimeSelector from '../TopNav/DateTimeSelectionV2';
import { Container } from './styles';
import { LocalTopNavProps } from './types';
@@ -37,7 +37,7 @@ function LocalTopNav({
{actions}
{renderPermissions?.isDateTimeEnabled && (
<div>
- <DateTimeSelector />
+ <DateTimeSelector showAutoRefresh={false} />
</div>
)}
</Space>
diff --git a/frontend/src/container/LogControls/index.tsx b/frontend/src/container/LogControls/index.tsx
index cdcc45f49f..e6ccd3dd49 100644
--- a/frontend/src/container/LogControls/index.tsx
+++ b/frontend/src/container/LogControls/index.tsx
@@ -4,9 +4,9 @@ import { DATE_TIME_FORMATS } from 'constants/dateTimeFormats';
import Controls from 'container/Controls';
import Download from 'container/Download/Download';
import { getGlobalTime } from 'container/LogsSearchFilter/utils';
-import { getMinMax } from 'container/TopNav/AutoRefresh/config';
import dayjs from 'dayjs';
import { Pagination } from 'hooks/queryPagination';
+import { getMinMaxForSelectedTime } from 'lib/getMinMax';
import { FlatLogData } from 'lib/logs/flatLogData';
import { OrderPreferenceItems } from 'pages/Logs/config';
import { memo, useMemo } from 'react';
@@ -50,7 +50,7 @@ function LogControls(): JSX.Element | null {
};
const handleGoToLatest = (): void => {
- const { maxTime, minTime } = getMinMax(
+ const { maxTime, minTime } = getMinMaxForSelectedTime(
globalTime.selectedTime,
globalTime.minTime,
globalTime.maxTime,
diff --git a/frontend/src/container/LogsSearchFilter/useSearchParser.ts b/frontend/src/container/LogsSearchFilter/useSearchParser.ts
index 00da96856d..4a23a68f99 100644
--- a/frontend/src/container/LogsSearchFilter/useSearchParser.ts
+++ b/frontend/src/container/LogsSearchFilter/useSearchParser.ts
@@ -1,6 +1,6 @@
import { QueryParams } from 'constants/query';
-import { getMinMax } from 'container/TopNav/AutoRefresh/config';
import useUrlQuery from 'hooks/useUrlQuery';
+import { getMinMaxForSelectedTime } from 'lib/getMinMax';
import history from 'lib/history';
import { parseQuery } from 'lib/logql';
import isEqual from 'lodash-es/isEqual';
@@ -44,7 +44,7 @@ export function useSearchParser(): {
search: `?${QueryParams.q}=${updatedQueryString}&${QueryParams.order}=${order}`,
});
- const globalTime = getMinMax(selectedTime, minTime, maxTime);
+ const globalTime = getMinMaxForSelectedTime(selectedTime, minTime, maxTime);
dispatch({
type: SET_SEARCH_QUERY_STRING,
diff --git a/frontend/src/container/LogsSearchFilter/utils.ts b/frontend/src/container/LogsSearchFilter/utils.ts
index 91f47e6ecc..e35ce1ff1c 100644
--- a/frontend/src/container/LogsSearchFilter/utils.ts
+++ b/frontend/src/container/LogsSearchFilter/utils.ts
@@ -1,12 +1,11 @@
-import { Time } from 'container/TopNav/DateTimeSelection/config';
import {
CustomTimeType,
- Time as TimeV2,
-} from 'container/TopNav/DateTimeSelectionV2/config';
+ Time,
+} from 'container/TopNav/DateTimeSelectionV2/types';
import { GetMinMaxPayload } from 'lib/getMinMax';
export const getGlobalTime = (
- selectedTime: Time | TimeV2 | CustomTimeType,
+ selectedTime: Time | CustomTimeType,
globalTime: GetMinMaxPayload,
): GetMinMaxPayload | undefined => {
if (selectedTime === 'custom') {
diff --git a/frontend/src/container/NewWidget/LeftContainer/WidgetGraph/WidgetGraphs.tsx b/frontend/src/container/NewWidget/LeftContainer/WidgetGraph/WidgetGraphs.tsx
index 79e368baa1..45b7da2b10 100644
--- a/frontend/src/container/NewWidget/LeftContainer/WidgetGraph/WidgetGraphs.tsx
+++ b/frontend/src/container/NewWidget/LeftContainer/WidgetGraph/WidgetGraphs.tsx
@@ -6,7 +6,7 @@ import { handleGraphClick } from 'container/GridCardLayout/GridCard/utils';
import { useGraphClickToShowButton } from 'container/GridCardLayout/useGraphClickToShowButton';
import useNavigateToExplorerPages from 'container/GridCardLayout/useNavigateToExplorerPages';
import PanelWrapper from 'container/PanelWrapper/PanelWrapper';
-import { CustomTimeType } from 'container/TopNav/DateTimeSelectionV2/config';
+import { CustomTimeType } from 'container/TopNav/DateTimeSelectionV2/types';
import { useIsDarkMode } from 'hooks/useDarkMode';
import { useNotifications } from 'hooks/useNotifications';
import { useSafeNavigate } from 'hooks/useSafeNavigate';
diff --git a/frontend/src/container/PipelinePage/PipelineListsView/Preview/LogsFilterPreview/index.tsx b/frontend/src/container/PipelinePage/PipelineListsView/Preview/LogsFilterPreview/index.tsx
index c47edb3710..7a530c2748 100644
--- a/frontend/src/container/PipelinePage/PipelineListsView/Preview/LogsFilterPreview/index.tsx
+++ b/frontend/src/container/PipelinePage/PipelineListsView/Preview/LogsFilterPreview/index.tsx
@@ -1,6 +1,6 @@
import './styles.scss';
-import { RelativeDurationOptions } from 'container/TopNav/DateTimeSelection/config';
+import { RelativeDurationOptions } from 'container/TopNav/DateTimeSelectionV2/constants';
import { useState } from 'react';
import { TagFilter } from 'types/api/queryBuilder/queryBuilderData';
diff --git a/frontend/src/container/PipelinePage/PipelineListsView/Preview/PipelineProcessingPreview/index.tsx b/frontend/src/container/PipelinePage/PipelineListsView/Preview/PipelineProcessingPreview/index.tsx
index 26d67d0c5a..54fcdc057c 100644
--- a/frontend/src/container/PipelinePage/PipelineListsView/Preview/PipelineProcessingPreview/index.tsx
+++ b/frontend/src/container/PipelinePage/PipelineListsView/Preview/PipelineProcessingPreview/index.tsx
@@ -1,6 +1,6 @@
import './styles.scss';
-import { RelativeDurationOptions } from 'container/TopNav/DateTimeSelection/config';
+import { RelativeDurationOptions } from 'container/TopNav/DateTimeSelectionV2/constants';
import { useState } from 'react';
import { PipelineData } from 'types/api/pipeline/def';
diff --git a/frontend/src/container/PipelinePage/PipelineListsView/Preview/components/PreviewIntervalSelector/components/LogsCountInInterval/index.tsx b/frontend/src/container/PipelinePage/PipelineListsView/Preview/components/PreviewIntervalSelector/components/LogsCountInInterval/index.tsx
index b388bc0e7a..6aed650031 100644
--- a/frontend/src/container/PipelinePage/PipelineListsView/Preview/components/PreviewIntervalSelector/components/LogsCountInInterval/index.tsx
+++ b/frontend/src/container/PipelinePage/PipelineListsView/Preview/components/PreviewIntervalSelector/components/LogsCountInInterval/index.tsx
@@ -6,7 +6,7 @@ import {
initialQueriesMap,
PANEL_TYPES,
} from 'constants/queryBuilder';
-import { Time } from 'container/TopNav/DateTimeSelection/config';
+import { Time } from 'container/TopNav/DateTimeSelectionV2/types';
import { useGetQueryRange } from 'hooks/queryBuilder/useGetQueryRange';
import cloneDeep from 'lodash-es/cloneDeep';
import { useMemo } from 'react';
diff --git a/frontend/src/container/PipelinePage/PipelineListsView/Preview/components/PreviewIntervalSelector/index.tsx b/frontend/src/container/PipelinePage/PipelineListsView/Preview/components/PreviewIntervalSelector/index.tsx
index a40f1d0376..3fd88813e4 100644
--- a/frontend/src/container/PipelinePage/PipelineListsView/Preview/components/PreviewIntervalSelector/index.tsx
+++ b/frontend/src/container/PipelinePage/PipelineListsView/Preview/components/PreviewIntervalSelector/index.tsx
@@ -1,10 +1,8 @@
import './styles.scss';
import { Select } from 'antd';
-import {
- RelativeDurationOptions,
- Time,
-} from 'container/TopNav/DateTimeSelection/config';
+import { RelativeDurationOptions } from 'container/TopNav/DateTimeSelectionV2/constants';
+import { Time } from 'container/TopNav/DateTimeSelectionV2/types';
import { TagFilter } from 'types/api/queryBuilder/queryBuilderData';
import LogsCountInInterval from './components/LogsCountInInterval';
diff --git a/frontend/src/container/PipelinePage/PipelineListsView/Preview/hooks/useSampleLogs.ts b/frontend/src/container/PipelinePage/PipelineListsView/Preview/hooks/useSampleLogs.ts
index c888fe0517..8a97f7d409 100644
--- a/frontend/src/container/PipelinePage/PipelineListsView/Preview/hooks/useSampleLogs.ts
+++ b/frontend/src/container/PipelinePage/PipelineListsView/Preview/hooks/useSampleLogs.ts
@@ -4,7 +4,7 @@ import {
initialQueriesMap,
PANEL_TYPES,
} from 'constants/queryBuilder';
-import { Time } from 'container/TopNav/DateTimeSelection/config';
+import { Time } from 'container/TopNav/DateTimeSelectionV2/types';
import { useGetQueryRange } from 'hooks/queryBuilder/useGetQueryRange';
import cloneDeep from 'lodash-es/cloneDeep';
import { useMemo } from 'react';
diff --git a/frontend/src/container/PublicDashboardContainer/PublicDashboardContainer.tsx b/frontend/src/container/PublicDashboardContainer/PublicDashboardContainer.tsx
index 0a7f290fa2..d6ffde301e 100644
--- a/frontend/src/container/PublicDashboardContainer/PublicDashboardContainer.tsx
+++ b/frontend/src/container/PublicDashboardContainer/PublicDashboardContainer.tsx
@@ -9,7 +9,7 @@ import DateTimeSelectionV2 from 'container/TopNav/DateTimeSelectionV2';
import {
CustomTimeType,
Time,
-} from 'container/TopNav/DateTimeSelectionV2/config';
+} from 'container/TopNav/DateTimeSelectionV2/types';
import dayjs from 'dayjs';
import { useIsDarkMode } from 'hooks/useDarkMode';
import GetMinMax from 'lib/getMinMax';
diff --git a/frontend/src/container/ServiceApplication/types.ts b/frontend/src/container/ServiceApplication/types.ts
index 8f90026055..fe8e25ab8c 100644
--- a/frontend/src/container/ServiceApplication/types.ts
+++ b/frontend/src/container/ServiceApplication/types.ts
@@ -1,9 +1,8 @@
import { ServiceDataProps } from 'api/metrics/getTopLevelOperations';
-import { Time } from 'container/TopNav/DateTimeSelection/config';
import {
CustomTimeType,
- Time as TimeV2,
-} from 'container/TopNav/DateTimeSelectionV2/config';
+ Time,
+} from 'container/TopNav/DateTimeSelectionV2/types';
import { GetQueryResultsProps } from 'lib/dashboard/getQueryResults';
import { UseQueryResult } from 'react-query';
import { SuccessResponse } from 'types/api';
@@ -26,7 +25,7 @@ export interface ServiceMetricsTableProps {
export interface GetQueryRangeRequestDataProps {
topLevelOperations: [keyof ServiceDataProps, string[]][];
- globalSelectedInterval: Time | TimeV2 | CustomTimeType;
+ globalSelectedInterval: Time | CustomTimeType;
dotMetricsEnabled: boolean;
}
diff --git a/frontend/src/container/TimeSeriesView/TimeSeriesView.tsx b/frontend/src/container/TimeSeriesView/TimeSeriesView.tsx
index 5b14549c0d..1f55f24e67 100644
--- a/frontend/src/container/TimeSeriesView/TimeSeriesView.tsx
+++ b/frontend/src/container/TimeSeriesView/TimeSeriesView.tsx
@@ -11,7 +11,7 @@ import { LogsLoading } from 'container/LogsLoading/LogsLoading';
import EmptyMetricsSearch from 'container/MetricsExplorer/Explorer/EmptyMetricsSearch';
import { MetricsLoading } from 'container/MetricsExplorer/MetricsLoading/MetricsLoading';
import NoLogs from 'container/NoLogs/NoLogs';
-import { CustomTimeType } from 'container/TopNav/DateTimeSelectionV2/config';
+import { CustomTimeType } from 'container/TopNav/DateTimeSelectionV2/types';
import { TracesLoading } from 'container/TracesExplorer/TraceLoading/TraceLoading';
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
import { useIsDarkMode } from 'hooks/useDarkMode';
diff --git a/frontend/src/container/TopNav/AutoRefresh/config.ts b/frontend/src/container/TopNav/AutoRefresh/config.ts
deleted file mode 100644
index 99c9db8ca5..0000000000
--- a/frontend/src/container/TopNav/AutoRefresh/config.ts
+++ /dev/null
@@ -1,77 +0,0 @@
-import GetMinMax, { GetMinMaxPayload } from 'lib/getMinMax';
-
-import { Time } from '../DateTimeSelection/config';
-import { CustomTimeType, Time as TimeV2 } from '../DateTimeSelectionV2/config';
-
-export const options: IOptions[] = [
- {
- label: 'off',
- key: 'off',
- value: 0,
- },
- {
- label: '5s',
- key: '5s',
- value: 5000,
- },
- {
- label: '10s',
- key: '10s',
- value: 10000,
- },
- {
- label: '30s',
- key: '30s',
- value: 30000,
- },
- {
- label: '1m',
- key: '1m',
- value: 60000,
- },
- {
- label: '5m',
- key: '5m',
- value: 300000,
- },
- {
- label: '10m',
- key: '10m',
- value: 600000,
- },
- {
- label: '30m',
- key: '30m',
- value: 1800000,
- },
- {
- label: '1h',
- key: '1h',
- value: 3600000,
- },
- {
- label: '2h',
- key: '2h',
- value: 7200000,
- },
- {
- label: '1d',
- key: '1d',
- value: 86400000,
- },
-];
-
-export interface IOptions {
- label: string;
- key: string;
- value: number;
-}
-
-export const getMinMax = (
- selectedTime: Time | TimeV2 | CustomTimeType,
- minTime: number,
- maxTime: number,
-): GetMinMaxPayload =>
- selectedTime !== 'custom'
- ? GetMinMax(selectedTime)
- : GetMinMax(selectedTime, [minTime, maxTime]);
diff --git a/frontend/src/container/TopNav/AutoRefresh/index.tsx b/frontend/src/container/TopNav/AutoRefresh/index.tsx
deleted file mode 100644
index d11b2c248b..0000000000
--- a/frontend/src/container/TopNav/AutoRefresh/index.tsx
+++ /dev/null
@@ -1,202 +0,0 @@
-import { CaretDownFilled } from '@ant-design/icons';
-import {
- Checkbox,
- Divider,
- Popover,
- Radio,
- RadioChangeEvent,
- Space,
- Typography,
-} from 'antd';
-import { CheckboxChangeEvent } from 'antd/lib/checkbox';
-import get from 'api/browser/localstorage/get';
-import set from 'api/browser/localstorage/set';
-import { DASHBOARD_TIME_IN_DURATION } from 'constants/app';
-import useUrlQuery from 'hooks/useUrlQuery';
-import _omit from 'lodash-es/omit';
-import { useCallback, useEffect, useMemo, useState } from 'react';
-import { useDispatch, useSelector } from 'react-redux';
-import { useLocation } from 'react-router-dom';
-import { useInterval } from 'react-use';
-import { Dispatch } from 'redux';
-import { AppState } from 'store/reducers';
-import AppActions from 'types/actions';
-import {
- UPDATE_AUTO_REFRESH_INTERVAL,
- UPDATE_TIME_INTERVAL,
-} from 'types/actions/globalTime';
-import { GlobalReducer } from 'types/reducer/globalTime';
-import { popupContainer } from 'utils/selectPopupContainer';
-
-import { getMinMax, options } from './config';
-import { ButtonContainer, Container } from './styles';
-
-function AutoRefresh({
- disabled = false,
- showAutoRefreshBtnPrimary = true,
-}: AutoRefreshProps): JSX.Element {
- const globalTime = useSelector<AppState, GlobalReducer>(
- (state) => state.globalTime,
- );
- const { pathname } = useLocation();
-
- const isDisabled = useMemo(
- () =>
- disabled ||
- globalTime.isAutoRefreshDisabled ||
- globalTime.selectedTime === 'custom',
- [globalTime.isAutoRefreshDisabled, disabled, globalTime.selectedTime],
- );
-
- const localStorageData = JSON.parse(get(DASHBOARD_TIME_IN_DURATION) || '{}');
-
- const localStorageValue = useMemo(() => localStorageData[pathname], [
- pathname,
- localStorageData,
- ]);
-
- const [isAutoRefreshEnabled, setIsAutoRefreshfreshEnabled] = useState<boolean>(
- Boolean(localStorageValue),
- );
-
- const dispatch = useDispatch<Dispatch<AppActions>>();
-
- useEffect(() => {
- const isAutoRefreshEnabled = Boolean(localStorageValue);
- dispatch({
- type: UPDATE_AUTO_REFRESH_INTERVAL,
- payload: localStorageValue,
- });
- setIsAutoRefreshfreshEnabled(isAutoRefreshEnabled);
- }, [localStorageValue, dispatch]);
-
- const params = useUrlQuery();
-
- const [selectedOption, setSelectedOption] = useState<string>(
- localStorageValue || options[0].key,
- );
-
- useEffect(() => {
- setSelectedOption(localStorageValue || options[0].key);
- }, [localStorageValue, params]);
-
- const getOption = useMemo(
- () => options.find((option) => option.key === selectedOption),
- [selectedOption],
- );
-
- useInterval(() => {
- const selectedValue = getOption?.value;
-
- if (isDisabled || !isAutoRefreshEnabled) {
- return;
- }
-
- if (selectedOption !== 'off' && selectedValue) {
- const { maxTime, minTime } = getMinMax(
- globalTime.selectedTime,
- globalTime.minTime,
- globalTime.maxTime,
- );
-
- dispatch({
- type: UPDATE_TIME_INTERVAL,
- payload: {
- maxTime,
- minTime,
- selectedTime: globalTime.selectedTime,
- },
- });
- }
- }, getOption?.value || 0);
-
- const onChangeHandler = useCallback(
- (event: RadioChangeEvent) => {
- const selectedValue = event.target.value;
- setSelectedOption(selectedValue);
- params.set(DASHBOARD_TIME_IN_DURATION, selectedValue);
- set(
- DASHBOARD_TIME_IN_DURATION,
- JSON.stringify({ ...localStorageData, [pathname]: selectedValue }),
- );
- setIsAutoRefreshfreshEnabled(true);
- },
- [params, pathname, localStorageData],
- );
-
- const onChangeAutoRefreshHandler = useCallback(
- (event: CheckboxChangeEvent) => {
- const { checked } = event.target;
- if (!checked) {
- // remove the path from localstorage
- set(
- DASHBOARD_TIME_IN_DURATION,
- JSON.stringify(_omit(localStorageData, pathname)),
- );
- }
- setIsAutoRefreshfreshEnabled(checked);
- },
- [localStorageData, pathname],
- );
-
- if (globalTime.selectedTime === 'custom') {
- // eslint-disable-next-line react/jsx-no-useless-fragment
- return <></>;
- }
-
- return (
- <Popover
- getPopupContainer={popupContainer}
- placement="bottomLeft"
- trigger={['click']}
- content={
- <Container>
- <Checkbox
- onChange={onChangeAutoRefreshHandler}
- checked={isAutoRefreshEnabled}
- disabled={isDisabled}
- >
- Auto Refresh
- </Checkbox>
-
- <Divider />
-
- <Typography.Paragraph disabled={isDisabled}>
- Refresh Interval
- </Typography.Paragraph>
-
- <Radio.Group onChange={onChangeHandler} value={selectedOption}>
- <Space direction="vertical">
- {options
- .filter((e) => e.label !== 'off')
- .map((option) => (
- <Radio disabled={isDisabled} key={option.key} value={option.key}>
- {option.label}
- </Radio>
- ))}
- </Space>
- </Radio.Group>
- </Container>
- }
- >
- <ButtonContainer
- title="Set auto refresh"
- type={showAutoRefreshBtnPrimary ? 'primary' : 'default'}
- >
- <CaretDownFilled />
- </ButtonContainer>
- </Popover>
- );
-}
-
-interface AutoRefreshProps {
- disabled?: boolean;
- showAutoRefreshBtnPrimary?: boolean;
-}
-
-AutoRefresh.defaultProps = {
- disabled: false,
- showAutoRefreshBtnPrimary: true,
-};
-
-export default AutoRefresh;
diff --git a/frontend/src/container/TopNav/AutoRefresh/styles.ts b/frontend/src/container/TopNav/AutoRefresh/styles.ts
deleted file mode 100644
index 9672a346e7..0000000000
--- a/frontend/src/container/TopNav/AutoRefresh/styles.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import { Button } from 'antd';
-import styled from 'styled-components';
-
-export const Container = styled.div`
- min-width: 8rem;
-`;
-
-export const ButtonContainer = styled(Button)`
- &&& {
- padding-left: 0.5rem;
- padding-right: 0.5rem;
- }
-`;
diff --git a/frontend/src/container/TopNav/AutoRefreshV2/config.ts b/frontend/src/container/TopNav/AutoRefreshV2/constants.ts
similarity index 60%
rename from frontend/src/container/TopNav/AutoRefreshV2/config.ts
rename to frontend/src/container/TopNav/AutoRefreshV2/constants.ts
index 8baae51d01..5d3d49cfa7 100644
--- a/frontend/src/container/TopNav/AutoRefreshV2/config.ts
+++ b/frontend/src/container/TopNav/AutoRefreshV2/constants.ts
@@ -1,9 +1,10 @@
-import GetMinMax, { GetMinMaxPayload } from 'lib/getMinMax';
-
-import { Time } from '../DateTimeSelection/config';
-import { CustomTimeType, Time as TimeV2 } from '../DateTimeSelectionV2/config';
+export interface IOptions {
+ label: string;
+ key: string;
+ value: number;
+}
-export const options: IOptions[] = [
+export const refreshIntervalOptions: IOptions[] = [
{
label: 'off',
key: 'off',
@@ -60,18 +61,3 @@ export const options: IOptions[] = [
value: 86400000,
},
];
-
-export interface IOptions {
- label: string;
- key: string;
- value: number;
-}
-
-export const getMinMax = (
- selectedTime: Time | TimeV2 | CustomTimeType,
- minTime: number,
- maxTime: number,
-): GetMinMaxPayload =>
- selectedTime !== 'custom'
- ? GetMinMax(selectedTime)
- : GetMinMax(selectedTime, [minTime, maxTime]);
diff --git a/frontend/src/container/TopNav/AutoRefreshV2/index.tsx b/frontend/src/container/TopNav/AutoRefreshV2/index.tsx
index edaca3e9b4..1dbf5b53be 100644
--- a/frontend/src/container/TopNav/AutoRefreshV2/index.tsx
+++ b/frontend/src/container/TopNav/AutoRefreshV2/index.tsx
@@ -7,6 +7,7 @@ import get from 'api/browser/localstorage/get';
import set from 'api/browser/localstorage/set';
import { DASHBOARD_TIME_IN_DURATION } from 'constants/app';
import useUrlQuery from 'hooks/useUrlQuery';
+import { getMinMaxForSelectedTime } from 'lib/getMinMax';
import _omit from 'lodash-es/omit';
import { Check } from 'lucide-react';
import { useCallback, useEffect, useMemo, useState } from 'react';
@@ -23,7 +24,7 @@ import {
import { GlobalReducer } from 'types/reducer/globalTime';
import { popupContainer } from 'utils/selectPopupContainer';
-import { getMinMax, options } from './config';
+import { refreshIntervalOptions } from './constants';
import { ButtonContainer } from './styles';
const DEFAULT_REFRESH_INTERVAL = '30s';
@@ -70,20 +71,23 @@ function AutoRefresh({
const params = useUrlQuery();
const defaultOption = useMemo(
- () => options.find((option) => option.key === DEFAULT_REFRESH_INTERVAL),
+ () =>
+ refreshIntervalOptions.find(
+ (option) => option.key === DEFAULT_REFRESH_INTERVAL,
+ ),
[],
);
const [selectedOption, setSelectedOption] = useState<string>(
- localStorageValue || options[0].key,
+ localStorageValue || refreshIntervalOptions[0].key,
);
useEffect(() => {
- setSelectedOption(localStorageValue || options[0].key);
+ setSelectedOption(localStorageValue || refreshIntervalOptions[0].key);
}, [localStorageValue, params, defaultOption]);
const getOption = useMemo(
- () => options.find((option) => option.key === selectedOption),
+ () => refreshIntervalOptions.find((option) => option.key === selectedOption),
[selectedOption],
);
@@ -95,7 +99,7 @@ function AutoRefresh({
}
if (selectedOption !== 'off' && selectedValue) {
- const { maxTime, minTime } = getMinMax(
+ const { maxTime, minTime } = getMinMaxForSelectedTime(
globalTime.selectedTime,
globalTime.minTime,
globalTime.maxTime,
@@ -175,7 +179,7 @@ function AutoRefresh({
>
Refresh Interval
</Typography.Paragraph>
- {options
+ {refreshIntervalOptions
.filter((e) => e.label !== 'off')
.map((option) => (
<Button
diff --git a/frontend/src/container/TopNav/DateTimeSelection/DateTimeSelection.styles.scss b/frontend/src/container/TopNav/DateTimeSelection/DateTimeSelection.styles.scss
deleted file mode 100644
index ea853553f0..0000000000
--- a/frontend/src/container/TopNav/DateTimeSelection/DateTimeSelection.styles.scss
+++ /dev/null
@@ -1,3 +0,0 @@
-.date-time-selection-container {
- margin-bottom: 16px;
-}
diff --git a/frontend/src/container/TopNav/DateTimeSelection/Refresh.tsx b/frontend/src/container/TopNav/DateTimeSelection/Refresh.tsx
deleted file mode 100644
index 6e608b1189..0000000000
--- a/frontend/src/container/TopNav/DateTimeSelection/Refresh.tsx
+++ /dev/null
@@ -1,36 +0,0 @@
-import { useEffect, useState } from 'react';
-
-import { RefreshTextContainer, Typography } from './styles';
-
-function RefreshText({
- onLastRefreshHandler,
- refreshButtonHidden,
-}: RefreshTextProps): JSX.Element {
- const [refreshText, setRefreshText] = useState<string>('');
-
- // this is to update the refresh text
- useEffect(() => {
- const interval = setInterval(() => {
- const text = onLastRefreshHandler();
- if (refreshText !== text) {
- setRefreshText(text);
- }
- }, 2000);
- return (): void => {
- clearInterval(interval);
- };
- }, [onLastRefreshHandler, refreshText]);
-
- return (
- <RefreshTextContainer refreshButtonHidden={refreshButtonHidden}>
- <Typography>{refreshText}</Typography>
- </RefreshTextContainer>
- );
-}
-
-interface RefreshTextProps {
- onLastRefreshHandler: () => string;
- refreshButtonHidden: boolean;
-}
-
-export default RefreshText;
diff --git a/frontend/src/container/TopNav/DateTimeSelection/config.ts b/frontend/src/container/TopNav/DateTimeSelection/config.ts
deleted file mode 100644
index dbab491b0c..0000000000
--- a/frontend/src/container/TopNav/DateTimeSelection/config.ts
+++ /dev/null
@@ -1,143 +0,0 @@
-import ROUTES from 'constants/routes';
-
-type FiveMin = '5m';
-type TenMin = '10m';
-type FifteenMin = '15m';
-type ThirtyMin = '30m';
-type OneMin = '1m';
-type SixHour = '6h';
-type OneHour = '1h';
-type FourHour = '4h';
-type ThreeHour = '3h';
-type TwelveHour = '12h';
-type OneDay = '1d';
-type ThreeDay = '3d';
-type OneWeek = '1w';
-type Custom = 'custom';
-
-export type Time =
- | FiveMin
- | TenMin
- | FifteenMin
- | ThirtyMin
- | OneMin
- | FourHour
- | SixHour
- | OneHour
- | ThreeHour
- | Custom
- | OneWeek
- | OneDay
- | TwelveHour
- | ThreeDay;
-
-export const Options: Option[] = [
- { value: '5m', label: 'Last 5 min' },
- { value: '15m', label: 'Last 15 min' },
- { value: '30m', label: 'Last 30 min' },
- { value: '1h', label: 'Last 1 hour' },
- { value: '6h', label: 'Last 6 hour' },
- { value: '1d', label: 'Last 1 day' },
- { value: '3d', label: 'Last 3 days' },
- { value: '1w', label: 'Last 1 week' },
- { value: 'custom', label: 'Custom' },
-];
-
-type TimeFrame = {
- '5min': string;
- '15min': string;
- '30min': string;
- '1hr': string;
- '6hr': string;
- '1day': string;
- '3days': string;
- '1week': string;
- [key: string]: string; // Index signature to allow any string as index
-};
-
-export const RelativeTimeMap: TimeFrame = {
- '5min': '5m',
- '15min': '15m',
- '30min': '30m',
- '1hr': '1h',
- '6hr': '6h',
- '1day': '1d',
- '3days': '3d',
- '1week': '1w',
-};
-
-export interface Option {
- value: Time;
- label: string;
-}
-
-export const RelativeDurationOptions: Option[] = [
- { value: '5m', label: 'Last 5 min' },
- { value: '15m', label: 'Last 15 min' },
- { value: '30m', label: 'Last 30 min' },
- { value: '1h', label: 'Last 1 hour' },
- { value: '6h', label: 'Last 6 hour' },
- { value: '1d', label: 'Last 1 day' },
- { value: '3d', label: 'Last 3 days' },
- { value: '1w', label: 'Last 1 week' },
-];
-
-export const getDefaultOption = (route: string): Time => {
- if (route === ROUTES.SERVICE_MAP) {
- return RelativeDurationOptions[2].value;
- }
- if (route === ROUTES.APPLICATION) {
- return Options[2].value;
- }
- return Options[2].value;
-};
-
-export const getOptions = (routes: string): Option[] => {
- if (routes === ROUTES.SERVICE_MAP) {
- return RelativeDurationOptions;
- }
- return Options;
-};
-
-export const routesToHideBreadCrumbs = [ROUTES.SUPPORT, ROUTES.ALL_DASHBOARD];
-
-export const routesToSkip = [
- ROUTES.HOME,
- ROUTES.SETTINGS,
- ROUTES.LIST_ALL_ALERT,
- ROUTES.TRACE_DETAIL,
- ROUTES.ALL_CHANNELS,
- ROUTES.USAGE_EXPLORER,
- ROUTES.GET_STARTED,
- ROUTES.GET_STARTED_WITH_CLOUD,
- ROUTES.GET_STARTED_APPLICATION_MONITORING,
- ROUTES.GET_STARTED_INFRASTRUCTURE_MONITORING,
- ROUTES.GET_STARTED_LOGS_MANAGEMENT,
- ROUTES.GET_STARTED_AWS_MONITORING,
- ROUTES.GET_STARTED_AZURE_MONITORING,
- ROUTES.VERSION,
- ROUTES.ALL_DASHBOARD,
- ROUTES.ORG_SETTINGS,
- ROUTES.INGESTION_SETTINGS,
- ROUTES.ERROR_DETAIL,
- ROUTES.LOGS_PIPELINES,
- ROUTES.BILLING,
- ROUTES.SUPPORT,
- ROUTES.WORKSPACE_LOCKED,
- ROUTES.WORKSPACE_SUSPENDED,
- ROUTES.LOGS,
- ROUTES.MY_SETTINGS,
- ROUTES.LIST_LICENSES,
-];
-
-export const routesToDisable = [ROUTES.LOGS_EXPLORER, ROUTES.LIVE_LOGS];
-
-export interface LocalStorageTimeRange {
- localstorageStartTime: string | null;
- localstorageEndTime: string | null;
-}
-
-export interface TimeRange {
- startTime: string;
- endTime: string;
-}
diff --git a/frontend/src/container/TopNav/DateTimeSelection/index.tsx b/frontend/src/container/TopNav/DateTimeSelection/index.tsx
deleted file mode 100644
index 35327fb212..0000000000
--- a/frontend/src/container/TopNav/DateTimeSelection/index.tsx
+++ /dev/null
@@ -1,425 +0,0 @@
-import './DateTimeSelection.styles.scss';
-
-import { SyncOutlined } from '@ant-design/icons';
-import { Button } from 'antd';
-import getLocalStorageKey from 'api/browser/localstorage/get';
-import setLocalStorageKey from 'api/browser/localstorage/set';
-import CustomTimePicker from 'components/CustomTimePicker/CustomTimePicker';
-import { DATE_TIME_FORMATS } from 'constants/dateTimeFormats';
-import { LOCALSTORAGE } from 'constants/localStorage';
-import { QueryParams } from 'constants/query';
-import ROUTES from 'constants/routes';
-import dayjs, { Dayjs } from 'dayjs';
-import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
-import { updateStepInterval } from 'hooks/queryBuilder/useStepInterval';
-import useUrlQuery from 'hooks/useUrlQuery';
-import GetMinMax from 'lib/getMinMax';
-import getTimeString from 'lib/getTimeString';
-import history from 'lib/history';
-import { isObject } from 'lodash-es';
-import { useCallback, useEffect, useMemo, useState } from 'react';
-import { connect, useSelector } from 'react-redux';
-import { RouteComponentProps, withRouter } from 'react-router-dom';
-import { bindActionCreators, Dispatch } from 'redux';
-import { ThunkDispatch } from 'redux-thunk';
-import { GlobalTimeLoading, UpdateTimeInterval } from 'store/actions';
-import { AppState } from 'store/reducers';
-import AppActions from 'types/actions';
-import { GlobalReducer } from 'types/reducer/globalTime';
-
-import AutoRefresh from '../AutoRefresh';
-import CustomDateTimeModal, { DateTimeRangeType } from '../CustomDateTimeModal';
-import { CustomTimeType, Time as TimeV2 } from '../DateTimeSelectionV2/config';
-import {
- getDefaultOption,
- getOptions,
- LocalStorageTimeRange,
- Time,
- TimeRange,
-} from './config';
-import RefreshText from './Refresh';
-import { Form, FormContainer, FormItem } from './styles';
-
-function DateTimeSelection({
- location,
- updateTimeInterval,
- globalTimeLoading,
-}: Props): JSX.Element {
- const [formSelector] = Form.useForm();
-
- const [hasSelectedTimeError, setHasSelectedTimeError] = useState(false);
- const [isOpen, setIsOpen] = useState<boolean>(false);
-
- const urlQuery = useUrlQuery();
- const searchStartTime = urlQuery.get('startTime');
- const searchEndTime = urlQuery.get('endTime');
-
- const {
- localstorageStartTime,
- localstorageEndTime,
- } = ((): LocalStorageTimeRange => {
- const routes = getLocalStorageKey(LOCALSTORAGE.METRICS_TIME_IN_DURATION);
-
- if (routes !== null) {
- const routesObject = JSON.parse(routes || '{}');
- const selectedTime = routesObject[location.pathname];
-
- if (selectedTime) {
- let parsedSelectedTime: TimeRange;
- try {
- parsedSelectedTime = JSON.parse(selectedTime);
- } catch {
- parsedSelectedTime = selectedTime;
- }
-
- if (isObject(parsedSelectedTime)) {
- return {
- localstorageStartTime: parsedSelectedTime.startTime,
- localstorageEndTime: parsedSelectedTime.endTime,
- };
- }
- return { localstorageStartTime: null, localstorageEndTime: null };
- }
- }
- return { localstorageStartTime: null, localstorageEndTime: null };
- })();
-
- const getTime = useCallback((): [number, number] | undefined => {
- if (searchEndTime && searchStartTime) {
- const startDate = dayjs(
- new Date(parseInt(getTimeString(searchStartTime), 10)),
- );
- const endDate = dayjs(new Date(parseInt(getTimeString(searchEndTime), 10)));
-
- return [startDate.toDate().getTime() || 0, endDate.toDate().getTime() || 0];
- }
- if (localstorageStartTime && localstorageEndTime) {
- const startDate = dayjs(localstorageStartTime);
- const endDate = dayjs(localstorageEndTime);
-
- return [startDate.toDate().getTime() || 0, endDate.toDate().getTime() || 0];
- }
- return undefined;
- }, [
- localstorageEndTime,
- localstorageStartTime,
- searchEndTime,
- searchStartTime,
- ]);
-
- const [options, setOptions] = useState(getOptions(location.pathname));
- const [refreshButtonHidden, setRefreshButtonHidden] = useState<boolean>(false);
- const [customDateTimeVisible, setCustomDTPickerVisible] = useState<boolean>(
- false,
- );
-
- const { stagedQuery, initQueryBuilderData } = useQueryBuilder();
-
- const { maxTime, minTime, selectedTime } = useSelector<
- AppState,
- GlobalReducer
- >((state) => state.globalTime);
-
- const getInputLabel = (
- startTime?: Dayjs,
- endTime?: Dayjs,
- timeInterval: Time | TimeV2 | CustomTimeType = '15m',
- ): string | Time => {
- if (startTime && endTime && timeInterval === 'custom') {
- const format = DATE_TIME_FORMATS.SLASH_DATETIME;
-
- const startString = startTime.format(format);
- const endString = endTime.format(format);
-
- return `${startString} - ${endString}`;
- }
-
- return timeInterval;
- };
-
- useEffect(() => {
- if (selectedTime === 'custom') {
- setRefreshButtonHidden(true);
- } else {
- setRefreshButtonHidden(false);
- }
- }, [selectedTime]);
-
- const getDefaultTime = (pathName: string): Time => {
- const defaultSelectedOption = getDefaultOption(pathName);
-
- const routes = getLocalStorageKey(LOCALSTORAGE.METRICS_TIME_IN_DURATION);
-
- if (routes !== null) {
- const routesObject = JSON.parse(routes || '{}');
- const selectedTime = routesObject[pathName];
-
- if (selectedTime) {
- let parsedSelectedTime: TimeRange;
- try {
- parsedSelectedTime = JSON.parse(selectedTime);
- } catch {
- parsedSelectedTime = selectedTime;
- }
- if (isObject(parsedSelectedTime)) {
- return 'custom';
- }
- return selectedTime;
- }
- }
-
- return defaultSelectedOption;
- };
-
- const updateLocalStorageForRoutes = (value: Time | TimeV2 | string): void => {
- const preRoutes = getLocalStorageKey(LOCALSTORAGE.METRICS_TIME_IN_DURATION);
- if (preRoutes !== null) {
- const preRoutesObject = JSON.parse(preRoutes);
-
- const preRoute = {
- ...preRoutesObject,
- };
- preRoute[location.pathname] = value;
-
- setLocalStorageKey(
- LOCALSTORAGE.METRICS_TIME_IN_DURATION,
- JSON.stringify(preRoute),
- );
- }
- };
-
- const onLastRefreshHandler = useCallback(() => {
- const currentTime = dayjs();
-
- const lastRefresh = dayjs(
- selectedTime === 'custom' ? minTime / 1000000 : maxTime / 1000000,
- );
-
- const secondsDiff = currentTime.diff(lastRefresh, 'seconds');
-
- const minutedDiff = currentTime.diff(lastRefresh, 'minutes');
- const hoursDiff = currentTime.diff(lastRefresh, 'hours');
- const daysDiff = currentTime.diff(lastRefresh, 'days');
- const monthsDiff = currentTime.diff(lastRefresh, 'months');
-
- if (monthsDiff > 0) {
- return `Last refresh -${monthsDiff} months ago`;
- }
-
- if (daysDiff > 0) {
- return `Last refresh - ${daysDiff} days ago`;
- }
-
- if (hoursDiff > 0) {
- return `Last refresh - ${hoursDiff} hrs ago`;
- }
-
- if (minutedDiff > 0) {
- return `Last refresh - ${minutedDiff} mins ago`;
- }
-
- return `Last refresh - ${secondsDiff} sec ago`;
- }, [maxTime, minTime, selectedTime]);
-
- const isLogsExplorerPage = useMemo(
- () => location.pathname === ROUTES.LOGS_EXPLORER,
- [location.pathname],
- );
-
- const onSelectHandler = (value: Time | TimeV2 | CustomTimeType): void => {
- if (value !== 'custom') {
- updateTimeInterval(value);
- updateLocalStorageForRoutes(value);
- if (refreshButtonHidden) {
- setRefreshButtonHidden(false);
- }
- } else {
- setRefreshButtonHidden(true);
- setCustomDTPickerVisible(true);
- }
-
- if (!isLogsExplorerPage) {
- urlQuery.set(QueryParams.startTime, minTime.toString());
- urlQuery.set(QueryParams.endTime, maxTime.toString());
- const generatedUrl = `${location.pathname}?${urlQuery.toString()}`;
- history.push(generatedUrl);
- }
-
- if (!stagedQuery) {
- return;
- }
- initQueryBuilderData(updateStepInterval(stagedQuery));
- };
-
- const onRefreshHandler = (): void => {
- onSelectHandler(selectedTime);
- onLastRefreshHandler();
- };
-
- const onCustomDateHandler = (dateTimeRange: DateTimeRangeType): void => {
- if (dateTimeRange !== null) {
- const [startTimeMoment, endTimeMoment] = dateTimeRange;
- if (startTimeMoment && endTimeMoment) {
- updateTimeInterval('custom', [
- startTimeMoment?.toDate().getTime() || 0,
- endTimeMoment?.toDate().getTime() || 0,
- ]);
- updateLocalStorageForRoutes(
- JSON.stringify({ startTime: startTimeMoment, endTime: endTimeMoment }),
- );
- if (!isLogsExplorerPage) {
- urlQuery.set(
- QueryParams.startTime,
- startTimeMoment?.toDate().getTime().toString(),
- );
- urlQuery.set(
- QueryParams.endTime,
- endTimeMoment?.toDate().getTime().toString(),
- );
- const generatedUrl = `${location.pathname}?${urlQuery.toString()}`;
- history.push(generatedUrl);
- }
- }
- }
- };
-
- // this is triggred when we change the routes and based on that we are changing the default options
- useEffect(() => {
- const metricsTimeDuration = getLocalStorageKey(
- LOCALSTORAGE.METRICS_TIME_IN_DURATION,
- );
-
- if (metricsTimeDuration === null) {
- setLocalStorageKey(
- LOCALSTORAGE.METRICS_TIME_IN_DURATION,
- JSON.stringify({}),
- );
- }
-
- const currentRoute = location.pathname;
- const time = getDefaultTime(currentRoute);
-
- const currentOptions = getOptions(currentRoute);
- setOptions(currentOptions);
-
- const getCustomOrIntervalTime = (time: Time): Time => {
- if (searchEndTime !== null && searchStartTime !== null) {
- return 'custom';
- }
- if (
- (localstorageEndTime === null || localstorageStartTime === null) &&
- time === 'custom'
- ) {
- return getDefaultOption(currentRoute);
- }
-
- return time;
- };
-
- const updatedTime = getCustomOrIntervalTime(time);
-
- const [preStartTime = 0, preEndTime = 0] = getTime() || [];
-
- setRefreshButtonHidden(updatedTime === 'custom');
-
- updateTimeInterval(updatedTime, [preStartTime, preEndTime]);
-
- if (updatedTime !== 'custom') {
- const { minTime, maxTime } = GetMinMax(updatedTime);
- urlQuery.set(QueryParams.startTime, minTime.toString());
- urlQuery.set(QueryParams.endTime, maxTime.toString());
- } else {
- urlQuery.set(QueryParams.startTime, preStartTime.toString());
- urlQuery.set(QueryParams.endTime, preEndTime.toString());
- }
- const generatedUrl = `${location.pathname}?${urlQuery.toString()}`;
- history.replace(generatedUrl);
-
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [location.pathname, updateTimeInterval, globalTimeLoading]);
-
- return (
- <div className="date-time-selection-container">
- <Form
- form={formSelector}
- layout="inline"
- initialValues={{ interval: selectedTime }}
- >
- <FormContainer>
- <CustomTimePicker
- open={isOpen}
- setOpen={setIsOpen}
- onSelect={(value: unknown): void => {
- onSelectHandler(value as Time);
- }}
- onError={(hasError: boolean): void => {
- setHasSelectedTimeError(hasError);
- }}
- selectedTime={selectedTime}
- onValidCustomDateChange={(dateTime): void =>
- onCustomDateHandler(dateTime.time as DateTimeRangeType)
- }
- selectedValue={getInputLabel(
- dayjs(minTime / 1000000),
- dayjs(maxTime / 1000000),
- selectedTime,
- )}
- data-testid="dropDown"
- items={options}
- minTime={minTime}
- maxTime={maxTime}
- />
-
- <FormItem hidden={refreshButtonHidden}>
- <Button
- icon={<SyncOutlined />}
- type="primary"
- onClick={onRefreshHandler}
- />
- </FormItem>
-
- <FormItem>
- <AutoRefresh disabled={refreshButtonHidden} />
- </FormItem>
- </FormContainer>
- </Form>
-
- {!hasSelectedTimeError && selectedTime !== 'custom' && (
- <RefreshText
- {...{
- onLastRefreshHandler,
- }}
- refreshButtonHidden={refreshButtonHidden}
- />
- )}
-
- <CustomDateTimeModal
- visible={customDateTimeVisible}
- onCreate={onCustomDateHandler}
- onCancel={(): void => {
- setCustomDTPickerVisible(false);
- }}
- setCustomDTPickerVisible={setCustomDTPickerVisible}
- />
- </div>
- );
-}
-
-interface DispatchProps {
- updateTimeInterval: (
- interval: Time | TimeV2 | CustomTimeType,
- dateTimeRange?: [number, number],
- ) => (dispatch: Dispatch<AppActions>) => void;
- globalTimeLoading: () => void;
-}
-
-const mapDispatchToProps = (
- dispatch: ThunkDispatch<unknown, unknown, AppActions>,
-): DispatchProps => ({
- updateTimeInterval: bindActionCreators(UpdateTimeInterval, dispatch),
- globalTimeLoading: bindActionCreators(GlobalTimeLoading, dispatch),
-});
-
-type Props = DispatchProps & RouteComponentProps;
-
-export default connect(null, mapDispatchToProps)(withRouter(DateTimeSelection));
diff --git a/frontend/src/container/TopNav/DateTimeSelection/styles.ts b/frontend/src/container/TopNav/DateTimeSelection/styles.ts
deleted file mode 100644
index 67cfa33083..0000000000
--- a/frontend/src/container/TopNav/DateTimeSelection/styles.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-import { Form as FormComponent, Typography as TypographyComponent } from 'antd';
-import styled from 'styled-components';
-
-export const Form = styled(FormComponent)`
- &&& {
- justify-content: flex-end;
- }
-`;
-
-export const Typography = styled(TypographyComponent)`
- &&& {
- text-align: right;
- }
-`;
-
-export const FormItem = styled(Form.Item)`
- &&& {
- margin: 0;
- }
-`;
-
-interface Props {
- refreshButtonHidden: boolean;
-}
-
-export const RefreshTextContainer = styled.div<Props>`
- visibility: ${({ refreshButtonHidden }): string =>
- refreshButtonHidden ? 'hidden' : 'visible'};
-`;
-
-export const FormContainer = styled.div`
- display: flex;
- gap: 0.1rem;
-`;
diff --git a/frontend/src/container/TopNav/DateTimeSelectionV2/config.ts b/frontend/src/container/TopNav/DateTimeSelectionV2/constants.ts
similarity index 78%
rename from frontend/src/container/TopNav/DateTimeSelectionV2/config.ts
rename to frontend/src/container/TopNav/DateTimeSelectionV2/constants.ts
index fbe93ada6d..a0ba987df3 100644
--- a/frontend/src/container/TopNav/DateTimeSelectionV2/config.ts
+++ b/frontend/src/container/TopNav/DateTimeSelectionV2/constants.ts
@@ -1,54 +1,6 @@
-/* eslint-disable sonarjs/no-duplicate-string */
import ROUTES from 'constants/routes';
-type FiveMin = '5m';
-type TenMin = '10m';
-type FifteenMin = '15m';
-type ThirtyMin = '30m';
-type FortyFiveMin = '45m';
-type OneMin = '1m';
-type ThreeHour = '3h';
-type SixHour = '6h';
-type OneHour = '1h';
-type FourHour = '4h';
-type TwelveHour = '12h';
-type OneDay = '1d';
-type ThreeDay = '3d';
-type FourDay = '4d';
-type TenDay = '10d';
-type OneWeek = '1w';
-type TwoWeek = '2w';
-type SixWeek = '6w';
-type OneMonth = '1month';
-type TwoMonths = '2months';
-type Custom = 'custom';
-
-export type Time =
- | FiveMin
- | TenMin
- | FifteenMin
- | ThirtyMin
- | OneMin
- | ThreeHour
- | FourHour
- | SixHour
- | OneHour
- | Custom
- | OneWeek
- | SixWeek
- | OneDay
- | FourDay
- | ThreeDay
- | FortyFiveMin
- | TwelveHour
- | TenDay
- | TwoWeek
- | OneMonth
- | TwoMonths;
-
-export type TimeUnit = 'm' | 'h' | 'd' | 'w';
-
-export type CustomTimeType = `${string}${TimeUnit}`;
+import { CustomTimeType, Option, Time, TimeFrame } from './types';
export const Options: Option[] = [
{ value: '5m', label: 'Last 5 minutes' },
@@ -63,10 +15,16 @@ export const Options: Option[] = [
{ value: 'custom', label: 'Custom Date Range' },
];
-export interface Option {
- value: Time;
- label: string;
-}
+export const RelativeTimeMap: TimeFrame = {
+ '5min': '5m',
+ '15min': '15m',
+ '30min': '30m',
+ '1hr': '1h',
+ '6hr': '6h',
+ '1day': '1d',
+ '3days': '3d',
+ '1week': '1w',
+};
export const OLD_RELATIVE_TIME_VALUES = [
'1min',
@@ -244,18 +202,3 @@ export const routesToSkip = [
];
export const routesToDisable = [ROUTES.LOGS_EXPLORER, ROUTES.LIVE_LOGS];
-
-export interface LocalStorageTimeRange {
- localstorageStartTime: string | null;
- localstorageEndTime: string | null;
-}
-
-export interface TimeRange {
- startTime: string;
- endTime: string;
-}
-
-export enum LexicalContext {
- CUSTOM_DATE_PICKER = 'customDatePicker',
- CUSTOM_DATE_TIME_INPUT = 'customDateTimeInput',
-}
diff --git a/frontend/src/container/TopNav/DateTimeSelectionV2/index.tsx b/frontend/src/container/TopNav/DateTimeSelectionV2/index.tsx
index 66170d44e4..2a7c2abd1a 100644
--- a/frontend/src/container/TopNav/DateTimeSelectionV2/index.tsx
+++ b/frontend/src/container/TopNav/DateTimeSelectionV2/index.tsx
@@ -35,19 +35,21 @@ import { v4 as uuid } from 'uuid';
import AutoRefresh from '../AutoRefreshV2';
import { DateTimeRangeType } from '../CustomDateTimeModal';
-import { RelativeTimeMap } from '../DateTimeSelection/config';
import {
convertOldTimeToNewValidCustomTimeFormat,
- CustomTimeType,
getDefaultOption,
getOptions,
- LocalStorageTimeRange,
OLD_RELATIVE_TIME_VALUES,
- Time,
- TimeRange,
-} from './config';
+ RelativeTimeMap,
+} from './constants';
import RefreshText from './Refresh';
import { Form, FormContainer, FormItem } from './styles';
+import {
+ CustomTimeType,
+ LocalStorageTimeRange,
+ Time,
+ TimeRange,
+} from './types';
function DateTimeSelection({
showAutoRefresh,
diff --git a/frontend/src/container/TopNav/DateTimeSelectionV2/types.ts b/frontend/src/container/TopNav/DateTimeSelectionV2/types.ts
new file mode 100644
index 0000000000..45d1ded548
--- /dev/null
+++ b/frontend/src/container/TopNav/DateTimeSelectionV2/types.ts
@@ -0,0 +1,80 @@
+type FiveMin = '5m';
+type TenMin = '10m';
+type FifteenMin = '15m';
+type ThirtyMin = '30m';
+type FortyFiveMin = '45m';
+type OneMin = '1m';
+type ThreeHour = '3h';
+type SixHour = '6h';
+type OneHour = '1h';
+type FourHour = '4h';
+type TwelveHour = '12h';
+type OneDay = '1d';
+type ThreeDay = '3d';
+type FourDay = '4d';
+type TenDay = '10d';
+type OneWeek = '1w';
+type TwoWeek = '2w';
+type SixWeek = '6w';
+type OneMonth = '1month';
+type TwoMonths = '2months';
+type Custom = 'custom';
+
+export type Time =
+ | FiveMin
+ | TenMin
+ | FifteenMin
+ | ThirtyMin
+ | OneMin
+ | ThreeHour
+ | FourHour
+ | SixHour
+ | OneHour
+ | Custom
+ | OneWeek
+ | SixWeek
+ | OneDay
+ | FourDay
+ | ThreeDay
+ | FortyFiveMin
+ | TwelveHour
+ | TenDay
+ | TwoWeek
+ | OneMonth
+ | TwoMonths;
+
+export type TimeUnit = 'm' | 'h' | 'd' | 'w';
+
+export type CustomTimeType = `${string}${TimeUnit}`;
+
+export interface Option {
+ value: Time;
+ label: string;
+}
+
+export type TimeFrame = {
+ '5min': string;
+ '15min': string;
+ '30min': string;
+ '1hr': string;
+ '6hr': string;
+ '1day': string;
+ '3days': string;
+ '1week': string;
+ [key: string]: string; // Index signature to allow any string as index
+};
+
+export interface LocalStorageTimeRange {
+ localstorageStartTime: string | null;
+ localstorageEndTime: string | null;
+}
+
+export interface TimeRange {
+ startTime: string;
+ endTime: string;
+}
+
+export enum LexicalContext {
+ CUSTOM_DATE_PICKER = 'customDatePicker',
+ CUSTOM_DATE_TIME_INPUT = 'customDateTimeInput',
+}
diff --git a/frontend/src/container/TopNav/index.tsx b/frontend/src/container/TopNav/index.tsx
index 50a0463669..e1541d2f98 100644
--- a/frontend/src/container/TopNav/index.tsx
+++ b/frontend/src/container/TopNav/index.tsx
@@ -7,7 +7,7 @@ import { matchPath, useHistory } from 'react-router-dom';
import NewExplorerCTA from '../NewExplorerCTA';
import DateTimeSelector from './DateTimeSelectionV2';
-import { routesToDisable, routesToSkip } from './DateTimeSelectionV2/config';
+import { routesToDisable, routesToSkip } from './DateTimeSelectionV2/constants';
function TopNav(): JSX.Element | null {
const { location } = useHistory();
diff --git a/frontend/src/container/TracesExplorer/ListView/index.tsx b/frontend/src/container/TracesExplorer/ListView/index.tsx
index 0e8609a6c0..6571facd79 100644
--- a/frontend/src/container/TracesExplorer/ListView/index.tsx
+++ b/frontend/src/container/TracesExplorer/ListView/index.tsx
@@ -12,7 +12,7 @@ import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
import EmptyLogsSearch from 'container/EmptyLogsSearch/EmptyLogsSearch';
import NoLogs from 'container/NoLogs/NoLogs';
import { useOptionsMenu } from 'container/OptionsMenu';
-import { CustomTimeType } from 'container/TopNav/DateTimeSelectionV2/config';
+import { CustomTimeType } from 'container/TopNav/DateTimeSelectionV2/types';
import TraceExplorerControls from 'container/TracesExplorer/Controls';
import { getListViewQuery } from 'container/TracesExplorer/explorerUtils';
import { useGetQueryRange } from 'hooks/queryBuilder/useGetQueryRange';
diff --git a/frontend/src/hooks/useQueryService.ts b/frontend/src/hooks/useQueryService.ts
index a5c54f2466..f950dbd793 100644
--- a/frontend/src/hooks/useQueryService.ts
+++ b/frontend/src/hooks/useQueryService.ts
@@ -1,10 +1,9 @@
import getService from 'api/metrics/getService';
import { AxiosError } from 'axios';
-import { Time } from 'container/TopNav/DateTimeSelection/config';
import {
CustomTimeType,
- Time as TimeV2,
-} from 'container/TopNav/DateTimeSelectionV2/config';
+ Time,
+} from 'container/TopNav/DateTimeSelectionV2/types';
import {
QueryKey,
useQuery,
@@ -30,7 +29,7 @@ export const useQueryService = ({
interface UseQueryServiceProps {
minTime: number;
maxTime: number;
- selectedTime: Time | TimeV2 | CustomTimeType;
+ selectedTime: Time | CustomTimeType;
selectedTags: Tags[];
options?: UseQueryOptions<PayloadProps, AxiosError, PayloadProps, QueryKey>;
}
diff --git a/frontend/src/lib/dashboard/getQueryResults.ts b/frontend/src/lib/dashboard/getQueryResults.ts
index 4bedd36240..178e7099d7 100644
--- a/frontend/src/lib/dashboard/getQueryResults.ts
+++ b/frontend/src/lib/dashboard/getQueryResults.ts
@@ -11,11 +11,10 @@ import {
import { ENTITY_VERSION_V5 } from 'constants/app';
import { PANEL_TYPES } from 'constants/queryBuilder';
import { timePreferenceType } from 'container/NewWidget/RightContainer/timeItems';
-import { Time } from 'container/TopNav/DateTimeSelection/config';
import {
CustomTimeType,
- Time as TimeV2,
-} from 'container/TopNav/DateTimeSelectionV2/config';
+ Time,
+} from 'container/TopNav/DateTimeSelectionV2/types';
import { Pagination } from 'hooks/queryPagination';
import { convertNewDataToOld } from 'lib/newQueryBuilder/convertNewDataToOld';
import { isEmpty } from 'lodash-es';
@@ -392,7 +391,7 @@ export interface GetQueryResultsProps {
query: Query;
graphType: PANEL_TYPES;
selectedTime: timePreferenceType;
- globalSelectedInterval?: Time | TimeV2 | CustomTimeType;
+ globalSelectedInterval?: Time | CustomTimeType;
variables?: Record<string, unknown>;
params?: Record<string, unknown>;
fillGaps?: boolean;
diff --git a/frontend/src/lib/getMinMax.ts b/frontend/src/lib/getMinMax.ts
index 2dfe086e5d..9930b89f5d 100644
--- a/frontend/src/lib/getMinMax.ts
+++ b/frontend/src/lib/getMinMax.ts
@@ -1,5 +1,7 @@
-import { Time } from 'container/TopNav/DateTimeSelection/config';
-import { Time as TimeV2 } from 'container/TopNav/DateTimeSelectionV2/config';
+import {
+ CustomTimeType,
+ Time,
+} from 'container/TopNav/DateTimeSelectionV2/types';
import { isString } from 'lodash-es';
import { GlobalReducer } from 'types/reducer/globalTime';
@@ -43,7 +45,7 @@ export const getMinTimeForRelativeTimes = (
};
const GetMinMax = (
- interval: Time | TimeV2 | string,
+ interval: Time | string,
dateTimeRange?: [number, number],
// eslint-disable-next-line sonarjs/cognitive-complexity
): GetMinMaxPayload => {
@@ -128,6 +130,15 @@ const GetMinMax = (
};
};
+export const getMinMaxForSelectedTime = (
+ selectedTime: Time | CustomTimeType,
+ minTime: number,
+ maxTime: number,
+): GetMinMaxPayload =>
+ selectedTime !== 'custom'
+ ? GetMinMax(selectedTime)
+ : GetMinMax(selectedTime, [minTime, maxTime]);
+
export interface GetMinMaxPayload {
minTime: GlobalReducer['minTime'];
maxTime: GlobalReducer['maxTime'];
diff --git a/frontend/src/lib/getStartEndRangeTime.ts b/frontend/src/lib/getStartEndRangeTime.ts
index 37e057b789..0a962b11cc 100644
--- a/frontend/src/lib/getStartEndRangeTime.ts
+++ b/frontend/src/lib/getStartEndRangeTime.ts
@@ -1,10 +1,9 @@
import { PANEL_TYPES } from 'constants/queryBuilder';
import { timePreferenceType } from 'container/NewWidget/RightContainer/timeItems';
-import { Time } from 'container/TopNav/DateTimeSelection/config';
import {
CustomTimeType,
- Time as TimeV2,
-} from 'container/TopNav/DateTimeSelectionV2/config';
+ Time,
+} from 'container/TopNav/DateTimeSelectionV2/types';
import store from 'store';
import getMaxMinTime from './getMaxMinTime';
@@ -41,7 +40,7 @@ const getStartEndRangeTime = ({
interface GetStartEndRangeTimesProps {
type?: timePreferenceType;
graphType?: PANEL_TYPES | null;
- interval?: Time | TimeV2 | CustomTimeType;
+ interval?: Time | CustomTimeType;
}
interface GetStartEndRangeTimesPayload {
diff --git a/frontend/src/pages/AlertDetails/hooks.tsx b/frontend/src/pages/AlertDetails/hooks.tsx
index 1d2ccb0a78..bbe9b31699 100644
--- a/frontend/src/pages/AlertDetails/hooks.tsx
+++ b/frontend/src/pages/AlertDetails/hooks.tsx
@@ -17,7 +17,7 @@ import AlertHistory from 'container/AlertHistory';
import { TIMELINE_TABLE_PAGE_SIZE } from 'container/AlertHistory/constants';
import { AlertDetailsTab, TimelineFilter } from 'container/AlertHistory/types';
import { urlKey } from 'container/AllError/utils';
-import { RelativeTimeMap } from 'container/TopNav/DateTimeSelection/config';
+import { RelativeTimeMap } from 'container/TopNav/DateTimeSelectionV2/constants';
import useAxiosError from 'hooks/useAxiosError';
import { useNotifications } from 'hooks/useNotifications';
import { useSafeNavigate } from 'hooks/useSafeNavigate';
diff --git a/frontend/src/pages/TracesFunnels/FunnelContext.tsx b/frontend/src/pages/TracesFunnels/FunnelContext.tsx
index ed944ecc37..941e8e13b9 100644
--- a/frontend/src/pages/TracesFunnels/FunnelContext.tsx
+++ b/frontend/src/pages/TracesFunnels/FunnelContext.tsx
@@ -1,11 +1,10 @@
import logEvent from 'api/common/logEvent';
import { ValidateFunnelResponse } from 'api/traceFunnels';
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
-import { Time } from 'container/TopNav/DateTimeSelection/config';
import {
CustomTimeType,
- Time as TimeV2,
-} from 'container/TopNav/DateTimeSelectionV2/config';
+ Time,
+} from 'container/TopNav/DateTimeSelectionV2/types';
import { normalizeSteps } from 'hooks/TracesFunnels/useFunnelConfiguration';
import { useValidateFunnelSteps } from 'hooks/TracesFunnels/useFunnels';
import getStartEndRangeTime from 'lib/getStartEndRangeTime';
@@ -34,7 +33,7 @@ import { v4 } from 'uuid';
interface FunnelContextType {
startTime: number;
endTime: number;
- selectedTime: CustomTimeType | Time | TimeV2;
+ selectedTime: CustomTimeType | Time;
validTracesCount: number;
funnelId: string;
steps: FunnelStepData[];
diff --git a/frontend/src/providers/Dashboard/Dashboard.tsx b/frontend/src/providers/Dashboard/Dashboard.tsx
index 34988b17e4..a8d7360be2 100644
--- a/frontend/src/providers/Dashboard/Dashboard.tsx
+++ b/frontend/src/providers/Dashboard/Dashboard.tsx
@@ -5,7 +5,6 @@ import locked from 'api/v1/dashboards/id/lock';
import { ALL_SELECTED_VALUE } from 'components/NewSelect/utils';
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
import ROUTES from 'constants/routes';
-import { getMinMax } from 'container/TopNav/AutoRefresh/config';
import dayjs, { Dayjs } from 'dayjs';
import { useDashboardVariablesFromLocalStorage } from 'hooks/dashboard/useDashboardFromLocalStorage';
import useVariablesFromUrl from 'hooks/dashboard/useVariablesFromUrl';
@@ -13,6 +12,7 @@ import { useSafeNavigate } from 'hooks/useSafeNavigate';
import useTabVisibility from 'hooks/useTabFocus';
import useUrlQuery from 'hooks/useUrlQuery';
import { getUpdatedLayout } from 'lib/dashboard/getUpdatedLayout';
+import { getMinMaxForSelectedTime } from 'lib/getMinMax';
import { defaultTo, isEmpty } from 'lodash-es';
import isEqual from 'lodash-es/isEqual';
import isUndefined from 'lodash-es/isUndefined';
@@ -371,7 +371,7 @@ export function DashboardProvider({
onOk() {
setSelectedDashboard(updatedDashboardData);
- const { maxTime, minTime } = getMinMax(
+ const { maxTime, minTime } = getMinMaxForSelectedTime(
globalTime.selectedTime,
globalTime.minTime,
globalTime.maxTime,
diff --git a/frontend/src/store/actions/global.ts b/frontend/src/store/actions/global.ts
index 149572d726..3fa53f03f7 100644
--- a/frontend/src/store/actions/global.ts
+++ b/frontend/src/store/actions/global.ts
@@ -1,15 +1,14 @@
-import { Time } from 'container/TopNav/DateTimeSelection/config';
import {
CustomTimeType,
- Time as TimeV2,
-} from 'container/TopNav/DateTimeSelectionV2/config';
+ Time,
+} from 'container/TopNav/DateTimeSelectionV2/types';
import GetMinMax from 'lib/getMinMax';
import { Dispatch } from 'redux';
import AppActions from 'types/actions';
import { UPDATE_TIME_INTERVAL } from 'types/actions/globalTime';
export const UpdateTimeInterval = (
- interval: Time | TimeV2 | CustomTimeType,
+ interval: Time | CustomTimeType,
dateTimeRange: [number, number] = [0, 0],
): ((dispatch: Dispatch<AppActions>) => void) => (
dispatch: Dispatch<AppActions>,
diff --git a/frontend/src/store/reducers/global.ts b/frontend/src/store/reducers/global.ts
index 121f27218b..1b78f9bca4 100644
--- a/frontend/src/store/reducers/global.ts
+++ b/frontend/src/store/reducers/global.ts
@@ -1,4 +1,4 @@
-import { getDefaultOption } from 'container/TopNav/DateTimeSelection/config';
+import { getDefaultOption } from 'container/TopNav/DateTimeSelectionV2/constants';
import {
GLOBAL_TIME_LOADING_START,
GlobalTimeAction,
diff --git a/frontend/src/types/actions/globalTime.ts b/frontend/src/types/actions/globalTime.ts
index 02243b7e05..0af781d0ef 100644
--- a/frontend/src/types/actions/globalTime.ts
+++ b/frontend/src/types/actions/globalTime.ts
@@ -1,8 +1,7 @@
-import { Time } from 'container/TopNav/DateTimeSelection/config';
import {
CustomTimeType,
- Time as TimeV2,
-} from 'container/TopNav/DateTimeSelectionV2/config';
+ Time,
+} from 'container/TopNav/DateTimeSelectionV2/types';
import { ResetIdStartAndEnd, SetSearchQueryString } from './logs';
@@ -17,7 +16,7 @@ export type GlobalTime = {
};
interface UpdateTime extends GlobalTime {
- selectedTime: Time | TimeV2 | CustomTimeType;
+ selectedTime: Time | CustomTimeType;
}
interface UpdateTimeInterval {
diff --git a/frontend/src/types/reducer/globalTime.ts b/frontend/src/types/reducer/globalTime.ts
index bc5e4e2d67..97d80a820f 100644
--- a/frontend/src/types/reducer/globalTime.ts
+++ b/frontend/src/types/reducer/globalTime.ts
@@ -1,15 +1,14 @@
-import { Time } from 'container/TopNav/DateTimeSelection/config';
import {
CustomTimeType,
- Time as TimeV2,
-} from 'container/TopNav/DateTimeSelectionV2/config';
+ Time,
+} from 'container/TopNav/DateTimeSelectionV2/types';
import { GlobalTime } from 'types/actions/globalTime';
export interface GlobalReducer {
maxTime: GlobalTime['maxTime'];
minTime: GlobalTime['minTime'];
loading: boolean;
- selectedTime: Time | TimeV2 | CustomTimeType;
+ selectedTime: Time | CustomTimeType;
isAutoRefreshDisabled: boolean;
selectedAutoRefreshInterval: string;
}