@openshift-migration-advisor/shared-components 0.27.0 → 0.28.0-09381b4d22e5

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 (68) hide show
  1. package/dist/charts/MigrationDonutChart.d.ts.map +1 -1
  2. package/dist/charts/MigrationDonutChart.js +7 -0
  3. package/dist/report/ChartExportProvider.d.ts +4 -3
  4. package/dist/report/ChartExportProvider.d.ts.map +1 -1
  5. package/dist/report/ChartExportProvider.js +7 -4
  6. package/dist/report/ClustersOverview.d.ts +24 -0
  7. package/dist/report/ClustersOverview.d.ts.map +1 -0
  8. package/dist/report/ClustersOverview.js +228 -0
  9. package/dist/report/ClustersOverviewStyles.d.ts +12 -0
  10. package/dist/report/ClustersOverviewStyles.d.ts.map +1 -0
  11. package/dist/report/ClustersOverviewStyles.js +101 -0
  12. package/dist/report/CpuAndMemoryOverview.d.ts +19 -0
  13. package/dist/report/CpuAndMemoryOverview.d.ts.map +1 -0
  14. package/dist/report/CpuAndMemoryOverview.js +112 -0
  15. package/dist/report/FeatureStatusBadge.js +1 -1
  16. package/dist/report/ReportExportMenu.d.ts +1 -0
  17. package/dist/report/ReportExportMenu.d.ts.map +1 -1
  18. package/dist/report/ReportExportMenu.js +38 -4
  19. package/dist/report/StorageOverview.d.ts +27 -0
  20. package/dist/report/StorageOverview.d.ts.map +1 -0
  21. package/dist/report/StorageOverview.js +319 -0
  22. package/dist/report/VMMigrationStatus.d.ts +33 -0
  23. package/dist/report/VMMigrationStatus.d.ts.map +1 -0
  24. package/dist/report/VMMigrationStatus.js +129 -0
  25. package/dist/report/captureChartElement.d.ts +6 -1
  26. package/dist/report/captureChartElement.d.ts.map +1 -1
  27. package/dist/report/captureChartElement.js +41 -12
  28. package/dist/report/chartExport.d.ts +23 -0
  29. package/dist/report/chartExport.d.ts.map +1 -1
  30. package/dist/report/chartExport.js +21 -1
  31. package/dist/report/chartExportContext.d.ts +6 -2
  32. package/dist/report/chartExportContext.d.ts.map +1 -1
  33. package/dist/report/dashboardStyles.d.ts +6 -0
  34. package/dist/report/dashboardStyles.d.ts.map +1 -1
  35. package/dist/report/dashboardStyles.js +7 -4
  36. package/dist/report/index.d.ts +7 -3
  37. package/dist/report/index.d.ts.map +1 -1
  38. package/dist/report/index.js +4 -0
  39. package/dist/report/pdfExport.d.ts +2 -2
  40. package/dist/report/pdfExport.d.ts.map +1 -1
  41. package/dist/report/pdfExport.js +52 -3
  42. package/dist/report/reportExportOptions.d.ts +13 -2
  43. package/dist/report/reportExportOptions.d.ts.map +1 -1
  44. package/dist/report/reportExportOptions.js +13 -5
  45. package/package.json +2 -2
  46. package/src/charts/MigrationDonutChart.tsx +9 -0
  47. package/src/report/ChartExportProvider.tsx +18 -6
  48. package/src/report/ClustersOverview.tsx +451 -0
  49. package/src/report/ClustersOverviewStyles.ts +110 -0
  50. package/src/report/CpuAndMemoryOverview.tsx +277 -0
  51. package/src/report/FeatureStatusBadge.tsx +1 -1
  52. package/src/report/ReportExportMenu.tsx +69 -13
  53. package/src/report/StorageOverview.tsx +629 -0
  54. package/src/report/VMMigrationStatus.tsx +358 -0
  55. package/src/report/__tests__/ChartExportProvider.test.tsx +110 -2
  56. package/src/report/__tests__/ClustersOverview.test.tsx +241 -0
  57. package/src/report/__tests__/CpuAndMemoryOverview.test.tsx +200 -0
  58. package/src/report/__tests__/StorageOverview.test.tsx +223 -0
  59. package/src/report/__tests__/VMMigrationStatus.test.tsx +178 -0
  60. package/src/report/__tests__/captureChartElement.test.ts +120 -0
  61. package/src/report/__tests__/chartExportPackagers.test.ts +75 -0
  62. package/src/report/captureChartElement.ts +55 -10
  63. package/src/report/chartExport.ts +41 -1
  64. package/src/report/chartExportContext.tsx +9 -1
  65. package/src/report/dashboardStyles.ts +7 -4
  66. package/src/report/index.ts +24 -0
  67. package/src/report/pdfExport.ts +81 -2
  68. package/src/report/reportExportOptions.ts +28 -5
@@ -1,7 +1,10 @@
1
+ import { t_color_gray_20, t_color_white, t_global_text_color_regular, } from "@patternfly/react-tokens";
1
2
  import html2canvas from "html2canvas-pro";
2
- import { CHART_EXPORT_CAPTURING_ATTR, CHART_EXPORT_SCROLL_ATTR, shouldIgnoreChartExportElement, } from "./chartExport.js";
3
- /** CSS-pixel scale; 2x made zip-all of ~15 live cards too slow. */
4
- const CHART_CAPTURE_SCALE = 1;
3
+ import { applyLightThemeToDocument, CHART_EXPORT_CAPTURING_ATTR, CHART_EXPORT_SCROLL_ATTR, shouldIgnoreChartExportElement, } from "./chartExport.js";
4
+ /** Default scale for bulk exports; single-chart PNG uses a higher scale. */
5
+ const CHART_CAPTURE_SCALE_DEFAULT = 1;
6
+ export const CHART_CAPTURE_SCALE_SINGLE = 2;
7
+ const EXPORT_FONT_FAMILY = "RedHatText, Overpass, Helvetica, Arial, sans-serif";
5
8
  const HIDDEN_LAYOUT_STYLE_KEYS = [
6
9
  "display",
7
10
  "position",
@@ -71,6 +74,10 @@ export function revealHiddenChartAncestors(element) {
71
74
  const PADDED_CAPTURE_SELECTOR = ".pf-v6-c-card__title, .pf-v6-c-card__header, .pf-v6-c-card__body";
72
75
  const CARD_CAPTURE_SELECTOR = ".pf-v6-c-card";
73
76
  const TRANSPARENT_FILLS = new Set(["", "transparent", "rgba(0, 0, 0, 0)"]);
77
+ /** PatternFly light-theme chrome. html2canvas inlines live computed SVG styles. */
78
+ const LIGHT_EXPORT_BACKGROUND = t_color_white.value;
79
+ const LIGHT_EXPORT_BORDER = t_color_gray_20.value;
80
+ const LIGHT_EXPORT_TEXT = t_global_text_color_regular.value;
74
81
  function queryCards(root) {
75
82
  const cards = Array.from(root.querySelectorAll(CARD_CAPTURE_SELECTOR));
76
83
  if (root.matches(CARD_CAPTURE_SELECTOR)) {
@@ -112,16 +119,30 @@ function readCardBorder(source) {
112
119
  }
113
120
  return { width, style, color };
114
121
  }
115
- function applyCardChrome(source, dest) {
122
+ function applyCardChrome(source, dest, colors) {
116
123
  const computed = window.getComputedStyle(source);
117
124
  dest.style.borderRadius = computed.borderRadius;
118
- dest.style.backgroundColor = resolvedFill(computed.backgroundColor);
119
125
  dest.style.overflow = "hidden";
126
+ dest.style.backgroundColor =
127
+ colors === "light"
128
+ ? LIGHT_EXPORT_BACKGROUND
129
+ : resolvedFill(computed.backgroundColor);
120
130
  const border = readCardBorder(source);
121
131
  if (border) {
122
132
  dest.style.borderWidth = border.width;
123
133
  dest.style.borderStyle = border.style;
124
- dest.style.borderColor = border.color;
134
+ dest.style.borderColor =
135
+ colors === "light" ? LIGHT_EXPORT_BORDER : border.color;
136
+ }
137
+ }
138
+ function applyLightThemeSvgText(root) {
139
+ for (const node of root.querySelectorAll("text, tspan")) {
140
+ if (!(node instanceof SVGElement)) {
141
+ continue;
142
+ }
143
+ node.style.fill = LIGHT_EXPORT_TEXT;
144
+ node.style.color = LIGHT_EXPORT_TEXT;
145
+ node.style.fontFamily = EXPORT_FONT_FAMILY;
125
146
  }
126
147
  }
127
148
  function hideCardBeforePseudo() {
@@ -162,7 +183,7 @@ function copyCardChrome(node) {
162
183
  height: node.style.height,
163
184
  maxHeight: node.style.maxHeight,
164
185
  };
165
- applyCardChrome(node, node);
186
+ applyCardChrome(node, node, "computed");
166
187
  node.style.minHeight = "0px";
167
188
  node.style.height = "auto";
168
189
  node.style.maxHeight = "none";
@@ -174,7 +195,7 @@ function applyComputedStylesToClone(sourceRoot, clonedRoot) {
174
195
  sourceCards.forEach((source, index) => {
175
196
  const dest = cloneCards[index];
176
197
  if (dest) {
177
- applyCardChrome(source, dest);
198
+ applyCardChrome(source, dest, "light");
178
199
  }
179
200
  });
180
201
  const sources = sourceRoot.querySelectorAll(PADDED_CAPTURE_SELECTOR);
@@ -248,7 +269,8 @@ function prepareCaptureLayout(element) {
248
269
  }
249
270
  };
250
271
  }
251
- export async function captureChartElement(element) {
272
+ export async function captureChartElement(element, options = {}) {
273
+ const scale = options.scale ?? CHART_CAPTURE_SCALE_DEFAULT;
252
274
  const restoreHidden = revealHiddenChartAncestors(element);
253
275
  const restoreLayout = prepareCaptureLayout(element);
254
276
  element.setAttribute(CHART_EXPORT_CAPTURING_ATTR, "");
@@ -264,14 +286,21 @@ export async function captureChartElement(element) {
264
286
  }
265
287
  return html2canvas(element, {
266
288
  useCORS: true,
267
- backgroundColor: null,
289
+ backgroundColor: LIGHT_EXPORT_BACKGROUND,
268
290
  logging: false,
269
- scale: CHART_CAPTURE_SCALE,
291
+ scale,
270
292
  imageTimeout: 0,
271
293
  ignoreElements: (node) => node instanceof Element &&
272
294
  shouldIgnoreChartExportElement(node, element),
273
- onclone: (_clonedDoc, clonedElement) => {
295
+ onclone: (clonedDoc, clonedElement) => {
296
+ // Dropping the dark-theme class off the clone root makes every
297
+ // PatternFly CSS-variable surface (cards, tables, labels) resolve to
298
+ // light automatically — html2canvas reads computed styles from this
299
+ // clone. Only Victory's inlined SVG text needs explicit recoloring.
300
+ applyLightThemeToDocument(clonedDoc);
274
301
  applyComputedStylesToClone(element, clonedElement);
302
+ applyLightThemeSvgText(clonedElement);
303
+ clonedElement.style.fontFamily = EXPORT_FONT_FAMILY;
275
304
  },
276
305
  });
277
306
  }
@@ -38,8 +38,31 @@ export type ChartCaptureSource = {
38
38
  filename: string;
39
39
  capture: () => Promise<HTMLCanvasElement>;
40
40
  };
41
+ /** One label/value row rendered on a {@link PdfTextPage}. */
42
+ export type PdfTextPageItem = {
43
+ label: string;
44
+ value: string;
45
+ };
46
+ /**
47
+ * A native-text PDF page appended after the captured chart images.
48
+ *
49
+ * Used for content that is not a chart/card (e.g. calculated recommendations)
50
+ * but still needs to be part of the exported PDF.
51
+ */
52
+ export type PdfTextPage = {
53
+ title: string;
54
+ items: PdfTextPageItem[];
55
+ footer?: string;
56
+ };
41
57
  export declare function releaseCanvas(canvas: HTMLCanvasElement): void;
42
58
  export declare function waitForChartExportPaint(): Promise<void>;
59
+ /** PatternFly applies dark tokens when this class is on `:root`. */
60
+ export declare const PATTERNFLY_DARK_THEME_CLASSES: readonly ["pf-v6-theme-dark", "pf-v5-theme-dark"];
61
+ /**
62
+ * Force PatternFly light tokens on a document (the html2canvas clone).
63
+ * Does not touch the live page.
64
+ */
65
+ export declare function applyLightThemeToDocument(root: Document): void;
43
66
  export declare function chartExportViewsFromLabels(titlePrefix: string, labels: Record<string, string>): ChartExportView[];
44
67
  export declare function toBulkChartCaptureSources(charts: RegisteredChart[], capture: (element: HTMLElement) => Promise<HTMLCanvasElement>, prepareElement?: (element: HTMLElement) => () => void): ChartCaptureSource[];
45
68
  export declare function restoreChartExportViews(charts: RegisteredChart[]): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"chartExport.d.ts","sourceRoot":"","sources":["../../src/report/chartExport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAC/D,eAAO,MAAM,wBAAwB,6BAA6B,CAAC;AACnE,eAAO,MAAM,2BAA2B,yBAAyB,CAAC;AAElE,eAAO,MAAM,oBAAoB;;CAEvB,CAAC;AAEX,eAAO,MAAM,sBAAsB;;CAEzB,CAAC;AAEX,eAAO,MAAM,oBAAoB,EAAE,aAGlC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,WAAW,CAAC;IACrB,WAAW,CAAC,EAAE,eAAe,EAAE,CAAC;IAChC,kBAAkB,CAAC,EAAE,MA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AAE,eAAe,EAAE,GACxB,OAAO,CAAC,IAAI,CAAC,CAcf;AAED,wBAAgB,mCAAmC,CACjD,MAAM,EAAE,eAAe,EAAE,GACxB,eAAe,EAAE,CAcnB;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAcrE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMvD;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,SAAU,GAAG,MAAM,CAEpE;AAWD;;;;GAIG;AACH,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,OAAO,EACb,WAAW,CAAC,EAAE,OAAO,GAAG,IAAI,GAC3B,OAAO,CAeT;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAS/D"}
@@ -9,7 +9,7 @@ export const chartExportScrollProps = {
9
9
  };
10
10
  export const chartExportRootStyle = {
11
11
  width: "100%",
12
- height: "100%",
12
+ height: "auto",
13
13
  };
14
14
  export function releaseCanvas(canvas) {
15
15
  canvas.width = 0;
@@ -25,6 +25,26 @@ export function waitForChartExportPaint() {
25
25
  });
26
26
  });
27
27
  }
28
+ /** PatternFly applies dark tokens when this class is on `:root`. */
29
+ export const PATTERNFLY_DARK_THEME_CLASSES = [
30
+ "pf-v6-theme-dark",
31
+ "pf-v5-theme-dark",
32
+ ];
33
+ /**
34
+ * Force PatternFly light tokens on a document (the html2canvas clone).
35
+ * Does not touch the live page.
36
+ */
37
+ export function applyLightThemeToDocument(root) {
38
+ for (const node of [root.documentElement, root.body]) {
39
+ if (!node) {
40
+ continue;
41
+ }
42
+ for (const className of PATTERNFLY_DARK_THEME_CLASSES) {
43
+ node.classList.remove(className);
44
+ }
45
+ node.style.colorScheme = "light";
46
+ }
47
+ }
28
48
  export function chartExportViewsFromLabels(titlePrefix, labels) {
29
49
  return Object.entries(labels).map(([id, label]) => ({
30
50
  id,
@@ -1,10 +1,14 @@
1
1
  import { type RefCallback } from "react";
2
- import { type ChartExportMeta, type ChartExportView, type RegisteredChart } from "./chartExport.js";
2
+ import { type ChartExportMeta, type ChartExportView, type PdfTextPage, type RegisteredChart } from "./chartExport.js";
3
3
  export type ChartExportFormat = "pdf" | "png" | "html";
4
4
  export type ChartExportApi = {
5
5
  downloadChart: (id: string) => Promise<void>;
6
6
  downloadAll: () => Promise<void>;
7
- downloadPdf: (documentTitle: string) => Promise<void>;
7
+ /**
8
+ * @param extraPages - Native-text pages appended after the captured chart
9
+ * images (e.g. calculated recommendations that aren't rendered as charts).
10
+ */
11
+ downloadPdf: (documentTitle: string, extraPages?: PdfTextPage[]) => Promise<void>;
8
12
  downloadHtml: (documentTitle: string) => Promise<void>;
9
13
  downloadingChartId: string | null;
10
14
  exportingFormat: ChartExportFormat | null;
@@ -1 +1 @@
1
- {"version":3,"file":"chartExportContext.d.ts","sourceRoot":"","sources":["../../src/report/chartExportContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,WAAW,EAIjB,MAAM,OAAO,CAAC;AACf,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,eAAe,EAEpB,KAAK,eAAe,EACrB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;AAEvD,MAAM,MAAM,cAAc,GAAG;IAC3B,aAAa,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C,WAAW,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,WAAW,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,YAAY,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC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Height: string;
6
+ /**
7
+ * Flex child of {@link dashboardStyles.card}. `min-height: 0` lets the body
8
+ * shrink inside the card max-height; `overflow: auto` scrolls tables and tall
9
+ * charts when needed (phantom scrollbars on donut cards are avoided by the
10
+ * card layout and ChartExportSurface sizing, not a second body class).
11
+ */
6
12
  cardBodyScrollable: string;
7
13
  card: string;
8
14
  storageCardOverflowHidden: string;
@@ -1 +1 @@
1
- {"version":3,"file":"dashboardStyles.d.ts","sourceRoot":"","sources":["../../src/report/dashboardStyles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe;;;;;;;;;;;;;CAkF3B,CAAC;AAEF,eAAO,MAAM,mBAAmB,QAM/B,CAAC"}
1
+ {"version":3,"file":"dashboardStyles.d.ts","sourceRoot":"","sources":["../../src/report/dashboardStyles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe;;;;;IA8B1B;;;;;OAKG;;;;;;;;;CAkDJ,CAAC;AAEF,eAAO,MAAM,mBAAmB,QAM/B,CAAC"}
@@ -25,6 +25,12 @@ export const dashboardStyles = {
25
25
  flex: 1 1 0;
26
26
  height: 100%;
27
27
  `,
28
+ /**
29
+ * Flex child of {@link dashboardStyles.card}. `min-height: 0` lets the body
30
+ * shrink inside the card max-height; `overflow: auto` scrolls tables and tall
31
+ * charts when needed (phantom scrollbars on donut cards are avoided by the
32
+ * card layout and ChartExportSurface sizing, not a second body class).
33
+ */
28
34
  cardBodyScrollable: css `
29
35
  overflow: auto;
30
36
  `,
@@ -32,12 +38,9 @@ export const dashboardStyles = {
32
38
  // at the same specificity, which wins in the production build due to stylesheet
33
39
  // injection order. `!important` forces `hidden` regardless of that order.
34
40
  card: css `
35
- min-height: 430px;
36
- max-height: 520px;
37
- height: 100%;
41
+ height: 520px;
38
42
  display: flex;
39
43
  flex-direction: column;
40
- justify-content: space-between;
41
44
  overflow: hidden !important;
42
45
  `,
43
46
  storageCardOverflowHidden: css `
@@ -1,9 +1,11 @@
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
+ export { ClustersOverview, type ClustersOverviewProps, type InventoryDataLike, } from "./ClustersOverview.js";
6
+ export { CpuAndMemoryOverview, type CpuAndMemoryOverviewProps, } from "./CpuAndMemoryOverview.js";
5
7
  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";
8
+ 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
9
  export { type ChartExportApi, type ChartExportFormat, useChartExport, useRegisterChart, } from "./chartExportContext.js";
8
10
  export { getChartExportFilename, getChartZipFilename, getDatedChartExportBasename, } from "./chartExportFilenames.js";
9
11
  export { chartColorFailure, chartColorSuccess, REPORT_CARD_EMPTY_STATE_TITLES, } from "./constants.js";
@@ -33,10 +35,12 @@ export type { PowerStateChartModel } from "./powerStates.js";
33
35
  export { buildHostPowerStateChart, buildVmPowerStateChart, HOST_POWER_COLORS, VM_POWER_COLORS, } from "./powerStates.js";
34
36
  export { ExportReportButton, type ExportReportButtonProps, ReportExportMenu, type ReportExportMenuProps, } from "./ReportExportMenu.js";
35
37
  export { ReportTable, type ReportTableProps } from "./ReportTable.js";
36
- export { type ReportExportOption, type StandardReportExportHandlers, standardReportExportOptions, } from "./reportExportOptions.js";
38
+ export { type ReportExportOption, type ReportExportSection, type StandardReportExportHandlers, type StandardReportExportOptionsConfig, standardReportExportOptions, } from "./reportExportOptions.js";
39
+ export { type StorageDiskTierData, StorageOverview, type StorageOverviewProps, } from "./StorageOverview.js";
37
40
  export { SupportTierBadge } from "./SupportTierBadge.js";
38
41
  export { ALL_TIERS_FILTER, type OsBarChartViewModel, type OsTableRow, useOsBarChartViewModel, } from "./useOsBarChartViewModel.js";
39
42
  export { VCenterClusterDetails, type VCenterClusterDetailsProps, } from "./VCenterClusterDetails.js";
43
+ export { type IssuesBreakdownLike, VMMigrationStatus, type VMMigrationStatusProps, } from "./VMMigrationStatus.js";
40
44
  export { VmPowerStates, type VmPowerStatesProps, } from "./VmPowerStates.js";
41
45
  export { WarningsTable, type WarningsTableProps, } from "./WarningsTable.js";
42
46
  export { zipChartPngs } from "./zipChartPngs.js";
@@ -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;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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,EACL,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,GACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,oBAAoB,EACpB,KAAK,yBAAyB,GAC/B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EACL,2BAA2B,EAC3B,sBAAsB,EACtB,wBAAwB,EACxB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,0BAA0B,EAC1B,gBAAgB,EAChB,YAAY,EACZ,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,aAAa,EACb,uBAAuB,EACvB,8BAA8B,EAC9B,iBAAiB,EACjB,mCAAmC,EACnC,yBAAyB,GAC1B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,cAAc,EACd,gBAAgB,GACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,sBAAsB,EACtB,mBAAmB,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EACL,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,4BAA4B,EACjC,KAAK,iCAAiC,EACtC,2BAA2B,GAC5B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,KAAK,mBAAmB,EACxB,eAAe,EACf,KAAK,oBAAoB,GAC1B,MAAM,sBAAsB,CAAC;AAC9B,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,KAAK,mBAAmB,EACxB,iBAAiB,EACjB,KAAK,sBAAsB,GAC5B,MAAM,wBAAwB,CAAC;AAChC,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"}
@@ -2,6 +2,8 @@ export { CARD_EMPTY_STATE_DESCRIPTION, CardEmptyState, } from "./CardEmptyState.
2
2
  export { ChartDownloadButton, ChartHeaderActions, } from "./ChartDownloadButton.js";
3
3
  export { ChartExportProvider, } from "./ChartExportProvider.js";
4
4
  export { ChartExportSurface } from "./ChartExportSurface.js";
5
+ export { ClustersOverview, } from "./ClustersOverview.js";
6
+ export { CpuAndMemoryOverview, } from "./CpuAndMemoryOverview.js";
5
7
  export { captureChartElement } from "./captureChartElement.js";
6
8
  export { CHART_EXPORT_CAPTURING_ATTR, CHART_EXPORT_HIDE_ATTR, CHART_EXPORT_SCROLL_ATTR, canvasToBlob, chartExportHideProps, chartExportRootStyle, chartExportScrollProps, chartExportViewsFromLabels, chartPngFilename, downloadBlob, releaseCanvas, restoreChartExportViews, shouldIgnoreChartExportElement, slugifyExportName, sortRegisteredChartsByDocumentOrder, toBulkChartCaptureSources, } from "./chartExport.js";
7
9
  export { useChartExport, useRegisterChart, } from "./chartExportContext.js";
@@ -31,9 +33,11 @@ export { buildHostPowerStateChart, buildVmPowerStateChart, HOST_POWER_COLORS, VM
31
33
  export { ExportReportButton, ReportExportMenu, } from "./ReportExportMenu.js";
32
34
  export { ReportTable } from "./ReportTable.js";
33
35
  export { standardReportExportOptions, } from "./reportExportOptions.js";
36
+ export { StorageOverview, } from "./StorageOverview.js";
34
37
  export { SupportTierBadge } from "./SupportTierBadge.js";
35
38
  export { ALL_TIERS_FILTER, useOsBarChartViewModel, } from "./useOsBarChartViewModel.js";
36
39
  export { VCenterClusterDetails, } from "./VCenterClusterDetails.js";
40
+ export { VMMigrationStatus, } from "./VMMigrationStatus.js";
37
41
  export { VmPowerStates, } from "./VmPowerStates.js";
38
42
  export { WarningsTable, } from "./WarningsTable.js";
39
43
  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);
@@ -1,17 +1,28 @@
1
+ export interface ReportExportSection {
2
+ id: string;
3
+ label: string;
4
+ }
1
5
  export interface ReportExportOption {
2
6
  key: string;
3
7
  label: string;
4
8
  description?: string;
5
9
  onSelect: () => void;
6
10
  isDisabled?: boolean;
11
+ /** When set, the menu groups rows and shows `label` as the group heading. */
12
+ section?: ReportExportSection;
7
13
  }
8
14
  export interface StandardReportExportHandlers {
9
15
  onExportPdf?: () => void;
10
16
  onExportPng?: () => void;
11
17
  onExportHtml?: () => void;
12
18
  }
19
+ export type StandardReportExportOptionsConfig = StandardReportExportHandlers & {
20
+ /** Dropdown group label for PDF / HTML / PNG. Default: `"Assessment report"`. */
21
+ assessmentSectionLabel?: string;
22
+ };
13
23
  /**
14
- * Standard report-download actions. Omit a handler to hide that format.
24
+ * Optional helper for chart-based assessment downloads. Omit a handler to hide
25
+ * that format. Override `assessmentSectionLabel` if product copy differs per app.
15
26
  */
16
- export declare const standardReportExportOptions: ({ onExportPdf, onExportPng, onExportHtml, }: StandardReportExportHandlers) => ReportExportOption[];
27
+ export declare const standardReportExportOptions: ({ onExportPdf, onExportPng, onExportHtml, assessmentSectionLabel, }: StandardReportExportOptionsConfig) => ReportExportOption[];
17
28
  //# sourceMappingURL=reportExportOptions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reportExportOptions.d.ts","sourceRoot":"","sources":["../../src/report/reportExportOptions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,4BAA4B;IAC3C,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED;;GAEG;AACH,eAAO,MAAM,2BAA2B,GAAI,6CAIzC,4BAA4B,KAAG,kBAAkB,EA+BnD,CAAC"}
1
+ {"version":3,"file":"reportExportOptions.d.ts","sourceRoot":"","sources":["../../src/report/reportExportOptions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,6EAA6E;IAC7E,OAAO,CAAC,EAAE,mBAAmB,CAAC;CAC/B;AAED,MAAM,WAAW,4BAA4B;IAC3C,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,MAAM,MAAM,iCAAiC,GAAG,4BAA4B,GAAG;IAC7E,iFAAiF;IACjF,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC,CAAC;AAOF;;;GAGG;AACH,eAAO,MAAM,2BAA2B,GAAI,qEAKzC,iCAAiC,KAAG,kBAAkB,EAmCxD,CAAC"}
@@ -1,30 +1,38 @@
1
+ const DEFAULT_ASSESSMENT_SECTION = {
2
+ id: "assessment-report",
3
+ label: "Assessment report",
4
+ };
1
5
  /**
2
- * Standard report-download actions. Omit a handler to hide that format.
6
+ * Optional helper for chart-based assessment downloads. Omit a handler to hide
7
+ * that format. Override `assessmentSectionLabel` if product copy differs per app.
3
8
  */
4
- export const standardReportExportOptions = ({ onExportPdf, onExportPng, onExportHtml, }) => {
9
+ export const standardReportExportOptions = ({ onExportPdf, onExportPng, onExportHtml, assessmentSectionLabel, }) => {
10
+ const section = assessmentSectionLabel
11
+ ? { ...DEFAULT_ASSESSMENT_SECTION, label: assessmentSectionLabel }
12
+ : DEFAULT_ASSESSMENT_SECTION;
5
13
  const options = [];
6
14
  if (onExportPdf) {
7
15
  options.push({
8
16
  key: "pdf",
9
17
  label: "PDF",
10
- description: "Export the report as a PDF",
11
18
  onSelect: onExportPdf,
19
+ section,
12
20
  });
13
21
  }
14
22
  if (onExportHtml) {
15
23
  options.push({
16
24
  key: "html",
17
25
  label: "HTML",
18
- description: "Export the report as HTML",
19
26
  onSelect: onExportHtml,
27
+ section,
20
28
  });
21
29
  }
22
30
  if (onExportPng) {
23
31
  options.push({
24
32
  key: "png",
25
33
  label: "PNG",
26
- description: "Download all charts as PNG files",
27
34
  onSelect: onExportPng,
35
+ section,
28
36
  });
29
37
  }
30
38
  return options;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openshift-migration-advisor/shared-components",
3
- "version": "0.27.0",
3
+ "version": "0.28.0-09381b4d22e5",
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.5",
49
+ "html2canvas-pro": "^2.5.2",
50
50
  "jspdf": "^4.2.1",
51
51
  "jszip": "^3.10.2"
52
52
  }
@@ -108,6 +108,10 @@ const themedChartTooltipFlyoutPadding = {
108
108
  right: 10,
109
109
  } as const;
110
110
 
111
+ /** Victory SVG text defaults to a serif face; match PatternFly / html2canvas export. */
112
+ const chartTextFontFamily =
113
+ "RedHatText, Overpass, Helvetica, Arial, sans-serif";
114
+
111
115
  const styles = {
112
116
  legendIcon: css`
113
117
  margin-right: 4px;
@@ -136,6 +140,7 @@ const styles = {
136
140
  background: none;
137
141
  padding: var(--pf-t--global--spacer--xs) var(--pf-t--global--spacer--ml);
138
142
  margin: 0;
143
+ font-family: ${chartTextFontFamily};
139
144
  transition: opacity var(--pf-t--global--motion--duration--short);
140
145
  white-space: nowrap;
141
146
 
@@ -146,6 +151,7 @@ const styles = {
146
151
  legendLabel: css`
147
152
  gap: var(--pf-t--global--spacer--lg);
148
153
  padding: var(--pf-t--global--spacer--xs) var(--pf-t--global--spacer--ml);
154
+ font-family: ${chartTextFontFamily};
149
155
  white-space: nowrap;
150
156
  `,
151
157
  legendInner: css`
@@ -422,6 +428,7 @@ export const MigrationDonutChart: FC<MigrationDonutChartProps> = ({
422
428
  labels: {
423
429
  fontSize: labelFontSize,
424
430
  fill: "var(--pf-t--global--text--color--regular)",
431
+ fontFamily: chartTextFontFamily,
425
432
  },
426
433
  }}
427
434
  />
@@ -474,6 +481,7 @@ export const MigrationDonutChart: FC<MigrationDonutChartProps> = ({
474
481
  fill: titleColor,
475
482
  fontSize: titleFontSize,
476
483
  fontWeight: "bold",
484
+ fontFamily: chartTextFontFamily,
477
485
  },
478
486
  ]}
479
487
  />
@@ -487,6 +495,7 @@ export const MigrationDonutChart: FC<MigrationDonutChartProps> = ({
487
495
  {
488
496
  fill: subTitleColor,
489
497
  fontSize: subTitleFontSize,
498
+ fontFamily: chartTextFontFamily,
490
499
  },
491
500
  ]}
492
501
  />