Skip to content

Commit

Permalink
Merge pull request #2475 from headlamp-k8s/fix-useList
Browse files Browse the repository at this point in the history
frontend: cluster: Fix useCluster to use the cluster group
  • Loading branch information
illume authored Oct 24, 2024
2 parents 6058f53 + a0393d0 commit 944c25b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions frontend/src/lib/k8s/KubeObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import helpers from '../../helpers';
import { getCluster } from '../cluster';
import { createRouteURL } from '../router';
import { timeAgo } from '../util';
import { useConnectApi } from '.';
import { useClusterGroup, useConnectApi } from '.';
import { useKubeObject, useKubeObjectList } from './api/v2/hooks';
import { ApiError, apiFactory, apiFactoryWithNamespace, post, QueryParameters } from './apiProxy';
import { KubeEvent } from './event';
Expand Down Expand Up @@ -289,13 +289,18 @@ export class KubeObject<T extends KubeObjectInterface | KubeEvent = any> {
this: new (...args: any) => K,
{
cluster,
clusters,
namespace,
...queryParams
}: { cluster?: string; namespace?: string } & QueryParameters = {}
}: { cluster?: string; namespace?: string; clusters?: string[] } & QueryParameters = {}
) {
const clusterGroup = useClusterGroup();
const theClusters = clusters || clusterGroup;

return useKubeObjectList<K>({
queryParams: queryParams,
kubeObjectClass: this as (new (...args: any) => K) & typeof KubeObject<any>,
clusters: theClusters,
cluster: cluster,
namespace: namespace,
});
Expand Down

0 comments on commit 944c25b

Please sign in to comment.