mirror of https://github.com/portainer/portainer
fix(services): speed up service count on the kubernetes dashboard [EE-6967] (#11524)
parent
13cee9975c
commit
399ddaea3b
|
@ -34,7 +34,8 @@ export function DashboardView() {
|
||||||
);
|
);
|
||||||
const { data: services, ...servicesQuery } = useServicesForCluster(
|
const { data: services, ...servicesQuery } = useServicesForCluster(
|
||||||
environmentId,
|
environmentId,
|
||||||
namespaceNames
|
namespaceNames,
|
||||||
|
{ lookupApplications: false }
|
||||||
);
|
);
|
||||||
const { data: ingresses, ...ingressesQuery } = useIngresses(
|
const { data: ingresses, ...ingressesQuery } = useIngresses(
|
||||||
environmentId,
|
environmentId,
|
||||||
|
|
|
@ -42,6 +42,7 @@ export function ServicesDatatable() {
|
||||||
namespaceNames,
|
namespaceNames,
|
||||||
{
|
{
|
||||||
autoRefreshRate: tableState.autoRefreshRate * 1000,
|
autoRefreshRate: tableState.autoRefreshRate * 1000,
|
||||||
|
lookupApplications: true,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ export const queryKeys = {
|
||||||
export function useServicesForCluster(
|
export function useServicesForCluster(
|
||||||
environmentId: EnvironmentId,
|
environmentId: EnvironmentId,
|
||||||
namespaceNames?: string[],
|
namespaceNames?: string[],
|
||||||
options?: { autoRefreshRate?: number }
|
options?: { autoRefreshRate?: number; lookupApplications?: boolean }
|
||||||
) {
|
) {
|
||||||
return useQuery(
|
return useQuery(
|
||||||
queryKeys.clusterServices(environmentId),
|
queryKeys.clusterServices(environmentId),
|
||||||
|
@ -32,7 +32,7 @@ export function useServicesForCluster(
|
||||||
}
|
}
|
||||||
const settledServicesPromise = await Promise.allSettled(
|
const settledServicesPromise = await Promise.allSettled(
|
||||||
namespaceNames.map((namespace) =>
|
namespaceNames.map((namespace) =>
|
||||||
getServices(environmentId, namespace, true)
|
getServices(environmentId, namespace, options?.lookupApplications)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
return compact(
|
return compact(
|
||||||
|
@ -87,14 +87,14 @@ export function useMutationDeleteServices(environmentId: EnvironmentId) {
|
||||||
export async function getServices(
|
export async function getServices(
|
||||||
environmentId: EnvironmentId,
|
environmentId: EnvironmentId,
|
||||||
namespace: string,
|
namespace: string,
|
||||||
lookupApps: boolean
|
lookupApplications?: boolean
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
const { data: services } = await axios.get<Array<Service>>(
|
const { data: services } = await axios.get<Array<Service>>(
|
||||||
`kubernetes/${environmentId}/namespaces/${namespace}/services`,
|
`kubernetes/${environmentId}/namespaces/${namespace}/services`,
|
||||||
{
|
{
|
||||||
params: {
|
params: {
|
||||||
lookupapplications: lookupApps,
|
lookupapplications: lookupApplications,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue