Skip to content

Commit

Permalink
frontend: CustomResourceInstancesList: Fix to work with multi cluster
Browse files Browse the repository at this point in the history
Before the page would crash with multi clusters selected.
Now it does not crash, instead the related cluster is listed
next to each instance in multi cluster mode.

In single cluster mode it is the same as before.

Signed-off-by: René Dudfield <[email protected]>
  • Loading branch information
illume committed Nov 18, 2024
1 parent 316c1df commit 4d192e6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions frontend/src/components/crd/CustomResourceInstancesList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,14 @@ import { ResourceListView } from '../common/Resource';
function CrInstancesView({ crds }: { crds: CRD[]; key: string }) {
const { t } = useTranslation(['glossary', 'translation']);

const crdInfo = useMemo(() => crds.map(crd => crd.makeCRClass()), [crds]);
const queries = crdInfo.map(cr => cr.useList());
const dataClassCrds = crds.map(crd => {
const crdClass = crd.makeCRClass();
const data = crdClass.useList({ cluster: crd.cluster });
return { data, crdClass, crd };
});

const queries = dataClassCrds.map(it => it.data);

const [isWarningClosed, setIsWarningClosed] = useState(false);

const { crInstancesList, getCRDForCR, isLoading, crdsFailedToLoad, allFailed } = useMemo(() => {
Expand Down Expand Up @@ -112,6 +118,7 @@ function CrInstancesView({ crds }: { crds: CRD[]; key: string }) {
);
},
},
'cluster',
{
label: 'Categories',
getValue: cr => {
Expand Down

0 comments on commit 4d192e6

Please sign in to comment.