1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-05 05:45:22 +02:00

refactor(edge/updates): sync changes from EE [EE-4288] (#7726)

This commit is contained in:
Chaim Lev-Ari 2022-12-01 08:40:52 +02:00 committed by GitHub
parent 4fee359247
commit 82e9e2a895
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
80 changed files with 1099 additions and 1892 deletions

View file

@ -28,6 +28,7 @@ export interface EnvironmentsQueryParams {
provisioned?: boolean;
name?: string;
agentVersions?: string[];
updateInformation?: boolean;
}
export interface GetEnvironmentsOptions {
@ -46,7 +47,12 @@ export async function getEnvironments(
}: GetEnvironmentsOptions = { query: {} }
) {
if (query.tagIds && query.tagIds.length === 0) {
return { totalCount: 0, value: <Environment[]>[] };
return {
totalCount: 0,
value: <Environment[]>[],
totalAvailable: 0,
updateAvailable: false,
};
}
const url = buildUrl();
@ -63,11 +69,13 @@ export async function getEnvironments(
const response = await axios.get<Environment[]>(url, { params });
const totalCount = response.headers['x-total-count'];
const totalAvailable = response.headers['x-total-available'];
const updateAvailable = response.headers['x-update-available'] === 'true';
return {
totalCount: parseInt(totalCount, 10),
value: response.data,
totalAvailable: parseInt(totalAvailable, 10),
updateAvailable,
};
} catch (e) {
throw parseAxiosError(e as Error);