Skip to content

Commit d6eb8fe

Browse files
committed
frontend: Resource: Add support for cluster via URL var
This is so that in multi cluster mode the URL can keep the group of clusters in the URL, but the details still know which cluster to use for fetching details. Signed-off-by: René Dudfield <[email protected]>
1 parent 5925769 commit d6eb8fe

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

frontend/src/components/common/Resource/Resource.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import React, { PropsWithChildren, ReactNode } from 'react';
1717
import { useTranslation } from 'react-i18next';
1818
import { generatePath, NavLinkProps, useLocation } from 'react-router-dom';
1919
import YAML from 'yaml';
20-
import { labelSelectorToQuery, ResourceClasses } from '../../../lib/k8s';
20+
import { labelSelectorToQuery, ResourceClasses, useClusterFromURLVar } from '../../../lib/k8s';
2121
import { ApiError } from '../../../lib/k8s/apiProxy';
2222
import { KubeCondition, KubeContainer, KubeContainerStatus } from '../../../lib/k8s/cluster';
2323
import { KubeEvent } from '../../../lib/k8s/event';
@@ -113,7 +113,6 @@ export function DetailsGrid<T extends KubeObjectClass>(props: DetailsGridProps<T
113113
resourceType,
114114
name,
115115
namespace,
116-
cluster,
117116
children,
118117
withEvents,
119118
extraSections,
@@ -128,6 +127,8 @@ export function DetailsGrid<T extends KubeObjectClass>(props: DetailsGridProps<T
128127
state => state.detailsViewSection.detailsViewSectionsProcessors
129128
);
130129
const dispatchHeadlampEvent = useEventCallback();
130+
const clusterFromURLVar = useClusterFromURLVar();
131+
const cluster = props.cluster || clusterFromURLVar;
131132

132133
// This component used to have a MainInfoSection with all these props passed to it, so we're
133134
// using them to accomplish the same behavior.

0 commit comments

Comments
 (0)