diff --git a/frontend/src/container/Home/HomeChecklist/HomeChecklist.tsx b/frontend/src/container/Home/HomeChecklist/HomeChecklist.tsx
index 3bf52945d058..6dab3d07526b 100644
--- a/frontend/src/container/Home/HomeChecklist/HomeChecklist.tsx
+++ b/frontend/src/container/Home/HomeChecklist/HomeChecklist.tsx
@@ -32,7 +32,7 @@ function HomeChecklist({
onSkip: (item: ChecklistItem) => void;
isLoading: boolean;
}): JSX.Element {
- const { user, activeLicenseV3 } = useAppContext();
+ const { user, activeLicense } = useAppContext();
const [completedChecklistItems, setCompletedChecklistItems] = useState<
ChecklistItem[]
@@ -94,8 +94,8 @@ function HomeChecklist({
if (item.toRoute !== ROUTES.GET_STARTED_WITH_CLOUD) {
history.push(item.toRoute || '');
} else if (
- activeLicenseV3 &&
- activeLicenseV3.platform === LicensePlatform.CLOUD
+ activeLicense &&
+ activeLicense.platform === LicensePlatform.CLOUD
) {
history.push(item.toRoute || '');
} else {
diff --git a/frontend/src/container/Home/Services/ServiceMetrics.tsx b/frontend/src/container/Home/Services/ServiceMetrics.tsx
index 7f1baf92f1b3..d588f9d65d10 100644
--- a/frontend/src/container/Home/Services/ServiceMetrics.tsx
+++ b/frontend/src/container/Home/Services/ServiceMetrics.tsx
@@ -23,7 +23,7 @@ import { Link } from 'react-router-dom';
import { AppState } from 'store/reducers';
import {
LicensePlatform,
- LicenseV3ResModel,
+ LicenseResModel,
} from 'types/api/licensesV3/getActive';
import { ServicesList } from 'types/api/metrics/getService';
import { GlobalReducer } from 'types/reducer/globalTime';
@@ -42,7 +42,7 @@ const EmptyState = memo(
activeLicenseV3,
}: {
user: IUser;
- activeLicenseV3: LicenseV3ResModel | null;
+ activeLicenseV3: LicenseResModel | null;
}): JSX.Element => (
@@ -146,7 +146,7 @@ function ServiceMetrics({
GlobalReducer
>((state) => state.globalTime);
- const { user, activeLicenseV3 } = useAppContext();
+ const { user, activeLicense } = useAppContext();
const [timeRange, setTimeRange] = useState(() => {
const now = new Date().getTime();
@@ -335,7 +335,7 @@ function ServiceMetrics({
{servicesExist ? (
) : (
-
+
)}
diff --git a/frontend/src/container/Home/Services/ServiceTraces.tsx b/frontend/src/container/Home/Services/ServiceTraces.tsx
index 23d3f613ba49..fd4b0592e169 100644
--- a/frontend/src/container/Home/Services/ServiceTraces.tsx
+++ b/frontend/src/container/Home/Services/ServiceTraces.tsx
@@ -32,7 +32,7 @@ export default function ServiceTraces({
(state) => state.globalTime,
);
- const { user, activeLicenseV3 } = useAppContext();
+ const { user, activeLicense } = useAppContext();
const now = new Date().getTime();
const [timeRange, setTimeRange] = useState({
@@ -124,8 +124,8 @@ export default function ServiceTraces({
});
if (
- activeLicenseV3 &&
- activeLicenseV3.platform === LicensePlatform.CLOUD
+ activeLicense &&
+ activeLicense.platform === LicensePlatform.CLOUD
) {
history.push(ROUTES.GET_STARTED_WITH_CLOUD);
} else {
@@ -160,7 +160,7 @@ export default function ServiceTraces({
),
- [user?.role, activeLicenseV3],
+ [user?.role, activeLicense],
);
const renderDashboardsList = useCallback(
diff --git a/frontend/src/container/InfraMonitoringHosts/HostsList.tsx b/frontend/src/container/InfraMonitoringHosts/HostsList.tsx
index c06f63a4b067..f4dac3f9eb16 100644
--- a/frontend/src/container/InfraMonitoringHosts/HostsList.tsx
+++ b/frontend/src/container/InfraMonitoringHosts/HostsList.tsx
@@ -8,6 +8,11 @@ import HostMetricDetail from 'components/HostMetricsDetail';
import QuickFilters from 'components/QuickFilters/QuickFilters';
import { QuickFiltersSource } from 'components/QuickFilters/types';
import { InfraMonitoringEvents } from 'constants/events';
+import {
+ getFiltersFromParams,
+ getOrderByFromParams,
+} from 'container/InfraMonitoringK8s/commonUtils';
+import { INFRA_MONITORING_K8S_PARAMS_KEYS } from 'container/InfraMonitoringK8s/constants';
import { usePageSize } from 'container/InfraMonitoringK8s/utils';
import { useGetHostList } from 'hooks/infraMonitoring/useGetHostList';
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
@@ -15,6 +20,7 @@ import { useQueryOperations } from 'hooks/queryBuilder/useQueryBuilderOperations
import { Filter } from 'lucide-react';
import { useCallback, useEffect, useMemo, useState } from 'react';
import { useSelector } from 'react-redux';
+import { useSearchParams } from 'react-router-dom-v5-compat';
import { AppState } from 'store/reducers';
import { IBuilderQuery, Query } from 'types/api/queryBuilder/queryBuilderData';
import { GlobalReducer } from 'types/reducer/globalTime';
@@ -27,20 +33,51 @@ function HostsList(): JSX.Element {
const { maxTime, minTime } = useSelector
(
(state) => state.globalTime,
);
+ const [searchParams, setSearchParams] = useSearchParams();
const [currentPage, setCurrentPage] = useState(1);
- const [filters, setFilters] = useState({
- items: [],
- op: 'and',
+ const [filters, setFilters] = useState(() => {
+ const filters = getFiltersFromParams(
+ searchParams,
+ INFRA_MONITORING_K8S_PARAMS_KEYS.FILTERS,
+ );
+ if (!filters) {
+ return {
+ items: [],
+ op: 'and',
+ };
+ }
+ return filters;
});
const [showFilters, setShowFilters] = useState(true);
const [orderBy, setOrderBy] = useState<{
columnName: string;
order: 'asc' | 'desc';
- } | null>(null);
+ } | null>(() => getOrderByFromParams(searchParams));
- const [selectedHostName, setSelectedHostName] = useState(null);
+ const handleOrderByChange = (
+ orderBy: {
+ columnName: string;
+ order: 'asc' | 'desc';
+ } | null,
+ ): void => {
+ setOrderBy(orderBy);
+ setSearchParams({
+ ...Object.fromEntries(searchParams.entries()),
+ [INFRA_MONITORING_K8S_PARAMS_KEYS.ORDER_BY]: JSON.stringify(orderBy),
+ });
+ };
+
+ const [selectedHostName, setSelectedHostName] = useState(() => {
+ const hostName = searchParams.get('hostName');
+ return hostName || null;
+ });
+
+ const handleHostClick = (hostName: string): void => {
+ setSelectedHostName(hostName);
+ setSearchParams({ ...searchParams, hostName });
+ };
const { pageSize, setPageSize } = usePageSize('hosts');
@@ -82,6 +119,10 @@ function HostsList(): JSX.Element {
const isNewFilterAdded = value.items.length !== filters.items.length;
setFilters(value);
handleChangeQueryData('filters', value);
+ setSearchParams({
+ ...Object.fromEntries(searchParams.entries()),
+ [INFRA_MONITORING_K8S_PARAMS_KEYS.FILTERS]: JSON.stringify(value),
+ });
if (isNewFilterAdded) {
setCurrentPage(1);
@@ -161,7 +202,10 @@ function HostsList(): JSX.Element {