@openshift-migration-advisor/shared-components 0.25.0 → 0.27.0-6438cd962b5f

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/README.md +25 -0
  2. package/dist/report/ChartDownloadButton.d.ts +11 -0
  3. package/dist/report/ChartDownloadButton.d.ts.map +1 -0
  4. package/dist/report/ChartDownloadButton.js +24 -0
  5. package/dist/report/ChartExportProvider.d.ts +23 -0
  6. package/dist/report/ChartExportProvider.d.ts.map +1 -0
  7. package/dist/report/ChartExportProvider.js +222 -0
  8. package/dist/report/ChartExportSurface.d.ts +12 -0
  9. package/dist/report/ChartExportSurface.d.ts.map +1 -0
  10. package/dist/report/ChartExportSurface.js +32 -0
  11. package/dist/report/ErrorTable.d.ts +18 -0
  12. package/dist/report/ErrorTable.d.ts.map +1 -0
  13. package/dist/report/ErrorTable.js +20 -0
  14. package/dist/report/HostPowerStates.d.ts +0 -1
  15. package/dist/report/HostPowerStates.d.ts.map +1 -1
  16. package/dist/report/HostPowerStates.js +2 -2
  17. package/dist/report/HostsOverview.d.ts +13 -0
  18. package/dist/report/HostsOverview.d.ts.map +1 -0
  19. package/dist/report/HostsOverview.js +84 -0
  20. package/dist/report/InfrastructureSummary.d.ts.map +1 -1
  21. package/dist/report/InfrastructureSummary.js +6 -2
  22. package/dist/report/NetworkOverview.d.ts +31 -0
  23. package/dist/report/NetworkOverview.d.ts.map +1 -0
  24. package/dist/report/NetworkOverview.js +201 -0
  25. package/dist/report/OSDistribution.d.ts +0 -2
  26. package/dist/report/OSDistribution.d.ts.map +1 -1
  27. package/dist/report/OSDistribution.js +8 -5
  28. package/dist/report/OsUpgradeRecommendationPopover.d.ts +0 -1
  29. package/dist/report/OsUpgradeRecommendationPopover.d.ts.map +1 -1
  30. package/dist/report/OsUpgradeRecommendationPopover.js +4 -3
  31. package/dist/report/PowerStateCard.d.ts +0 -1
  32. package/dist/report/PowerStateCard.d.ts.map +1 -1
  33. package/dist/report/PowerStateCard.js +4 -2
  34. package/dist/report/ReportExportMenu.d.ts +19 -0
  35. package/dist/report/ReportExportMenu.d.ts.map +1 -0
  36. package/dist/report/ReportExportMenu.js +31 -0
  37. package/dist/report/ReportTable.d.ts +14 -0
  38. package/dist/report/ReportTable.d.ts.map +1 -0
  39. package/dist/report/ReportTable.js +23 -0
  40. package/dist/report/SupportTierBadge.d.ts +0 -1
  41. package/dist/report/SupportTierBadge.d.ts.map +1 -1
  42. package/dist/report/SupportTierBadge.js +1 -21
  43. package/dist/report/VCenterClusterDetails.d.ts +0 -1
  44. package/dist/report/VCenterClusterDetails.d.ts.map +1 -1
  45. package/dist/report/VCenterClusterDetails.js +9 -4
  46. package/dist/report/VmPowerStates.d.ts +0 -1
  47. package/dist/report/VmPowerStates.d.ts.map +1 -1
  48. package/dist/report/VmPowerStates.js +2 -2
  49. package/dist/report/WarningsTable.d.ts +9 -0
  50. package/dist/report/WarningsTable.d.ts.map +1 -0
  51. package/dist/report/WarningsTable.js +20 -0
  52. package/dist/report/captureChartElement.d.ts +8 -0
  53. package/dist/report/captureChartElement.d.ts.map +1 -0
  54. package/dist/report/captureChartElement.js +284 -0
  55. package/dist/report/chartExport.d.ts +73 -0
  56. package/dist/report/chartExport.d.ts.map +1 -0
  57. package/dist/report/chartExport.js +162 -0
  58. package/dist/report/chartExportContext.d.ts +32 -0
  59. package/dist/report/chartExportContext.d.ts.map +1 -0
  60. package/dist/report/chartExportContext.js +36 -0
  61. package/dist/report/chartExportFilenames.d.ts +4 -0
  62. package/dist/report/chartExportFilenames.d.ts.map +1 -0
  63. package/dist/report/chartExportFilenames.js +16 -0
  64. package/dist/report/constants.d.ts +2 -0
  65. package/dist/report/constants.d.ts.map +1 -1
  66. package/dist/report/constants.js +2 -0
  67. package/dist/report/dashboardStyles.d.ts +0 -4
  68. package/dist/report/dashboardStyles.d.ts.map +1 -1
  69. package/dist/report/dashboardStyles.js +0 -19
  70. package/dist/report/htmlExport.d.ts +9 -0
  71. package/dist/report/htmlExport.d.ts.map +1 -0
  72. package/dist/report/htmlExport.js +65 -0
  73. package/dist/report/index.d.ts +18 -0
  74. package/dist/report/index.d.ts.map +1 -1
  75. package/dist/report/index.js +18 -0
  76. package/dist/report/pdfExport.d.ts +3 -0
  77. package/dist/report/pdfExport.d.ts.map +1 -0
  78. package/dist/report/pdfExport.js +131 -0
  79. package/dist/report/pdfPage.d.ts +15 -0
  80. package/dist/report/pdfPage.d.ts.map +1 -0
  81. package/dist/report/pdfPage.js +44 -0
  82. package/dist/report/reportExportOptions.d.ts +17 -0
  83. package/dist/report/reportExportOptions.d.ts.map +1 -0
  84. package/dist/report/reportExportOptions.js +31 -0
  85. package/dist/report/zipChartPngs.d.ts +3 -0
  86. package/dist/report/zipChartPngs.d.ts.map +1 -0
  87. package/dist/report/zipChartPngs.js +8 -0
  88. package/package.json +7 -2
  89. package/src/report/ChartDownloadButton.tsx +59 -0
  90. package/src/report/ChartExportProvider.tsx +392 -0
  91. package/src/report/ChartExportSurface.tsx +60 -0
  92. package/src/report/ErrorTable.tsx +85 -0
  93. package/src/report/HostPowerStates.tsx +0 -3
  94. package/src/report/HostsOverview.tsx +185 -0
  95. package/src/report/InfrastructureSummary.tsx +48 -31
  96. package/src/report/NetworkOverview.tsx +405 -0
  97. package/src/report/OSDistribution.tsx +46 -42
  98. package/src/report/OsUpgradeRecommendationPopover.tsx +3 -4
  99. package/src/report/PowerStateCard.tsx +49 -36
  100. package/src/report/ReportExportMenu.tsx +119 -0
  101. package/src/report/ReportTable.tsx +81 -0
  102. package/src/report/SupportTierBadge.tsx +12 -40
  103. package/src/report/VCenterClusterDetails.tsx +38 -16
  104. package/src/report/VmPowerStates.tsx +0 -3
  105. package/src/report/WarningsTable.tsx +75 -0
  106. package/src/report/__tests__/ChartExportProvider.test.tsx +542 -0
  107. package/src/report/__tests__/HostsOverview.test.tsx +145 -0
  108. package/src/report/__tests__/InfrastructureSummary.test.tsx +0 -22
  109. package/src/report/__tests__/NetworkOverview.test.tsx +269 -0
  110. package/src/report/__tests__/OSDistribution.test.tsx +10 -11
  111. package/src/report/__tests__/captureChartElement.test.ts +132 -0
  112. package/src/report/__tests__/chartExportPackagers.test.ts +282 -0
  113. package/src/report/captureChartElement.ts +368 -0
  114. package/src/report/chartExport.ts +255 -0
  115. package/src/report/chartExportContext.tsx +92 -0
  116. package/src/report/chartExportFilenames.ts +21 -0
  117. package/src/report/constants.ts +2 -0
  118. package/src/report/dashboardStyles.ts +0 -23
  119. package/src/report/htmlExport.ts +83 -0
  120. package/src/report/index.ts +98 -0
  121. package/src/report/pdfExport.ts +233 -0
  122. package/src/report/pdfPage.ts +83 -0
  123. package/src/report/reportExportOptions.ts +53 -0
  124. package/src/report/zipChartPngs.ts +10 -0
package/README.md CHANGED
@@ -7,6 +7,7 @@ Includes:
7
7
  - PatternFly form field wrappers (`react-hook-form`)
8
8
  - Guest OS support-tier helpers and badges
9
9
  - Report chart primitives (`MigrationDonutChart`)
10
+ - Chart export (`ChartExportProvider`, `ChartExportSurface`, PDF / PNG / HTML)
10
11
  - Operating Systems distribution card
11
12
  - Infrastructure summary, vCenter cluster details, and host/VM power-state cards
12
13
 
@@ -25,17 +26,41 @@ npm install @openshift-migration-advisor/shared-components
25
26
  ```tsx
26
27
  import {
27
28
  buildInfrastructureSummary,
29
+ ChartExportProvider,
28
30
  HostPowerStates,
29
31
  InfrastructureSummary,
30
32
  MigrationDonutChart,
31
33
  OSDistribution,
34
+ ReportExportMenu,
32
35
  SupportTierBadge,
33
36
  TextInputFormGroup,
37
+ useChartExport,
34
38
  VCenterClusterDetails,
35
39
  VmPowerStates,
36
40
  } from "@openshift-migration-advisor/shared-components";
41
+
42
+ <ChartExportProvider>
43
+ <Dashboard />
44
+ </ChartExportProvider>
45
+ ```
46
+
47
+ `ChartExportProvider` lazy-loads capture, ZIP, PDF, and HTML. Wrap the chart visual (not the Card chrome) in `ChartExportSurface`. All formats snapshot those same nodes, encode one chart at a time, and drop the canvas. There is no second print tree and no `isExportMode` render:
48
+
49
+ ```tsx
50
+ import { ChartExportSurface } from "@openshift-migration-advisor/shared-components";
51
+
52
+ <Card>
53
+ <CardTitle>CPU and memory</CardTitle>
54
+ <CardBody>
55
+ <ChartExportSurface id="cpu-memory" title="CPU and memory">
56
+ <MigrationDonutChart {...chartProps} />
57
+ </ChartExportSurface>
58
+ </CardBody>
59
+ </Card>
37
60
  ```
38
61
 
62
+ `ReportExportMenu` accepts a fully custom `options` list. `standardReportExportOptions()` builds the PDF / HTML / PNG entries; omit a handler to hide that format.
63
+
39
64
  Components are SDK-agnostic: pass already-shaped props (for example `OSDistributionEntry` maps). Map `agent-sdk` / `planner-sdk` models at the app boundary.
40
65
 
41
66
  ## Development
@@ -0,0 +1,11 @@
1
+ import type { FC, ReactNode } from "react";
2
+ export declare const ChartDownloadButton: FC<{
3
+ chartId: string;
4
+ title?: string;
5
+ }>;
6
+ export declare const ChartHeaderActions: FC<{
7
+ chartId: string;
8
+ title?: string;
9
+ children?: ReactNode;
10
+ }>;
11
+ //# sourceMappingURL=ChartDownloadButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChartDownloadButton.d.ts","sourceRoot":"","sources":["../../src/report/ChartDownloadButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAI3C,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAoBA,CAAC;AAIF,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAmBA,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button, Flex, FlexItem } from "@patternfly/react-core";
3
+ import { DownloadIcon } from "@patternfly/react-icons";
4
+ import { chartExportHideProps } from "./chartExport.js";
5
+ import { useChartExport } from "./chartExportContext.js";
6
+ export const ChartDownloadButton = ({ chartId, title }) => {
7
+ const exportApi = useChartExport();
8
+ if (!exportApi) {
9
+ return null;
10
+ }
11
+ const label = title ? `Download ${title} as PNG` : "Download chart as PNG";
12
+ return (_jsx(Button, { variant: "plain", icon: _jsx(DownloadIcon, {}), "aria-label": label, isLoading: exportApi.downloadingChartId === chartId, isDisabled: exportApi.isBusy, onClick: () => {
13
+ void exportApi.downloadChart(chartId);
14
+ } }));
15
+ };
16
+ ChartDownloadButton.displayName = "ChartDownloadButton";
17
+ export const ChartHeaderActions = ({ chartId, title, children }) => {
18
+ const exportApi = useChartExport();
19
+ if (!exportApi && !children) {
20
+ return null;
21
+ }
22
+ return (_jsx(FlexItem, { ...chartExportHideProps, children: _jsxs(Flex, { alignItems: { default: "alignItemsCenter" }, spaceItems: { default: "spaceItemsSm" }, children: [children, exportApi ? (_jsx(ChartDownloadButton, { chartId: chartId, title: title })) : null] }) }));
23
+ };
24
+ ChartHeaderActions.displayName = "ChartHeaderActions";
@@ -0,0 +1,23 @@
1
+ import { type FC, type ReactNode } from "react";
2
+ import { type ChartCaptureSource, type ChartExportFile, type PdfTextPage } from "./chartExport.js";
3
+ export type CaptureChartElement = (element: HTMLElement) => Promise<HTMLCanvasElement>;
4
+ export type ZipChartFiles = (files: ChartExportFile[]) => Promise<Blob>;
5
+ export type EncodeChartPng = (canvas: HTMLCanvasElement) => Promise<Blob>;
6
+ export type BuildChartDocument = (charts: ChartCaptureSource[], documentTitle: string) => Promise<Blob>;
7
+ export type BuildPdfDocument = (charts: ChartCaptureSource[], documentTitle: string, extraPages?: PdfTextPage[]) => Promise<Blob>;
8
+ export type { ChartExportApi, ChartExportFormat, } from "./chartExportContext.js";
9
+ export { useChartExport, useRegisterChart } from "./chartExportContext.js";
10
+ export interface ChartExportProviderProps {
11
+ children: ReactNode;
12
+ capture?: CaptureChartElement;
13
+ zipFiles?: ZipChartFiles;
14
+ encodePng?: EncodeChartPng;
15
+ buildPdf?: BuildPdfDocument;
16
+ buildHtml?: BuildChartDocument;
17
+ downloadFile?: (blob: Blob, filename: string) => void;
18
+ getZipFilename?: () => string;
19
+ getPdfFilename?: () => string;
20
+ getHtmlFilename?: () => string;
21
+ }
22
+ export declare const ChartExportProvider: FC<ChartExportProviderProps>;
23
+ //# sourceMappingURL=ChartExportProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChartExportProvider.d.ts","sourceRoot":"","sources":["../../src/report/ChartExportProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EAAE,EACP,KAAK,SAAS,EAKf,MAAM,OAAO,CAAC;AACf,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,eAAe,EAGpB,KAAK,WAAW,EAMjB,MAAM,kBAAkB,CAAC;AAU1B,MAAM,MAAM,mBAAmB,GAAG,CAChC,OAAO,EAAE,WAAW,KACjB,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAChC,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,eAAe,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AACxE,MAAM,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,iBAAiB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAC1E,MAAM,MAAM,kBAAkB,GAAG,CAC/B,MAAM,EAAE,kBAAkB,EAAE,EAC5B,aAAa,EAAE,MAAM,KAClB,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnB,MAAM,MAAM,gBAAgB,GAAG,CAC7B,MAAM,EAAE,kBAAkB,EAAE,EAC5B,aAAa,EAAE,MAAM,EACrB,UAAU,CAAC,EAAE,WAAW,EAAE,KACvB,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnB,YAAY,EACV,cAAc,EACd,iBAAiB,GAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3E,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,SAAS,CAAC,EAAE,kBAAkB,CAAC;IAC/B,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACtD,cAAc,CAAC,EAAE,MAAM,MAAM,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,MAAM,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,MAAM,CAAC;CAChC;AAsED,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC,wBAAwB,CAiQ5D,CAAC"}
@@ -0,0 +1,222 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useCallback, useMemo, useRef, useState, } from "react";
3
+ import { canvasToBlob, downloadBlob, releaseCanvas, restoreChartExportViews, sortRegisteredChartsByDocumentOrder, toBulkChartCaptureSources, } from "./chartExport.js";
4
+ import { ChartExportApiContext, ChartExportRegistryContext, } from "./chartExportContext.js";
5
+ import { getChartExportFilename } from "./chartExportFilenames.js";
6
+ export { useChartExport, useRegisterChart } from "./chartExportContext.js";
7
+ const EXPORT_LOADING_LABELS = {
8
+ pdf: "Generating PDF...",
9
+ png: "Generating PNG...",
10
+ html: "Generating HTML...",
11
+ };
12
+ const defaultZipFilename = () => getChartExportFilename("zip");
13
+ const defaultPdfFilename = () => getChartExportFilename("pdf");
14
+ const defaultHtmlFilename = () => getChartExportFilename("html");
15
+ async function resolveCapture(override) {
16
+ if (override) {
17
+ return override;
18
+ }
19
+ const { captureChartElement } = await import("./captureChartElement.js");
20
+ return captureChartElement;
21
+ }
22
+ async function resolvePrepareElement(overrideCapture) {
23
+ if (overrideCapture) {
24
+ return undefined;
25
+ }
26
+ const { revealHiddenChartAncestors } = await import("./captureChartElement.js");
27
+ return revealHiddenChartAncestors;
28
+ }
29
+ async function resolveZip(override) {
30
+ if (override) {
31
+ return override;
32
+ }
33
+ const { zipChartPngs } = await import("./zipChartPngs.js");
34
+ return zipChartPngs;
35
+ }
36
+ async function resolvePdf(override) {
37
+ if (override) {
38
+ return override;
39
+ }
40
+ const { buildPdfFromCharts } = await import("./pdfExport.js");
41
+ return buildPdfFromCharts;
42
+ }
43
+ async function resolveHtml(override) {
44
+ if (override) {
45
+ return override;
46
+ }
47
+ const { buildHtmlFromCharts } = await import("./htmlExport.js");
48
+ return buildHtmlFromCharts;
49
+ }
50
+ function toCaptureSources(charts, capture, prepareElement) {
51
+ return toBulkChartCaptureSources(charts, capture, prepareElement);
52
+ }
53
+ export const ChartExportProvider = ({ children, capture, zipFiles, encodePng = canvasToBlob, buildPdf, buildHtml, downloadFile = downloadBlob, getZipFilename = defaultZipFilename, getPdfFilename = defaultPdfFilename, getHtmlFilename = defaultHtmlFilename, }) => {
54
+ const chartsRef = useRef(new Map());
55
+ const isBusyRef = useRef(false);
56
+ const [downloadingChartId, setDownloadingChartId] = useState(null);
57
+ const [exportingFormat, setExportingFormat] = useState(null);
58
+ const [exportError, setExportError] = useState(null);
59
+ const registry = useMemo(() => ({
60
+ register(chart) {
61
+ const existing = chartsRef.current.get(chart.id);
62
+ if (existing &&
63
+ existing.element !== chart.element &&
64
+ existing.element.isConnected) {
65
+ console.warn(`Duplicate chart export id "${chart.id}". The previous chart will not be exported.`);
66
+ }
67
+ chartsRef.current.set(chart.id, chart);
68
+ return () => {
69
+ const current = chartsRef.current.get(chart.id);
70
+ if (current?.element === chart.element) {
71
+ chartsRef.current.delete(chart.id);
72
+ }
73
+ };
74
+ },
75
+ }), []);
76
+ const listCharts = useCallback(() => {
77
+ return sortRegisteredChartsByDocumentOrder(Array.from(chartsRef.current.values()).filter((chart) => chart.element.isConnected));
78
+ }, []);
79
+ const runCapture = useCallback(async (work, chartId, format) => {
80
+ if (isBusyRef.current) {
81
+ return;
82
+ }
83
+ isBusyRef.current = true;
84
+ setExportError(null);
85
+ if (chartId) {
86
+ setDownloadingChartId(chartId);
87
+ }
88
+ else {
89
+ setExportingFormat(format);
90
+ }
91
+ try {
92
+ await work();
93
+ }
94
+ catch (error) {
95
+ console.error(`Error exporting ${format}:`, error);
96
+ setExportError(`Failed to export ${format.toUpperCase()}. Please try again.`);
97
+ }
98
+ finally {
99
+ isBusyRef.current = false;
100
+ setDownloadingChartId(null);
101
+ setExportingFormat(null);
102
+ }
103
+ }, []);
104
+ const downloadChart = useCallback(async (id) => {
105
+ await runCapture(async () => {
106
+ const chart = chartsRef.current.get(id);
107
+ if (!chart?.element.isConnected) {
108
+ throw new Error("The chart is not ready to export yet.");
109
+ }
110
+ const captureFn = await resolveCapture(capture);
111
+ const canvas = await captureFn(chart.element);
112
+ try {
113
+ downloadFile(await encodePng(canvas), chart.filename);
114
+ }
115
+ finally {
116
+ releaseCanvas(canvas);
117
+ }
118
+ }, id, "png");
119
+ }, [capture, downloadFile, encodePng, runCapture]);
120
+ const downloadAll = useCallback(async () => {
121
+ await runCapture(async () => {
122
+ const charts = listCharts();
123
+ if (charts.length === 0) {
124
+ throw new Error("The report is not ready to export yet.");
125
+ }
126
+ const captureFn = await resolveCapture(capture);
127
+ const prepareElement = await resolvePrepareElement(capture);
128
+ const zipFn = await resolveZip(zipFiles);
129
+ const files = [];
130
+ const sources = toBulkChartCaptureSources(charts, captureFn, prepareElement);
131
+ try {
132
+ for (const [index, source] of sources.entries()) {
133
+ const canvas = await source.capture();
134
+ try {
135
+ files.push({
136
+ filename: `${String(index + 1).padStart(2, "0")}-${source.filename}`,
137
+ blob: await encodePng(canvas),
138
+ });
139
+ }
140
+ finally {
141
+ releaseCanvas(canvas);
142
+ }
143
+ }
144
+ }
145
+ finally {
146
+ await restoreChartExportViews(charts);
147
+ }
148
+ downloadFile(await zipFn(files), getZipFilename());
149
+ }, null, "png");
150
+ }, [
151
+ capture,
152
+ downloadFile,
153
+ encodePng,
154
+ getZipFilename,
155
+ listCharts,
156
+ runCapture,
157
+ zipFiles,
158
+ ]);
159
+ const downloadPdf = useCallback(async (documentTitle, extraPages) => {
160
+ await runCapture(async () => {
161
+ const charts = listCharts();
162
+ if (charts.length === 0 && (extraPages?.length ?? 0) === 0) {
163
+ throw new Error("The report is not ready to export yet.");
164
+ }
165
+ const captureFn = await resolveCapture(capture);
166
+ const prepareElement = await resolvePrepareElement(capture);
167
+ const build = await resolvePdf(buildPdf);
168
+ try {
169
+ downloadFile(await build(toCaptureSources(charts, captureFn, prepareElement), documentTitle, extraPages), getPdfFilename());
170
+ }
171
+ finally {
172
+ await restoreChartExportViews(charts);
173
+ }
174
+ }, null, "pdf");
175
+ }, [buildPdf, capture, downloadFile, getPdfFilename, listCharts, runCapture]);
176
+ const downloadHtml = useCallback(async (documentTitle) => {
177
+ await runCapture(async () => {
178
+ const charts = listCharts();
179
+ if (charts.length === 0) {
180
+ throw new Error("The report is not ready to export yet.");
181
+ }
182
+ const captureFn = await resolveCapture(capture);
183
+ const prepareElement = await resolvePrepareElement(capture);
184
+ const build = await resolveHtml(buildHtml);
185
+ try {
186
+ downloadFile(await build(toCaptureSources(charts, captureFn, prepareElement), documentTitle), getHtmlFilename());
187
+ }
188
+ finally {
189
+ await restoreChartExportViews(charts);
190
+ }
191
+ }, null, "html");
192
+ }, [buildHtml, capture, downloadFile, getHtmlFilename, listCharts, runCapture]);
193
+ const clearExportError = useCallback(() => {
194
+ setExportError(null);
195
+ }, []);
196
+ const api = useMemo(() => ({
197
+ downloadChart,
198
+ downloadAll,
199
+ downloadPdf,
200
+ downloadHtml,
201
+ downloadingChartId,
202
+ exportingFormat,
203
+ exportLoadingLabel: exportingFormat
204
+ ? EXPORT_LOADING_LABELS[exportingFormat]
205
+ : null,
206
+ isExportingAll: exportingFormat !== null,
207
+ isBusy: downloadingChartId !== null || exportingFormat !== null,
208
+ exportError,
209
+ clearExportError,
210
+ }), [
211
+ clearExportError,
212
+ downloadAll,
213
+ downloadChart,
214
+ downloadHtml,
215
+ downloadPdf,
216
+ downloadingChartId,
217
+ exportError,
218
+ exportingFormat,
219
+ ]);
220
+ return (_jsx(ChartExportRegistryContext.Provider, { value: registry, children: _jsx(ChartExportApiContext.Provider, { value: api, children: children }) }));
221
+ };
222
+ ChartExportProvider.displayName = "ChartExportProvider";
@@ -0,0 +1,12 @@
1
+ import { type FC, type ReactNode } from "react";
2
+ import { type ChartExportView } from "./chartExport.js";
3
+ export declare const ChartExportSurface: FC<{
4
+ id: string;
5
+ title: string;
6
+ filename?: string;
7
+ exportViews?: ChartExportView[];
8
+ activeExportViewId?: string;
9
+ onExportViewChange?: (viewId: string) => void;
10
+ children: ReactNode;
11
+ }>;
12
+ //# sourceMappingURL=ChartExportSurface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChartExportSurface.d.ts","sourceRoot":"","sources":["../../src/report/ChartExportSurface.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,SAAS,EAAuB,MAAM,OAAO,CAAC;AACrE,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,kBAAkB,CAAC;AAG1B,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,eAAe,EAAE,CAAC;IAChC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,QAAQ,EAAE,SAAS,CAAC;CACrB,CAyCA,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useCallback, useRef } from "react";
3
+ import { chartExportRootStyle, waitForChartExportPaint, } from "./chartExport.js";
4
+ import { useRegisterChart } from "./chartExportContext.js";
5
+ export const ChartExportSurface = ({ id, title, filename, exportViews, activeExportViewId, onExportViewChange, children, }) => {
6
+ const activeViewRef = useRef(activeExportViewId);
7
+ activeViewRef.current = activeExportViewId;
8
+ const onExportViewChangeRef = useRef(onExportViewChange);
9
+ onExportViewChangeRef.current = onExportViewChange;
10
+ const setExportView = useCallback(async (viewId) => {
11
+ const change = onExportViewChangeRef.current;
12
+ if (change && activeViewRef.current !== viewId) {
13
+ change(viewId);
14
+ await new Promise((resolve) => {
15
+ window.setTimeout(resolve, 0);
16
+ });
17
+ }
18
+ await waitForChartExportPaint();
19
+ }, []);
20
+ const ref = useRegisterChart({
21
+ id,
22
+ title,
23
+ filename,
24
+ exportViews,
25
+ activeExportViewId,
26
+ setExportView: exportViews && exportViews.length > 1 && onExportViewChange
27
+ ? setExportView
28
+ : undefined,
29
+ });
30
+ return (_jsx("div", { ref: ref, id: id, style: chartExportRootStyle, children: children }));
31
+ };
32
+ ChartExportSurface.displayName = "ChartExportSurface";
@@ -0,0 +1,18 @@
1
+ import type React from "react";
2
+ /**
3
+ * Minimal shape of a migration issue consumed by {@link ErrorTable}. Declared
4
+ * locally so this package does not depend on a specific SDK (`agent-sdk` or
5
+ * `planner-sdk`); callers pass the subset of `MigrationIssue` fields read here.
6
+ */
7
+ export interface MigrationIssueLike {
8
+ label: string;
9
+ assessment: string;
10
+ count: number;
11
+ }
12
+ export interface ErrorTableProps {
13
+ errors: MigrationIssueLike[];
14
+ /** Optional drill-down callback invoked with an issue's `label`. */
15
+ onConcernClick?: (concernLabel: string) => void;
16
+ }
17
+ export declare const ErrorTable: React.FC<ErrorTableProps>;
18
+ //# sourceMappingURL=ErrorTable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorTable.d.ts","sourceRoot":"","sources":["../../src/report/ErrorTable.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAC7B,oEAAoE;IACpE,cAAc,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;CACjD;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAgDhD,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Card, CardBody, CardTitle, Flex, FlexItem, Icon, } from "@patternfly/react-core";
3
+ import { ExclamationCircleIcon } from "@patternfly/react-icons";
4
+ import { CardEmptyState } from "./CardEmptyState.js";
5
+ import { ChartHeaderActions } from "./ChartDownloadButton.js";
6
+ import { ChartExportSurface } from "./ChartExportSurface.js";
7
+ import { REPORT_CARD_EMPTY_STATE_TITLES } from "./constants.js";
8
+ import { dashboardStyles } from "./dashboardStyles.js";
9
+ import { ReportTable } from "./ReportTable.js";
10
+ export const ErrorTable = ({ errors, onConcernClick, }) => {
11
+ const handleRowClick = (issue) => {
12
+ if (issue.label && onConcernClick) {
13
+ onConcernClick(issue.label);
14
+ }
15
+ };
16
+ const chartId = "errors-table";
17
+ const chartTitle = "Errors";
18
+ return (_jsx(ChartExportSurface, { id: chartId, title: chartTitle, children: _jsxs(Card, { className: dashboardStyles.card, children: [_jsx(CardTitle, { children: _jsxs(Flex, { justifyContent: { default: "justifyContentSpaceBetween" }, alignItems: { default: "alignItemsCenter" }, children: [_jsxs(FlexItem, { children: [_jsx(Icon, { status: "danger", children: _jsx(ExclamationCircleIcon, {}) }), " ", "Errors"] }), _jsx(ChartHeaderActions, { chartId: chartId, title: chartTitle })] }) }), _jsx(CardBody, { className: dashboardStyles.cardBodyScrollable, children: errors.length === 0 ? (_jsx(CardEmptyState, { title: REPORT_CARD_EMPTY_STATE_TITLES.errors })) : (_jsx("div", { children: _jsx(ReportTable, { data: errors, columns: ["Description", "Total VMs"], fields: ["assessment", "count"], onRowClick: onConcernClick ? handleRowClick : undefined, clickableFields: onConcernClick ? ["assessment"] : [] }) })) })] }) }));
19
+ };
20
+ ErrorTable.displayName = "ErrorTable";
@@ -2,7 +2,6 @@ import type { FC } from "react";
2
2
  import type { MigrationDonutChartLegendVariant } from "../charts/MigrationDonutChart.js";
3
3
  export interface HostPowerStatesProps {
4
4
  hostPowerStates?: Record<string, number>;
5
- isExportMode?: boolean;
6
5
  legendVariant?: MigrationDonutChartLegendVariant;
7
6
  }
8
7
  export declare const HostPowerStates: FC<HostPowerStatesProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"HostPowerStates.d.ts","sourceRoot":"","sources":["../../src/report/HostPowerStates.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,kCAAkC,CAAC;AAKzF,MAAM,WAAW,oBAAoB;IACnC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,gCAAgC,CAAC;CAClD;AAED,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CAwBpD,CAAC"}
1
+ {"version":3,"file":"HostPowerStates.d.ts","sourceRoot":"","sources":["../../src/report/HostPowerStates.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,kCAAkC,CAAC;AAKzF,MAAM,WAAW,oBAAoB;IACnC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,aAAa,CAAC,EAAE,gCAAgC,CAAC;CAClD;AAED,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CAsBpD,CAAC"}
@@ -4,8 +4,8 @@ import { useMemo } from "react";
4
4
  import { REPORT_CARD_EMPTY_STATE_TITLES } from "./constants.js";
5
5
  import { PowerStateCard } from "./PowerStateCard.js";
6
6
  import { buildHostPowerStateChart } from "./powerStates.js";
7
- export const HostPowerStates = ({ hostPowerStates, isExportMode = false, legendVariant, }) => {
7
+ export const HostPowerStates = ({ hostPowerStates, legendVariant, }) => {
8
8
  const chart = useMemo(() => buildHostPowerStateChart(hostPowerStates), [hostPowerStates]);
9
- return (_jsx(PowerStateCard, { id: "esxi-host-power-states", title: "ESXi host power states", icon: _jsx(ServerIcon, {}), emptyTitle: REPORT_CARD_EMPTY_STATE_TITLES.hostPowerStates, slices: chart.slices, legend: chart.legend, total: chart.total, subTitle: "Hosts", isExportMode: isExportMode, legendVariant: legendVariant }));
9
+ return (_jsx(PowerStateCard, { id: "esxi-host-power-states", title: "ESXi host power states", icon: _jsx(ServerIcon, {}), emptyTitle: REPORT_CARD_EMPTY_STATE_TITLES.hostPowerStates, slices: chart.slices, legend: chart.legend, total: chart.total, subTitle: "Hosts", legendVariant: legendVariant }));
10
10
  };
11
11
  HostPowerStates.displayName = "HostPowerStates";
@@ -0,0 +1,13 @@
1
+ import type { FC } from "react";
2
+ import { type MigrationDonutChartLegendVariant } from "../charts/MigrationDonutChart.js";
3
+ /** Smallest host shape this card reads. Apps pass SDK hosts structurally. */
4
+ export interface HostLike {
5
+ model?: string | number;
6
+ }
7
+ export interface HostsOverviewProps {
8
+ hosts?: HostLike[];
9
+ /** `"html"` in agent-ui; ui-app passes `"chart"`. */
10
+ legendVariant?: MigrationDonutChartLegendVariant;
11
+ }
12
+ export declare const HostsOverview: FC<HostsOverviewProps>;
13
+ //# sourceMappingURL=HostsOverview.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HostsOverview.d.ts","sourceRoot":"","sources":["../../src/report/HostsOverview.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAGL,KAAK,gCAAgC,EACtC,MAAM,kCAAkC,CAAC;AAO1C,6EAA6E;AAC7E,MAAM,WAAW,QAAQ;IACvB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IACnB,qDAAqD;IACrD,aAAa,CAAC,EAAE,gCAAgC,CAAC;CAClD;AAuFD,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAwDhD,CAAC"}
@@ -0,0 +1,84 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { css } from "@emotion/css";
3
+ import { Card, CardBody, CardTitle, Flex, FlexItem, } from "@patternfly/react-core";
4
+ import { ServerIcon } from "@patternfly/react-icons";
5
+ import { chart_color_blue_300, chart_color_green_300, chart_color_purple_100, chart_color_purple_300, chart_color_teal_200, chart_color_yellow_400, } from "@patternfly/react-tokens";
6
+ import { useMemo } from "react";
7
+ import { MigrationDonutChart, } from "../charts/MigrationDonutChart.js";
8
+ import { CardEmptyState } from "./CardEmptyState.js";
9
+ import { ChartHeaderActions } from "./ChartDownloadButton.js";
10
+ import { ChartExportSurface } from "./ChartExportSurface.js";
11
+ import { REPORT_CARD_EMPTY_STATE_TITLES } from "./constants.js";
12
+ import { dashboardStyles } from "./dashboardStyles.js";
13
+ const TOP_HOST_MODELS = 5;
14
+ const OTHER_MODELS_LABEL = "Other models";
15
+ const UNKNOWN_MODEL_LABEL = "Unknown model";
16
+ const CHART_ID = "hosts-overview";
17
+ const CHART_TITLE = "Host distribution by model";
18
+ /**
19
+ * Same categorical order as the ui-app host-model donut, mapped onto
20
+ * PatternFly `chart_color_*` tokens (nearest token where the old hex
21
+ * was not itself a token).
22
+ */
23
+ const HOST_MODEL_COLORS = [
24
+ chart_color_blue_300.value,
25
+ chart_color_purple_300.value,
26
+ chart_color_purple_100.value,
27
+ chart_color_teal_200.value,
28
+ chart_color_yellow_400.value,
29
+ chart_color_green_300.value,
30
+ ];
31
+ const cardSubtitle = css `
32
+ color: var(--pf-t--global--text--color--subtle);
33
+ font-size: 0.85rem;
34
+ `;
35
+ const hostModelLabel = (model) => {
36
+ const raw = typeof model === "string"
37
+ ? model
38
+ : typeof model === "number"
39
+ ? String(model)
40
+ : "";
41
+ const trimmed = raw.trim();
42
+ return trimmed !== "" ? trimmed : UNKNOWN_MODEL_LABEL;
43
+ };
44
+ const buildHostModelDonut = (hosts) => {
45
+ const counts = new Map();
46
+ for (const host of hosts) {
47
+ const label = hostModelLabel(host?.model);
48
+ counts.set(label, (counts.get(label) ?? 0) + 1);
49
+ }
50
+ const entries = [...counts.entries()]
51
+ .map(([model, count]) => ({ model, count }))
52
+ .sort((a, b) => b.count - a.count);
53
+ const top = entries.slice(0, TOP_HOST_MODELS);
54
+ const restSum = entries
55
+ .slice(TOP_HOST_MODELS)
56
+ .reduce((sum, entry) => sum + entry.count, 0);
57
+ const slices = top.map((entry) => ({
58
+ name: entry.model,
59
+ count: entry.count,
60
+ countDisplay: `${entry.count} hosts`,
61
+ legendCategory: entry.model,
62
+ }));
63
+ if (restSum > 0) {
64
+ slices.push({
65
+ name: OTHER_MODELS_LABEL,
66
+ count: restSum,
67
+ countDisplay: `${restSum} hosts`,
68
+ legendCategory: OTHER_MODELS_LABEL,
69
+ });
70
+ }
71
+ const legend = {};
72
+ slices.forEach((slice, index) => {
73
+ const color = HOST_MODEL_COLORS[index % HOST_MODEL_COLORS.length];
74
+ if (color) {
75
+ legend[slice.legendCategory] = color;
76
+ }
77
+ });
78
+ return { slices, legend, totalHosts: hosts.length };
79
+ };
80
+ export const HostsOverview = ({ hosts, legendVariant = "html", }) => {
81
+ const { slices, legend, totalHosts } = useMemo(() => buildHostModelDonut(Array.isArray(hosts) ? hosts : []), [hosts]);
82
+ return (_jsx(ChartExportSurface, { id: CHART_ID, title: CHART_TITLE, children: _jsxs(Card, { className: dashboardStyles.card, children: [_jsx(CardTitle, { children: _jsxs(Flex, { justifyContent: { default: "justifyContentSpaceBetween" }, alignItems: { default: "alignItemsCenter" }, children: [_jsx(FlexItem, { children: _jsxs("div", { children: [_jsxs("div", { children: [_jsx(ServerIcon, {}), " ", CHART_TITLE] }), _jsx("div", { className: cardSubtitle, children: "Top 5 models" })] }) }), _jsx(ChartHeaderActions, { chartId: CHART_ID, title: CHART_TITLE })] }) }), _jsx(CardBody, { className: dashboardStyles.cardBodyScrollable, children: slices.length === 0 ? (_jsx(CardEmptyState, { title: REPORT_CARD_EMPTY_STATE_TITLES.hosts })) : (_jsx(MigrationDonutChart, { legendVariant: legendVariant, data: slices, height: 300, width: 420, donutThickness: 18, titleFontSize: 34, legend: legend, legendWidth: 680, title: `${totalHosts}`, subTitle: "Hosts", subTitleColor: "var(--pf-t--global--text--color--subtle)", itemsPerRow: 2, labelFontSize: 16, marginLeft: "0%", tooltipLabelFormatter: ({ datum, percent }) => `${datum.countDisplay}\n${percent.toFixed(1)}%` })) })] }) }));
83
+ };
84
+ HostsOverview.displayName = "HostsOverview";
@@ -1 +1 @@
1
- {"version":3,"file":"InfrastructureSummary.d.ts","sourceRoot":"","sources":["../../src/report/InfrastructureSummary.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAElF,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,0BAA0B,CAAC;CACrC;AAKD,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,0BAA0B,CAkChE,CAAC"}
1
+ {"version":3,"file":"InfrastructureSummary.d.ts","sourceRoot":"","sources":["../../src/report/InfrastructureSummary.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAGhC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAElF,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,0BAA0B,CAAC;CACrC;AAQD,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,0BAA0B,CA4ChE,CAAC"}
@@ -1,5 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Card, CardBody, CardTitle, DescriptionList, DescriptionListDescription, DescriptionListGroup, DescriptionListTerm, } from "@patternfly/react-core";
2
+ import { Card, CardBody, CardTitle, DescriptionList, DescriptionListDescription, DescriptionListGroup, DescriptionListTerm, Flex, FlexItem, } from "@patternfly/react-core";
3
+ import { ChartHeaderActions } from "./ChartDownloadButton.js";
4
+ import { ChartExportSurface } from "./ChartExportSurface.js";
3
5
  const formatCount = (value) => typeof value === "number" ? String(value) : "—";
4
- export const InfrastructureSummary = ({ summary, }) => (_jsxs(Card, { isFullHeight: true, id: "infrastructure-summary", children: [_jsx(CardTitle, { children: "Infrastructure summary" }), _jsx(CardBody, { children: _jsxs(DescriptionList, { isAutoFit: true, displaySize: "lg", children: [_jsxs(DescriptionListGroup, { children: [_jsx(DescriptionListTerm, { children: "VMware version" }), _jsx(DescriptionListDescription, { children: summary.vmwareVersion })] }), _jsxs(DescriptionListGroup, { children: [_jsx(DescriptionListTerm, { children: "Datacenters" }), _jsx(DescriptionListDescription, { children: formatCount(summary.datacenters) })] }), _jsxs(DescriptionListGroup, { children: [_jsx(DescriptionListTerm, { children: "vCenters" }), _jsx(DescriptionListDescription, { children: formatCount(summary.vCenters) })] }), _jsxs(DescriptionListGroup, { children: [_jsx(DescriptionListTerm, { children: "ESXi hosts" }), _jsx(DescriptionListDescription, { children: formatCount(summary.esxiHosts) })] })] }) })] }));
6
+ const INFRA_CHART_ID = "infrastructure-summary";
7
+ const INFRA_TITLE = "Infrastructure summary";
8
+ export const InfrastructureSummary = ({ summary, }) => (_jsx(ChartExportSurface, { id: INFRA_CHART_ID, title: INFRA_TITLE, children: _jsxs(Card, { isFullHeight: true, children: [_jsx(CardTitle, { children: _jsxs(Flex, { justifyContent: { default: "justifyContentSpaceBetween" }, alignItems: { default: "alignItemsCenter" }, children: [_jsx(FlexItem, { children: INFRA_TITLE }), _jsx(ChartHeaderActions, { chartId: INFRA_CHART_ID, title: INFRA_TITLE })] }) }), _jsx(CardBody, { children: _jsxs(DescriptionList, { isAutoFit: true, displaySize: "lg", children: [_jsxs(DescriptionListGroup, { children: [_jsx(DescriptionListTerm, { children: "VMware version" }), _jsx(DescriptionListDescription, { children: summary.vmwareVersion })] }), _jsxs(DescriptionListGroup, { children: [_jsx(DescriptionListTerm, { children: "Datacenters" }), _jsx(DescriptionListDescription, { children: formatCount(summary.datacenters) })] }), _jsxs(DescriptionListGroup, { children: [_jsx(DescriptionListTerm, { children: "vCenters" }), _jsx(DescriptionListDescription, { children: formatCount(summary.vCenters) })] }), _jsxs(DescriptionListGroup, { children: [_jsx(DescriptionListTerm, { children: "ESXi hosts" }), _jsx(DescriptionListDescription, { children: formatCount(summary.esxiHosts) })] })] }) })] }) }));
5
9
  InfrastructureSummary.displayName = "InfrastructureSummary";
@@ -0,0 +1,31 @@
1
+ import type { FC } from "react";
2
+ import { type MigrationDonutChartLegendVariant } from "../charts/MigrationDonutChart.js";
3
+ /** Network fields this card reads. Apps pass SDK networks structurally. */
4
+ export interface NetworkLike {
5
+ vmsCount?: number;
6
+ vlanId?: string | number;
7
+ }
8
+ /** Infra fields this card reads. */
9
+ export interface NetworkInfraLike {
10
+ networks?: NetworkLike[];
11
+ }
12
+ /** Deprecated NIC histogram used when `distributionByNicCount` is absent. */
13
+ export interface NicCountHistogram {
14
+ data?: number[];
15
+ minValue?: number;
16
+ step?: number;
17
+ }
18
+ /** NIC summary fields this card reads from the VM resource breakdown. */
19
+ export interface NicCountSummary {
20
+ total?: number;
21
+ histogram?: NicCountHistogram;
22
+ }
23
+ export interface NetworkOverviewProps {
24
+ infra?: NetworkInfraLike;
25
+ nicCount?: NicCountSummary;
26
+ distributionByNicCount?: Record<string, number>;
27
+ /** `"html"` in agent-ui; ui-app passes `"chart"`. */
28
+ legendVariant?: MigrationDonutChartLegendVariant;
29
+ }
30
+ export declare const NetworkOverview: FC<NetworkOverviewProps>;
31
+ //# sourceMappingURL=NetworkOverview.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NetworkOverview.d.ts","sourceRoot":"","sources":["../../src/report/NetworkOverview.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,EAAE,EAAO,MAAM,OAAO,CAAC;AAErC,OAAO,EAGL,KAAK,gCAAgC,EACtC,MAAM,kCAAkC,CAAC;AAQ1C,2EAA2E;AAC3E,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAED,oCAAoC;AACpC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;CAC1B;AAED,6EAA6E;AAC7E,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,yEAAyE;AACzE,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,iBAAiB,CAAC;CAC/B;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,sBAAsB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChD,qDAAqD;IACrD,aAAa,CAAC,EAAE,gCAAgC,CAAC;CAClD;AAiND,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CA2HpD,CAAC"}