1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-22 14:59:41 +02:00

feat(docker/containers): migrate network tab to react [EE-5210] (#10344)

This commit is contained in:
Chaim Lev-Ari 2023-09-21 14:02:02 +03:00 committed by GitHub
parent e92f067e42
commit 2b47b84e5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 413 additions and 246 deletions

View file

@ -10,6 +10,7 @@ import { withGlobalError } from '@/react-tools/react-query';
import { urlBuilder } from '../containers.service';
import { DockerContainerResponse } from '../types/response';
import { parseListViewModel } from '../utils';
import { DockerContainer } from '../types';
import { Filters } from './types';
import { queryKeys } from './query-keys';
@ -20,14 +21,15 @@ interface UseContainers {
nodeName?: string;
}
export function useContainers(
export function useContainers<T = DockerContainer[]>(
environmentId: EnvironmentId,
{
autoRefreshRate,
select,
...params
}: UseContainers & {
autoRefreshRate?: number;
select?: (data: DockerContainer[]) => T;
} = {}
) {
return useQuery(
@ -38,11 +40,12 @@ export function useContainers(
refetchInterval() {
return autoRefreshRate ?? false;
},
select,
}
);
}
async function getContainers(
export async function getContainers(
environmentId: EnvironmentId,
{ all = true, filters, nodeName }: UseContainers = {}
) {