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:
parent
4fee359247
commit
82e9e2a895
80 changed files with 1099 additions and 1892 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue