@openshift-migration-advisor/shared-components 0.25.0-0ad1e70d1fa5 → 0.25.0-1701f64050d7

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 (47) hide show
  1. package/dist/report/ChartExportProvider.d.ts +3 -2
  2. package/dist/report/ChartExportProvider.d.ts.map +1 -1
  3. package/dist/report/ChartExportProvider.js +3 -3
  4. package/dist/report/ErrorTable.d.ts +18 -0
  5. package/dist/report/ErrorTable.d.ts.map +1 -0
  6. package/dist/report/ErrorTable.js +20 -0
  7. package/dist/report/HostsOverview.d.ts +13 -0
  8. package/dist/report/HostsOverview.d.ts.map +1 -0
  9. package/dist/report/HostsOverview.js +84 -0
  10. package/dist/report/NetworkOverview.d.ts +31 -0
  11. package/dist/report/NetworkOverview.d.ts.map +1 -0
  12. package/dist/report/NetworkOverview.js +201 -0
  13. package/dist/report/ReportTable.d.ts +14 -0
  14. package/dist/report/ReportTable.d.ts.map +1 -0
  15. package/dist/report/ReportTable.js +23 -0
  16. package/dist/report/WarningsTable.d.ts +9 -0
  17. package/dist/report/WarningsTable.d.ts.map +1 -0
  18. package/dist/report/WarningsTable.js +20 -0
  19. package/dist/report/chartExport.d.ts +16 -0
  20. package/dist/report/chartExport.d.ts.map +1 -1
  21. package/dist/report/chartExportContext.d.ts +6 -2
  22. package/dist/report/chartExportContext.d.ts.map +1 -1
  23. package/dist/report/constants.d.ts +2 -0
  24. package/dist/report/constants.d.ts.map +1 -1
  25. package/dist/report/constants.js +2 -0
  26. package/dist/report/index.d.ts +7 -2
  27. package/dist/report/index.d.ts.map +1 -1
  28. package/dist/report/index.js +5 -0
  29. package/dist/report/pdfExport.d.ts +2 -2
  30. package/dist/report/pdfExport.d.ts.map +1 -1
  31. package/dist/report/pdfExport.js +52 -3
  32. package/package.json +2 -2
  33. package/src/report/ChartExportProvider.tsx +13 -5
  34. package/src/report/ErrorTable.tsx +85 -0
  35. package/src/report/HostsOverview.tsx +185 -0
  36. package/src/report/NetworkOverview.tsx +405 -0
  37. package/src/report/ReportTable.tsx +81 -0
  38. package/src/report/WarningsTable.tsx +75 -0
  39. package/src/report/__tests__/ChartExportProvider.test.tsx +70 -2
  40. package/src/report/__tests__/HostsOverview.test.tsx +145 -0
  41. package/src/report/__tests__/NetworkOverview.test.tsx +269 -0
  42. package/src/report/__tests__/chartExportPackagers.test.ts +58 -0
  43. package/src/report/chartExport.ts +18 -0
  44. package/src/report/chartExportContext.tsx +9 -1
  45. package/src/report/constants.ts +2 -0
  46. package/src/report/index.ts +26 -0
  47. package/src/report/pdfExport.ts +81 -2
@@ -1,21 +1,24 @@
1
1
  export { CARD_EMPTY_STATE_DESCRIPTION, CardEmptyState, type CardEmptyStateProps, } from "./CardEmptyState.js";
2
2
  export { ChartDownloadButton, ChartHeaderActions, } from "./ChartDownloadButton.js";
3
- export { type BuildChartDocument, type CaptureChartElement, ChartExportProvider, type ChartExportProviderProps, type EncodeChartPng, type ZipChartFiles, } from "./ChartExportProvider.js";
3
+ export { type BuildChartDocument, type BuildPdfDocument, type CaptureChartElement, ChartExportProvider, type ChartExportProviderProps, type EncodeChartPng, type ZipChartFiles, } from "./ChartExportProvider.js";
4
4
  export { ChartExportSurface } from "./ChartExportSurface.js";
5
5
  export { captureChartElement } from "./captureChartElement.js";
6
- export { CHART_EXPORT_CAPTURING_ATTR, CHART_EXPORT_HIDE_ATTR, CHART_EXPORT_SCROLL_ATTR, type ChartCaptureSource, type ChartExportFile, type ChartExportMeta, type ChartExportView, canvasToBlob, chartExportHideProps, chartExportRootStyle, chartExportScrollProps, chartExportViewsFromLabels, chartPngFilename, downloadBlob, type RegisteredChart, releaseCanvas, restoreChartExportViews, shouldIgnoreChartExportElement, slugifyExportName, sortRegisteredChartsByDocumentOrder, toBulkChartCaptureSources, } from "./chartExport.js";
6
+ export { CHART_EXPORT_CAPTURING_ATTR, CHART_EXPORT_HIDE_ATTR, CHART_EXPORT_SCROLL_ATTR, type ChartCaptureSource, type ChartExportFile, type ChartExportMeta, type ChartExportView, canvasToBlob, chartExportHideProps, chartExportRootStyle, chartExportScrollProps, chartExportViewsFromLabels, chartPngFilename, downloadBlob, type PdfTextPage, type PdfTextPageItem, type RegisteredChart, releaseCanvas, restoreChartExportViews, shouldIgnoreChartExportElement, slugifyExportName, sortRegisteredChartsByDocumentOrder, toBulkChartCaptureSources, } from "./chartExport.js";
7
7
  export { type ChartExportApi, type ChartExportFormat, useChartExport, useRegisterChart, } from "./chartExportContext.js";
8
8
  export { getChartExportFilename, getChartZipFilename, getDatedChartExportBasename, } from "./chartExportFilenames.js";
9
9
  export { chartColorFailure, chartColorSuccess, REPORT_CARD_EMPTY_STATE_TITLES, } from "./constants.js";
10
10
  export { DashboardEmptyStateBase, type DashboardEmptyStateBaseProps, } from "./DashboardEmptyStateBase.js";
11
11
  export { dashboardStyles, tableFullWidthStyle } from "./dashboardStyles.js";
12
12
  export { EmptySearchResults, type EmptySearchResultsProps, } from "./EmptySearchResults.js";
13
+ export { ErrorTable, type ErrorTableProps, type MigrationIssueLike, } from "./ErrorTable.js";
13
14
  export { FeatureStatusBadge, type FeatureStatusBadgeProps, } from "./FeatureStatusBadge.js";
14
15
  export { HostPowerStates, type HostPowerStatesProps, } from "./HostPowerStates.js";
16
+ export { type HostLike, HostsOverview, type HostsOverviewProps, } from "./HostsOverview.js";
15
17
  export { buildHtmlFromCharts, buildHtmlReport, escapeHtml, type HtmlReportImage, } from "./htmlExport.js";
16
18
  export { InfrastructureSummary, type InfrastructureSummaryProps, } from "./InfrastructureSummary.js";
17
19
  export type { ClusterDetailRow, ClusterDetailsModel, FeatureStatus, HostCapability, InfrastructureSummaryModel, InventoryCluster, InventoryDatastore, InventoryHost, InventoryInfra, InventoryNetwork, InventoryVms, NetworkLabel, } from "./infrastructureSummaryModel.js";
18
20
  export { booleanToFeatureStatus, buildClusterDetailRows, buildClusterDetails, buildInfrastructureSummary, countVCenters, formatVSphereVersion, hostCapabilityStatus, visibleNetworks, vsanStatus, } from "./infrastructureSummaryModel.js";
21
+ export { type NetworkInfraLike, type NetworkLike, NetworkOverview, type NetworkOverviewProps, type NicCountHistogram, type NicCountSummary, } from "./NetworkOverview.js";
19
22
  export { OSBarChart, OSDistribution } from "./OSDistribution.js";
20
23
  export { OsSupportTiersHelpPopover } from "./OsSupportTiersHelpPopover.js";
21
24
  export { OsUpgradeNotice } from "./OsUpgradeNotice.js";
@@ -29,10 +32,12 @@ export { type PdfExportSegment, sliceCanvas, splitSegmentForPageHeight, } from "
29
32
  export type { PowerStateChartModel } from "./powerStates.js";
30
33
  export { buildHostPowerStateChart, buildVmPowerStateChart, HOST_POWER_COLORS, VM_POWER_COLORS, } from "./powerStates.js";
31
34
  export { ExportReportButton, type ExportReportButtonProps, ReportExportMenu, type ReportExportMenuProps, } from "./ReportExportMenu.js";
35
+ export { ReportTable, type ReportTableProps } from "./ReportTable.js";
32
36
  export { type ReportExportOption, type StandardReportExportHandlers, standardReportExportOptions, } from "./reportExportOptions.js";
33
37
  export { SupportTierBadge } from "./SupportTierBadge.js";
34
38
  export { ALL_TIERS_FILTER, type OsBarChartViewModel, type OsTableRow, useOsBarChartViewModel, } from "./useOsBarChartViewModel.js";
35
39
  export { VCenterClusterDetails, type VCenterClusterDetailsProps, } from "./VCenterClusterDetails.js";
36
40
  export { VmPowerStates, type VmPowerStatesProps, } from "./VmPowerStates.js";
41
+ export { WarningsTable, type WarningsTableProps, } from "./WarningsTable.js";
37
42
  export { zipChartPngs } from "./zipChartPngs.js";
38
43
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/report/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,cAAc,EACd,KAAK,mBAAmB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,KAAK,kBAAkB,EACvB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gBAAgB,EACrB,WAAW,EACX,yBAAyB,GAC1B,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,iBAAiB,EACjB,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,kBAAkB,EAClB,KAAK,uBAAuB,EAC5B,gBAAgB,EAChB,KAAK,qBAAqB,GAC3B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,4BAA4B,EACjC,2BAA2B,GAC5B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EACL,gBAAgB,EAChB,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,sBAAsB,GACvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,qBAAqB,EACrB,KAAK,0BAA0B,GAChC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,aAAa,EACb,KAAK,kBAAkB,GACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/report/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,cAAc,EACd,KAAK,mBAAmB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,mBAAmB,EACnB,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EACnB,KAAK,aAAa,GACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,mBAAm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AM,kBAAkB,CAAC;AAC1D,OAAO,EACL,cAAc,EACd,KAAK,mBAAmB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EACL,KAAK,gBAAgB,EACrB,WAAW,EACX,yBAAyB,GAC1B,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,iBAAiB,EACjB,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,kBAAkB,EAClB,KAAK,uBAAuB,EAC5B,gBAAgB,EAChB,KAAK,qBAAqB,GAC3B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,4BAA4B,EACjC,2BAA2B,GAC5B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EACL,gBAAgB,EAChB,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,sBAAsB,GACvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,qBAAqB,EACrB,KAAK,0BAA0B,GAChC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,aAAa,EACb,KAAK,kBAAkB,GACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,aAAa,EACb,KAAK,kBAAkB,GACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
@@ -10,11 +10,14 @@ export { chartColorFailure, chartColorSuccess, REPORT_CARD_EMPTY_STATE_TITLES, }
10
10
  export { DashboardEmptyStateBase, } from "./DashboardEmptyStateBase.js";
11
11
  export { dashboardStyles, tableFullWidthStyle } from "./dashboardStyles.js";
12
12
  export { EmptySearchResults, } from "./EmptySearchResults.js";
13
+ export { ErrorTable, } from "./ErrorTable.js";
13
14
  export { FeatureStatusBadge, } from "./FeatureStatusBadge.js";
14
15
  export { HostPowerStates, } from "./HostPowerStates.js";
16
+ export { HostsOverview, } from "./HostsOverview.js";
15
17
  export { buildHtmlFromCharts, buildHtmlReport, escapeHtml, } from "./htmlExport.js";
16
18
  export { InfrastructureSummary, } from "./InfrastructureSummary.js";
17
19
  export { booleanToFeatureStatus, buildClusterDetailRows, buildClusterDetails, buildInfrastructureSummary, countVCenters, formatVSphereVersion, hostCapabilityStatus, visibleNetworks, vsanStatus, } from "./infrastructureSummaryModel.js";
20
+ export { NetworkOverview, } from "./NetworkOverview.js";
18
21
  export { OSBarChart, OSDistribution } from "./OSDistribution.js";
19
22
  export { OsSupportTiersHelpPopover } from "./OsSupportTiersHelpPopover.js";
20
23
  export { OsUpgradeNotice } from "./OsUpgradeNotice.js";
@@ -26,9 +29,11 @@ export { buildPdfFromCharts } from "./pdfExport.js";
26
29
  export { sliceCanvas, splitSegmentForPageHeight, } from "./pdfPage.js";
27
30
  export { buildHostPowerStateChart, buildVmPowerStateChart, HOST_POWER_COLORS, VM_POWER_COLORS, } from "./powerStates.js";
28
31
  export { ExportReportButton, ReportExportMenu, } from "./ReportExportMenu.js";
32
+ export { ReportTable } from "./ReportTable.js";
29
33
  export { standardReportExportOptions, } from "./reportExportOptions.js";
30
34
  export { SupportTierBadge } from "./SupportTierBadge.js";
31
35
  export { ALL_TIERS_FILTER, useOsBarChartViewModel, } from "./useOsBarChartViewModel.js";
32
36
  export { VCenterClusterDetails, } from "./VCenterClusterDetails.js";
33
37
  export { VmPowerStates, } from "./VmPowerStates.js";
38
+ export { WarningsTable, } from "./WarningsTable.js";
34
39
  export { zipChartPngs } from "./zipChartPngs.js";
@@ -1,3 +1,3 @@
1
- import { type ChartCaptureSource } from "./chartExport.js";
2
- export declare function buildPdfFromCharts(charts: ChartCaptureSource[], documentTitle: string): Promise<Blob>;
1
+ import { type ChartCaptureSource, type PdfTextPage } from "./chartExport.js";
2
+ export declare function buildPdfFromCharts(charts: ChartCaptureSource[], documentTitle: string, extraPages?: PdfTextPage[]): Promise<Blob>;
3
3
  //# sourceMappingURL=pdfExport.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pdfExport.d.ts","sourceRoot":"","sources":["../../src/report/pdfExport.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,kBAAkB,EAAiB,MAAM,kBAAkB,CAAC;AAQ1E,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,kBAAkB,EAAE,EAC5B,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,IAAI,CAAC,CAuDf"}
1
+ {"version":3,"file":"pdfExport.d.ts","sourceRoot":"","sources":["../../src/report/pdfExport.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAEjB,MAAM,kBAAkB,CAAC;AAQ1B,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,kBAAkB,EAAE,EAC5B,aAAa,EAAE,MAAM,EACrB,UAAU,GAAE,WAAW,EAAO,GAC7B,OAAO,CAAC,IAAI,CAAC,CA2Df"}
@@ -1,11 +1,11 @@
1
1
  import jsPDF from "jspdf";
2
- import { releaseCanvas } from "./chartExport.js";
2
+ import { releaseCanvas, } from "./chartExport.js";
3
3
  import { fitPdfImageSize, placePdfBlock, sliceCanvas } from "./pdfPage.js";
4
4
  const MARGIN_MM = 10;
5
5
  const GAP_MM = 8;
6
6
  /** Flatten captures onto white; jsPDF cannot embed transparent PNG alpha cleanly. */
7
7
  const PAGE_BACKGROUND = "#ffffff";
8
- export async function buildPdfFromCharts(charts, documentTitle) {
8
+ export async function buildPdfFromCharts(charts, documentTitle, extraPages = []) {
9
9
  const pdf = new jsPDF("p", "mm", "a4");
10
10
  const pageWidth = pdf.internal.pageSize.getWidth();
11
11
  const pageHeight = pdf.internal.pageSize.getHeight();
@@ -13,7 +13,7 @@ export async function buildPdfFromCharts(charts, documentTitle) {
13
13
  const contentHeight = pageHeight - MARGIN_MM * 2;
14
14
  const pageTop = MARGIN_MM;
15
15
  const pageBottom = pageHeight - MARGIN_MM;
16
- addCoverPage(pdf, documentTitle, charts.map((chart) => chart.title), pageWidth, pageHeight);
16
+ addCoverPage(pdf, documentTitle, [...charts.map((chart) => chart.title), ...extraPages.map((p) => p.title)], pageWidth, pageHeight);
17
17
  let cursorY = null;
18
18
  for (const chart of charts) {
19
19
  const canvas = await chart.capture();
@@ -33,6 +33,9 @@ export async function buildPdfFromCharts(charts, documentTitle) {
33
33
  releaseCanvas(canvas);
34
34
  }
35
35
  }
36
+ if (extraPages.length > 0) {
37
+ addExtraPages(pdf, extraPages, pageWidth, pageHeight);
38
+ }
36
39
  addPageNumbers(pdf, pageWidth, pageHeight);
37
40
  return pdf.output("blob");
38
41
  }
@@ -70,6 +73,52 @@ function addChartImage(pdf, canvas, x, y, widthMm, heightMm) {
70
73
  releaseCanvas(flattened);
71
74
  }
72
75
  }
76
+ /**
77
+ * Append one native-text PDF page per entry in `extraPages`, rendered as
78
+ * label/value rows rather than a captured image. Each page starts fresh so
79
+ * its content never bleeds into a chart page.
80
+ */
81
+ function addExtraPages(pdf, extraPages, pageWidth, pageHeight) {
82
+ const LABEL_COL_WIDTH = 68; // mm — enough for the longest label
83
+ const VALUE_COL_X = MARGIN_MM + LABEL_COL_WIDTH;
84
+ const VALUE_COL_WIDTH = pageWidth - MARGIN_MM - LABEL_COL_WIDTH;
85
+ const LINE_HEIGHT = 7; // mm between rows
86
+ for (const page of extraPages) {
87
+ pdf.addPage();
88
+ let y = MARGIN_MM + 8;
89
+ pdf.setFontSize(16);
90
+ pdf.setFont("helvetica", "bold");
91
+ pdf.text(page.title, MARGIN_MM, y);
92
+ y += 10;
93
+ pdf.setDrawColor(0, 103, 187);
94
+ pdf.setLineWidth(0.5);
95
+ pdf.line(MARGIN_MM, y, pageWidth - MARGIN_MM, y);
96
+ y += 10;
97
+ pdf.setFontSize(11);
98
+ for (const item of page.items) {
99
+ pdf.setFont("helvetica", "bold");
100
+ const labelLines = pdf.splitTextToSize(item.label, LABEL_COL_WIDTH - 4);
101
+ pdf.text(labelLines, MARGIN_MM, y);
102
+ pdf.setFont("helvetica", "normal");
103
+ const valueLines = pdf.splitTextToSize(item.value, VALUE_COL_WIDTH);
104
+ pdf.text(valueLines, VALUE_COL_X, y);
105
+ y += LINE_HEIGHT * Math.max(labelLines.length, valueLines.length);
106
+ if (y > pageHeight - MARGIN_MM - 25) {
107
+ pdf.addPage();
108
+ y = MARGIN_MM + 10;
109
+ }
110
+ }
111
+ if (page.footer) {
112
+ y += 4;
113
+ pdf.setFontSize(9);
114
+ pdf.setFont("helvetica", "bolditalic");
115
+ const footerLines = pdf.splitTextToSize(page.footer, pageWidth - MARGIN_MM * 2);
116
+ pdf.text(footerLines, MARGIN_MM, y);
117
+ pdf.setFont("helvetica", "normal");
118
+ pdf.setFontSize(11);
119
+ }
120
+ }
121
+ }
73
122
  function addPageNumbers(pdf, pageWidth, pageHeight) {
74
123
  const totalPages = pdf.getNumberOfPages();
75
124
  pdf.setFontSize(9);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openshift-migration-advisor/shared-components",
3
- "version": "0.25.0-0ad1e70d1fa5",
3
+ "version": "0.25.0-1701f64050d7",
4
4
  "description": "Shared React UI components for Migration Advisor apps (report charts, forms, OS support tiers)",
5
5
  "author": "Montse Ortega <mortegag@redhat.com>",
6
6
  "license": "Apache-2.0",
@@ -46,7 +46,7 @@
46
46
  "README.md"
47
47
  ],
48
48
  "dependencies": {
49
- "html2canvas-pro": "^2.4.4",
49
+ "html2canvas-pro": "^2.4.5",
50
50
  "jspdf": "^4.2.1",
51
51
  "jszip": "^3.10.2"
52
52
  }
@@ -11,6 +11,7 @@ import {
11
11
  type ChartExportFile,
12
12
  canvasToBlob,
13
13
  downloadBlob,
14
+ type PdfTextPage,
14
15
  type RegisteredChart,
15
16
  releaseCanvas,
16
17
  restoreChartExportViews,
@@ -36,6 +37,12 @@ export type BuildChartDocument = (
36
37
  documentTitle: string,
37
38
  ) => Promise<Blob>;
38
39
 
40
+ export type BuildPdfDocument = (
41
+ charts: ChartCaptureSource[],
42
+ documentTitle: string,
43
+ extraPages?: PdfTextPage[],
44
+ ) => Promise<Blob>;
45
+
39
46
  export type {
40
47
  ChartExportApi,
41
48
  ChartExportFormat,
@@ -47,7 +54,7 @@ export interface ChartExportProviderProps {
47
54
  capture?: CaptureChartElement;
48
55
  zipFiles?: ZipChartFiles;
49
56
  encodePng?: EncodeChartPng;
50
- buildPdf?: BuildChartDocument;
57
+ buildPdf?: BuildPdfDocument;
51
58
  buildHtml?: BuildChartDocument;
52
59
  downloadFile?: (blob: Blob, filename: string) => void;
53
60
  getZipFilename?: () => string;
@@ -96,8 +103,8 @@ async function resolveZip(override?: ZipChartFiles): Promise<ZipChartFiles> {
96
103
  }
97
104
 
98
105
  async function resolvePdf(
99
- override?: BuildChartDocument,
100
- ): Promise<BuildChartDocument> {
106
+ override?: BuildPdfDocument,
107
+ ): Promise<BuildPdfDocument> {
101
108
  if (override) {
102
109
  return override;
103
110
  }
@@ -281,11 +288,11 @@ export const ChartExportProvider: FC<ChartExportProviderProps> = ({
281
288
  ]);
282
289
 
283
290
  const downloadPdf = useCallback(
284
- async (documentTitle: string) => {
291
+ async (documentTitle: string, extraPages?: PdfTextPage[]) => {
285
292
  await runCapture(
286
293
  async () => {
287
294
  const charts = listCharts();
288
- if (charts.length === 0) {
295
+ if (charts.length === 0 && (extraPages?.length ?? 0) === 0) {
289
296
  throw new Error("The report is not ready to export yet.");
290
297
  }
291
298
  const captureFn = await resolveCapture(capture);
@@ -296,6 +303,7 @@ export const ChartExportProvider: FC<ChartExportProviderProps> = ({
296
303
  await build(
297
304
  toCaptureSources(charts, captureFn, prepareElement),
298
305
  documentTitle,
306
+ extraPages,
299
307
  ),
300
308
  getPdfFilename(),
301
309
  );
@@ -0,0 +1,85 @@
1
+ import {
2
+ Card,
3
+ CardBody,
4
+ CardTitle,
5
+ Flex,
6
+ FlexItem,
7
+ Icon,
8
+ } from "@patternfly/react-core";
9
+ import { ExclamationCircleIcon } from "@patternfly/react-icons";
10
+ import type React from "react";
11
+ import { CardEmptyState } from "./CardEmptyState.js";
12
+ import { ChartHeaderActions } from "./ChartDownloadButton.js";
13
+ import { ChartExportSurface } from "./ChartExportSurface.js";
14
+ import { REPORT_CARD_EMPTY_STATE_TITLES } from "./constants.js";
15
+ import { dashboardStyles } from "./dashboardStyles.js";
16
+ import { ReportTable } from "./ReportTable.js";
17
+
18
+ /**
19
+ * Minimal shape of a migration issue consumed by {@link ErrorTable}. Declared
20
+ * locally so this package does not depend on a specific SDK (`agent-sdk` or
21
+ * `planner-sdk`); callers pass the subset of `MigrationIssue` fields read here.
22
+ */
23
+ export interface MigrationIssueLike {
24
+ label: string;
25
+ assessment: string;
26
+ count: number;
27
+ }
28
+
29
+ export interface ErrorTableProps {
30
+ errors: MigrationIssueLike[];
31
+ /** Optional drill-down callback invoked with an issue's `label`. */
32
+ onConcernClick?: (concernLabel: string) => void;
33
+ }
34
+
35
+ export const ErrorTable: React.FC<ErrorTableProps> = ({
36
+ errors,
37
+ onConcernClick,
38
+ }) => {
39
+ const handleRowClick = (issue: MigrationIssueLike) => {
40
+ if (issue.label && onConcernClick) {
41
+ onConcernClick(issue.label);
42
+ }
43
+ };
44
+
45
+ const chartId = "errors-table";
46
+ const chartTitle = "Errors";
47
+
48
+ return (
49
+ <ChartExportSurface id={chartId} title={chartTitle}>
50
+ <Card className={dashboardStyles.card}>
51
+ <CardTitle>
52
+ <Flex
53
+ justifyContent={{ default: "justifyContentSpaceBetween" }}
54
+ alignItems={{ default: "alignItemsCenter" }}
55
+ >
56
+ <FlexItem>
57
+ <Icon status="danger">
58
+ <ExclamationCircleIcon />
59
+ </Icon>{" "}
60
+ Errors
61
+ </FlexItem>
62
+ <ChartHeaderActions chartId={chartId} title={chartTitle} />
63
+ </Flex>
64
+ </CardTitle>
65
+ <CardBody className={dashboardStyles.cardBodyScrollable}>
66
+ {errors.length === 0 ? (
67
+ <CardEmptyState title={REPORT_CARD_EMPTY_STATE_TITLES.errors} />
68
+ ) : (
69
+ <div>
70
+ <ReportTable<MigrationIssueLike>
71
+ data={errors}
72
+ columns={["Description", "Total VMs"]}
73
+ fields={["assessment", "count"]}
74
+ onRowClick={onConcernClick ? handleRowClick : undefined}
75
+ clickableFields={onConcernClick ? ["assessment"] : []}
76
+ />
77
+ </div>
78
+ )}
79
+ </CardBody>
80
+ </Card>
81
+ </ChartExportSurface>
82
+ );
83
+ };
84
+
85
+ ErrorTable.displayName = "ErrorTable";
@@ -0,0 +1,185 @@
1
+ import { css } from "@emotion/css";
2
+ import {
3
+ Card,
4
+ CardBody,
5
+ CardTitle,
6
+ Flex,
7
+ FlexItem,
8
+ } from "@patternfly/react-core";
9
+ import { ServerIcon } from "@patternfly/react-icons";
10
+ import {
11
+ chart_color_blue_300,
12
+ chart_color_green_300,
13
+ chart_color_purple_100,
14
+ chart_color_purple_300,
15
+ chart_color_teal_200,
16
+ chart_color_yellow_400,
17
+ } from "@patternfly/react-tokens";
18
+ import type { FC } from "react";
19
+ import { useMemo } from "react";
20
+ import {
21
+ MigrationDonutChart,
22
+ type MigrationDonutChartDatum,
23
+ type MigrationDonutChartLegendVariant,
24
+ } from "../charts/MigrationDonutChart.js";
25
+ import { CardEmptyState } from "./CardEmptyState.js";
26
+ import { ChartHeaderActions } from "./ChartDownloadButton.js";
27
+ import { ChartExportSurface } from "./ChartExportSurface.js";
28
+ import { REPORT_CARD_EMPTY_STATE_TITLES } from "./constants.js";
29
+ import { dashboardStyles } from "./dashboardStyles.js";
30
+
31
+ /** Smallest host shape this card reads. Apps pass SDK hosts structurally. */
32
+ export interface HostLike {
33
+ model?: string | number;
34
+ }
35
+
36
+ export interface HostsOverviewProps {
37
+ hosts?: HostLike[];
38
+ /** `"html"` in agent-ui; ui-app passes `"chart"`. */
39
+ legendVariant?: MigrationDonutChartLegendVariant;
40
+ }
41
+
42
+ const TOP_HOST_MODELS = 5;
43
+ const OTHER_MODELS_LABEL = "Other models";
44
+ const UNKNOWN_MODEL_LABEL = "Unknown model";
45
+ const CHART_ID = "hosts-overview";
46
+ const CHART_TITLE = "Host distribution by model";
47
+
48
+ /**
49
+ * Same categorical order as the ui-app host-model donut, mapped onto
50
+ * PatternFly `chart_color_*` tokens (nearest token where the old hex
51
+ * was not itself a token).
52
+ */
53
+ const HOST_MODEL_COLORS = [
54
+ chart_color_blue_300.value,
55
+ chart_color_purple_300.value,
56
+ chart_color_purple_100.value,
57
+ chart_color_teal_200.value,
58
+ chart_color_yellow_400.value,
59
+ chart_color_green_300.value,
60
+ ];
61
+
62
+ const cardSubtitle = css`
63
+ color: var(--pf-t--global--text--color--subtle);
64
+ font-size: 0.85rem;
65
+ `;
66
+
67
+ const hostModelLabel = (model: HostLike["model"]): string => {
68
+ const raw =
69
+ typeof model === "string"
70
+ ? model
71
+ : typeof model === "number"
72
+ ? String(model)
73
+ : "";
74
+ const trimmed = raw.trim();
75
+ return trimmed !== "" ? trimmed : UNKNOWN_MODEL_LABEL;
76
+ };
77
+
78
+ const buildHostModelDonut = (
79
+ hosts: HostLike[],
80
+ ): {
81
+ slices: MigrationDonutChartDatum[];
82
+ legend: Record<string, string>;
83
+ totalHosts: number;
84
+ } => {
85
+ const counts = new Map<string, number>();
86
+ for (const host of hosts) {
87
+ const label = hostModelLabel(host?.model);
88
+ counts.set(label, (counts.get(label) ?? 0) + 1);
89
+ }
90
+
91
+ const entries = [...counts.entries()]
92
+ .map(([model, count]) => ({ model, count }))
93
+ .sort((a, b) => b.count - a.count);
94
+
95
+ const top = entries.slice(0, TOP_HOST_MODELS);
96
+ const restSum = entries
97
+ .slice(TOP_HOST_MODELS)
98
+ .reduce((sum, entry) => sum + entry.count, 0);
99
+
100
+ const slices: MigrationDonutChartDatum[] = top.map((entry) => ({
101
+ name: entry.model,
102
+ count: entry.count,
103
+ countDisplay: `${entry.count} hosts`,
104
+ legendCategory: entry.model,
105
+ }));
106
+
107
+ if (restSum > 0) {
108
+ slices.push({
109
+ name: OTHER_MODELS_LABEL,
110
+ count: restSum,
111
+ countDisplay: `${restSum} hosts`,
112
+ legendCategory: OTHER_MODELS_LABEL,
113
+ });
114
+ }
115
+
116
+ const legend: Record<string, string> = {};
117
+ slices.forEach((slice, index) => {
118
+ const color = HOST_MODEL_COLORS[index % HOST_MODEL_COLORS.length];
119
+ if (color) {
120
+ legend[slice.legendCategory] = color;
121
+ }
122
+ });
123
+
124
+ return { slices, legend, totalHosts: hosts.length };
125
+ };
126
+
127
+ export const HostsOverview: FC<HostsOverviewProps> = ({
128
+ hosts,
129
+ legendVariant = "html",
130
+ }) => {
131
+ const { slices, legend, totalHosts } = useMemo(
132
+ () => buildHostModelDonut(Array.isArray(hosts) ? hosts : []),
133
+ [hosts],
134
+ );
135
+
136
+ return (
137
+ <ChartExportSurface id={CHART_ID} title={CHART_TITLE}>
138
+ <Card className={dashboardStyles.card}>
139
+ <CardTitle>
140
+ <Flex
141
+ justifyContent={{ default: "justifyContentSpaceBetween" }}
142
+ alignItems={{ default: "alignItemsCenter" }}
143
+ >
144
+ <FlexItem>
145
+ <div>
146
+ <div>
147
+ <ServerIcon /> {CHART_TITLE}
148
+ </div>
149
+ <div className={cardSubtitle}>Top 5 models</div>
150
+ </div>
151
+ </FlexItem>
152
+ <ChartHeaderActions chartId={CHART_ID} title={CHART_TITLE} />
153
+ </Flex>
154
+ </CardTitle>
155
+ <CardBody className={dashboardStyles.cardBodyScrollable}>
156
+ {slices.length === 0 ? (
157
+ <CardEmptyState title={REPORT_CARD_EMPTY_STATE_TITLES.hosts} />
158
+ ) : (
159
+ <MigrationDonutChart
160
+ legendVariant={legendVariant}
161
+ data={slices}
162
+ height={300}
163
+ width={420}
164
+ donutThickness={18}
165
+ titleFontSize={34}
166
+ legend={legend}
167
+ legendWidth={680}
168
+ title={`${totalHosts}`}
169
+ subTitle="Hosts"
170
+ subTitleColor="var(--pf-t--global--text--color--subtle)"
171
+ itemsPerRow={2}
172
+ labelFontSize={16}
173
+ marginLeft="0%"
174
+ tooltipLabelFormatter={({ datum, percent }) =>
175
+ `${datum.countDisplay}\n${percent.toFixed(1)}%`
176
+ }
177
+ />
178
+ )}
179
+ </CardBody>
180
+ </Card>
181
+ </ChartExportSurface>
182
+ );
183
+ };
184
+
185
+ HostsOverview.displayName = "HostsOverview";