mirror of https://github.com/portainer/portainer
fix(services): speed up service count on the kubernetes dashboard [EE-6967] (#11526)
parent
c95ffa9e2d
commit
8913e75484
|
@ -34,7 +34,8 @@ export function DashboardView() {
|
|||
);
|
||||
const { data: services, ...servicesQuery } = useServicesForCluster(
|
||||
environmentId,
|
||||
namespaceNames
|
||||
namespaceNames,
|
||||
{ lookupApplications: false }
|
||||
);
|
||||
const { data: ingresses, ...ingressesQuery } = useIngresses(
|
||||
environmentId,
|
||||
|
|
|
@ -41,6 +41,7 @@ export function ServicesDatatable() {
|
|||
namespaceNames,
|
||||
{
|
||||
autoRefreshRate: tableState.autoRefreshRate * 1000,
|
||||
lookupApplications: true,
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -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<Array<Service>>(
|
||||
`kubernetes/${environmentId}/namespaces/${namespace}/services`,
|
||||
{
|
||||
params: {
|
||||
lookupapplications: lookupApps,
|
||||
lookupapplications: lookupApplications,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue