From 2ecd830e8d57140a02aef28258827d55763175ee Mon Sep 17 00:00:00 2001 From: rahulkeswani101 Date: Wed, 6 Nov 2024 19:11:48 +0530 Subject: [PATCH] feat: added filters and time selection in traces tab --- .../HostMetricTraces.styles.scss | 38 ++-- .../HostMetricTraces/HostMetricTraces.tsx | 213 +++++++++++++++--- .../HostMetricTraces/constants.ts | 26 +-- .../HostMetricLogsDetailedView.tsx | 7 - .../components/HostMetricsDetail/index.tsx | 6 +- 5 files changed, 209 insertions(+), 81 deletions(-) diff --git a/frontend/src/components/HostMetricsDetail/HostMetricTraces/HostMetricTraces.styles.scss b/frontend/src/components/HostMetricsDetail/HostMetricTraces/HostMetricTraces.styles.scss index 76dbaa888c..eb4e2f8402 100644 --- a/frontend/src/components/HostMetricsDetail/HostMetricTraces/HostMetricTraces.styles.scss +++ b/frontend/src/components/HostMetricsDetail/HostMetricTraces/HostMetricTraces.styles.scss @@ -1,30 +1,18 @@ .host-metric-traces { - .ant-table { - background: #121212; - color: #fff; + margin-top: 1rem; - .ant-table-thead>tr>th { - background: #121212; - color: #fff; - border-bottom: 1px solid #303030; - } + .host-metric-traces-header { + display: flex; + justify-content: space-between; + margin-bottom: 2rem; - .ant-table-tbody>tr>td { - background: #121212; - color: #fff; - border-bottom: 1px solid #303030; - } - - .ant-table-tbody>tr:hover>td { - background: #1a1a1a; - } + .filter-section { + width: 35.7rem; + } } - .duration-cell { - display: inline-block; - padding: 2px 8px; - background: #d64937; - border-radius: 4px; - color: #fff; - } -} \ No newline at end of file + .ant-table-content { + overflow: hidden !important; + } + +} diff --git a/frontend/src/components/HostMetricsDetail/HostMetricTraces/HostMetricTraces.tsx b/frontend/src/components/HostMetricsDetail/HostMetricTraces/HostMetricTraces.tsx index 7d939992d1..74a7be43fb 100644 --- a/frontend/src/components/HostMetricsDetail/HostMetricTraces/HostMetricTraces.tsx +++ b/frontend/src/components/HostMetricsDetail/HostMetricTraces/HostMetricTraces.tsx @@ -1,11 +1,36 @@ import './HostMetricTraces.styles.scss'; -import { Skeleton } from 'antd'; import { ResizeTable } from 'components/ResizeTable'; import { DEFAULT_ENTITY_VERSION } from 'constants/app'; +import { LOCALSTORAGE } from 'constants/localStorage'; +import { QueryParams } from 'constants/query'; +import EmptyLogsSearch from 'container/EmptyLogsSearch/EmptyLogsSearch'; +import NoLogs from 'container/NoLogs/NoLogs'; +import { useOptionsMenu } from 'container/OptionsMenu'; +import QueryBuilderSearch from 'container/QueryBuilder/filters/QueryBuilderSearch'; +import { ErrorText } from 'container/TimeSeriesView/styles'; +import DateTimeSelectionV2 from 'container/TopNav/DateTimeSelectionV2'; +import { + CustomTimeType, + Time, +} from 'container/TopNav/DateTimeSelectionV2/config'; +import TraceExplorerControls from 'container/TracesExplorer/Controls'; +import { + defaultSelectedColumns, + PER_PAGE_OPTIONS, +} from 'container/TracesExplorer/ListView/configs'; +import { TracesLoading } from 'container/TracesExplorer/TraceLoading/TraceLoading'; +import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder'; +import { Pagination } from 'hooks/queryPagination'; +import useUrlQueryData from 'hooks/useUrlQueryData'; import { GetMetricQueryRange } from 'lib/dashboard/getQueryResults'; -import { useEffect, useMemo, useState } from 'react'; +import GetMinMax from 'lib/getMinMax'; +import { useCallback, useEffect, useMemo, useState } from 'react'; import { useQuery } from 'react-query'; +import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse'; +import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData'; +import { DataSource } from 'types/common/queryBuilder'; +import { v4 as uuidv4 } from 'uuid'; import { columns, getHostTracesQueryPayload } from './constants'; @@ -15,25 +40,124 @@ interface Props { startTime: number; endTime: number; }; + isModalTimeSelection: boolean; } -function HostMetricTraces({ hostName, timeRange }: Props): JSX.Element { +function HostMetricTraces({ + hostName, + timeRange, + isModalTimeSelection, +}: Props): JSX.Element { const [traces, setTraces] = useState([]); const [offset] = useState(0); + const [modalTimeRange, setModalTimeRange] = useState(timeRange); + const [, setSelectedInterval] = useState