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

refactor(containers): migrate create view to react [EE-2307] (#9175)

This commit is contained in:
Chaim Lev-Ari 2023-10-19 13:45:50 +02:00 committed by GitHub
parent bc0050a7b4
commit d970f0e2bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
71 changed files with 2612 additions and 1399 deletions

View file

@ -9,7 +9,7 @@ import { withGlobalError } from '@/react-tools/react-query';
import { urlBuilder } from '../containers.service';
import { DockerContainerResponse } from '../types/response';
import { parseListViewModel } from '../utils';
import { toListViewModel } from '../utils';
import { DockerContainer } from '../types';
import { Filters } from './types';
@ -26,10 +26,12 @@ export function useContainers<T = DockerContainer[]>(
{
autoRefreshRate,
select,
enabled,
...params
}: UseContainers & {
autoRefreshRate?: number;
select?: (data: DockerContainer[]) => T;
enabled?: boolean;
} = {}
) {
return useQuery(
@ -41,6 +43,7 @@ export function useContainers<T = DockerContainer[]>(
return autoRefreshRate ?? false;
},
select,
enabled,
}
);
}
@ -61,7 +64,7 @@ export async function getContainers(
: undefined,
}
);
return data.map((c) => parseListViewModel(c));
return data.map((c) => toListViewModel(c));
} catch (error) {
throw parseAxiosError(error as Error, 'Unable to retrieve containers');
}