From 2be897c4a1357860e6a51a12974c92a98f9f49b0 Mon Sep 17 00:00:00 2001 From: Matt Hook Date: Tue, 9 Apr 2024 15:50:26 +1200 Subject: [PATCH] fix(services): speed up service count on the kubernetes dashboard [EE-6967] (#11525) --- app/react/kubernetes/dashboard/DashboardView.tsx | 3 ++- .../ServicesView/ServicesDatatable/ServicesDatatable.tsx | 1 + app/react/kubernetes/services/service.ts | 8 ++++---- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/react/kubernetes/dashboard/DashboardView.tsx b/app/react/kubernetes/dashboard/DashboardView.tsx index 89c2a4d14..5f459af2d 100644 --- a/app/react/kubernetes/dashboard/DashboardView.tsx +++ b/app/react/kubernetes/dashboard/DashboardView.tsx @@ -34,7 +34,8 @@ export function DashboardView() { ); const { data: services, ...servicesQuery } = useServicesForCluster( environmentId, - namespaceNames + namespaceNames, + { lookupApplications: false } ); const { data: ingresses, ...ingressesQuery } = useIngresses( environmentId, diff --git a/app/react/kubernetes/services/ServicesView/ServicesDatatable/ServicesDatatable.tsx b/app/react/kubernetes/services/ServicesView/ServicesDatatable/ServicesDatatable.tsx index fe3389ba1..48c30a401 100644 --- a/app/react/kubernetes/services/ServicesView/ServicesDatatable/ServicesDatatable.tsx +++ b/app/react/kubernetes/services/ServicesView/ServicesDatatable/ServicesDatatable.tsx @@ -42,6 +42,7 @@ export function ServicesDatatable() { namespaceNames, { autoRefreshRate: tableState.autoRefreshRate * 1000, + lookupApplications: true, } ); diff --git a/app/react/kubernetes/services/service.ts b/app/react/kubernetes/services/service.ts index 0239780df..52bdec91d 100644 --- a/app/react/kubernetes/services/service.ts +++ b/app/react/kubernetes/services/service.ts @@ -22,7 +22,7 @@ export const queryKeys = { export function useServicesForCluster( environmentId: EnvironmentId, namespaceNames?: string[], - options?: { autoRefreshRate?: number } + options?: { autoRefreshRate?: number; lookupApplications?: boolean } ) { return useQuery( queryKeys.clusterServices(environmentId), @@ -32,7 +32,7 @@ export function useServicesForCluster( } const settledServicesPromise = await Promise.allSettled( namespaceNames.map((namespace) => - getServices(environmentId, namespace, true) + getServices(environmentId, namespace, options?.lookupApplications) ) ); return compact( @@ -87,14 +87,14 @@ export function useMutationDeleteServices(environmentId: EnvironmentId) { export async function getServices( environmentId: EnvironmentId, namespace: string, - lookupApps: boolean + lookupApplications?: boolean ) { try { const { data: services } = await axios.get>( `kubernetes/${environmentId}/namespaces/${namespace}/services`, { params: { - lookupapplications: lookupApps, + lookupapplications: lookupApplications, }, } );