From bbe7320c7b2930de2ce47c676f7f345188b05dfa Mon Sep 17 00:00:00 2001 From: Mihaela Balutoiu Date: Tue, 10 Mar 2026 12:21:52 +0200 Subject: [PATCH 1/2] Add VM inventory CSV export data layer Signed-off-by: Mihaela Balutoiu --- config.ts | 14 ++++++++++---- src/constants.ts | 1 + src/sources/EndpointSource.ts | 8 ++++++++ src/stores/EndpointStore.ts | 11 +++++++++++ 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/config.ts b/config.ts index 70303868..b12d8f07 100644 --- a/config.ts +++ b/config.ts @@ -134,13 +134,13 @@ const conf: Config = { { name: "olvm", types: ["destination"], - requiredFields: ["cluster"] + requiredFields: ["cluster"], }, { name: "rhev", types: ["destination"], - requiredFields: ["cluster"] - } + requiredFields: ["cluster"], + }, ], /* @@ -200,7 +200,13 @@ const conf: Config = { hiddenUsers: ["barbican", "coriolis"], // The list of user roles to hide in the UI - hiddenUserRoles: ["audit", "creator", "observer", "service", "key-manager:service-admin"], + hiddenUserRoles: [ + "audit", + "creator", + "observer", + "service", + "key-manager:service-admin", + ], // By default, if a field name contains `password` in it (ex.: `user_password`), // it will be rendered as a password input diff --git a/src/constants.ts b/src/constants.ts index e75d1b66..e1de3b97 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -49,6 +49,7 @@ export const providerTypes = { TARGET_UPDATE: 262144, SOURCE_MINION_POOL: 524288, DESTINATION_MINION_POOL: 1048576, + INVENTORY_EXPORT: 2097152, }; export const loginButtons = [ diff --git a/src/sources/EndpointSource.ts b/src/sources/EndpointSource.ts index 57b3d448..8a7d7ad1 100644 --- a/src/sources/EndpointSource.ts +++ b/src/sources/EndpointSource.ts @@ -307,6 +307,14 @@ class EndpointSource { return SchemaParser.parseConnectionResponse(response.data.endpoint); } + async exportInventoryCsv(endpointId: string): Promise { + const response = await Api.send({ + url: `${configLoader.config.servicesUrls.coriolis}/${Api.projectId}/endpoints/${endpointId}/inventory`, + responseType: "text", + }); + return response.data as string; + } + async loadStorage( endpointId: string, data: any, diff --git a/src/stores/EndpointStore.ts b/src/stores/EndpointStore.ts index 5b04f465..a60443bf 100644 --- a/src/stores/EndpointStore.ts +++ b/src/stores/EndpointStore.ts @@ -198,6 +198,17 @@ class EndpointStore { } } + @action async exportInventoryCsv(endpoint: Endpoint): Promise { + const csvContent = await EndpointSource.exportInventoryCsv(endpoint.id); + const now = new Date(); + const pad = (n: number) => String(n).padStart(2, "0"); + const d = + `${now.getFullYear()}-${pad(now.getMonth() + 1)}` + + `-${pad(now.getDate())}_${pad(now.getHours())}` + + `-${pad(now.getMinutes())}`; + DomUtils.download(csvContent, `vm_inventory_${endpoint.name}_${d}.csv`); + } + @action async exportToJson(endpoint: Endpoint): Promise { const connectionInfo = await EndpointSource.getConnectionInfo(endpoint); const newEndpoint = JSON.parse(JSON.stringify(endpoint)); From c56d73551d8411ac3f4b09583242a75bf2918947 Mon Sep 17 00:00:00 2001 From: Mihaela Balutoiu Date: Tue, 10 Mar 2026 11:31:35 +0000 Subject: [PATCH 2/2] Wire VM inventory CSV export into endpoint details UI Signed-off-by: Mihaela Balutoiu --- .../EndpointDetailsContent.tsx | 7 ++++ .../EndpointDetailsPage.tsx | 35 +++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/src/components/modules/EndpointModule/EndpointDetailsContent/EndpointDetailsContent.tsx b/src/components/modules/EndpointModule/EndpointDetailsContent/EndpointDetailsContent.tsx index aa4b6249..fbb7d025 100644 --- a/src/components/modules/EndpointModule/EndpointDetailsContent/EndpointDetailsContent.tsx +++ b/src/components/modules/EndpointModule/EndpointDetailsContent/EndpointDetailsContent.tsx @@ -99,8 +99,10 @@ type Props = { loading: boolean; transfers: TransferItem[]; connectionInfoSchema: FieldType[]; + supportsInventoryExport?: boolean; onDeleteClick: () => void; onValidateClick: () => void; + onExportInventoryCsvClick?: () => void; }; @observer class EndpointDetailsContent extends React.Component { @@ -197,6 +199,11 @@ class EndpointDetailsContent extends React.Component { Validate Endpoint + {this.props.supportsInventoryExport && ( + + )}