1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-25 16:29:44 +02:00

fix(services): speed up service count on the kubernetes dashboard [EE-6967] (#11525)
Some checks are pending
ci / build_images (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
ci / build_images (map[arch:arm platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:arm64 platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:ppc64le platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:s390x platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:linux version:]) (push) Waiting to run
ci / build_manifests (push) Blocked by required conditions
/ triage (push) Waiting to run
Lint / Run linters (push) Waiting to run
Test / test-client (push) Waiting to run
Test / test-server (map[arch:amd64 platform:linux]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
Test / test-server (map[arch:arm64 platform:linux]) (push) Waiting to run

This commit is contained in:
Matt Hook 2024-04-09 15:50:26 +12:00 committed by GitHub
parent 8616f9b742
commit 2be897c4a1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 5 deletions

View file

@ -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,

View file

@ -42,6 +42,7 @@ export function ServicesDatatable() {
namespaceNames, namespaceNames,
{ {
autoRefreshRate: tableState.autoRefreshRate * 1000, autoRefreshRate: tableState.autoRefreshRate * 1000,
lookupApplications: true,
} }
); );

View file

@ -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,
}, },
} }
); );