@openshift-migration-advisor/shared-components 0.25.0-fce5293f01c1 → 0.27.0-5b72aa3d4938
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.
- package/dist/report/ChartExportProvider.d.ts +3 -2
- package/dist/report/ChartExportProvider.d.ts.map +1 -1
- package/dist/report/ChartExportProvider.js +3 -3
- package/dist/report/ClustersOverview.d.ts +24 -0
- package/dist/report/ClustersOverview.d.ts.map +1 -0
- package/dist/report/ClustersOverview.js +228 -0
- package/dist/report/ClustersOverviewStyles.d.ts +12 -0
- package/dist/report/ClustersOverviewStyles.d.ts.map +1 -0
- package/dist/report/ClustersOverviewStyles.js +101 -0
- package/dist/report/CpuAndMemoryOverview.d.ts +19 -0
- package/dist/report/CpuAndMemoryOverview.d.ts.map +1 -0
- package/dist/report/CpuAndMemoryOverview.js +112 -0
- package/dist/report/ErrorTable.d.ts +18 -0
- package/dist/report/ErrorTable.d.ts.map +1 -0
- package/dist/report/ErrorTable.js +20 -0
- package/dist/report/HostsOverview.d.ts +13 -0
- package/dist/report/HostsOverview.d.ts.map +1 -0
- package/dist/report/HostsOverview.js +84 -0
- package/dist/report/ReportTable.d.ts +14 -0
- package/dist/report/ReportTable.d.ts.map +1 -0
- package/dist/report/ReportTable.js +23 -0
- package/dist/report/WarningsTable.d.ts +9 -0
- package/dist/report/WarningsTable.d.ts.map +1 -0
- package/dist/report/WarningsTable.js +20 -0
- package/dist/report/captureChartElement.d.ts.map +1 -1
- package/dist/report/captureChartElement.js +28 -8
- package/dist/report/chartExport.d.ts +23 -0
- package/dist/report/chartExport.d.ts.map +1 -1
- package/dist/report/chartExport.js +20 -0
- package/dist/report/chartExportContext.d.ts +6 -2
- package/dist/report/chartExportContext.d.ts.map +1 -1
- package/dist/report/constants.d.ts +2 -0
- package/dist/report/constants.d.ts.map +1 -1
- package/dist/report/constants.js +2 -0
- package/dist/report/index.d.ts +8 -2
- package/dist/report/index.d.ts.map +1 -1
- package/dist/report/index.js +6 -0
- package/dist/report/pdfExport.d.ts +2 -2
- package/dist/report/pdfExport.d.ts.map +1 -1
- package/dist/report/pdfExport.js +52 -3
- package/package.json +2 -2
- package/src/report/ChartExportProvider.tsx +13 -5
- package/src/report/ClustersOverview.tsx +451 -0
- package/src/report/ClustersOverviewStyles.ts +110 -0
- package/src/report/CpuAndMemoryOverview.tsx +277 -0
- package/src/report/ErrorTable.tsx +85 -0
- package/src/report/HostsOverview.tsx +185 -0
- package/src/report/ReportTable.tsx +81 -0
- package/src/report/WarningsTable.tsx +75 -0
- package/src/report/__tests__/ChartExportProvider.test.tsx +110 -2
- package/src/report/__tests__/ClustersOverview.test.tsx +241 -0
- package/src/report/__tests__/CpuAndMemoryOverview.test.tsx +200 -0
- package/src/report/__tests__/HostsOverview.test.tsx +145 -0
- package/src/report/__tests__/captureChartElement.test.ts +73 -0
- package/src/report/__tests__/chartExportPackagers.test.ts +75 -0
- package/src/report/captureChartElement.ts +37 -7
- package/src/report/chartExport.ts +40 -0
- package/src/report/chartExportContext.tsx +9 -1
- package/src/report/constants.ts +2 -0
- package/src/report/index.ts +27 -0
- package/src/report/pdfExport.ts +81 -2
|
@@ -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";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
export interface ReportTableProps<DataItem> {
|
|
3
|
+
columns: string[];
|
|
4
|
+
data: DataItem[];
|
|
5
|
+
fields: Array<keyof DataItem>;
|
|
6
|
+
caption?: string;
|
|
7
|
+
onRowClick?: (item: DataItem) => void;
|
|
8
|
+
clickableFields?: Array<keyof DataItem>;
|
|
9
|
+
}
|
|
10
|
+
export declare function ReportTable<DataItem>(props: ReportTableProps<DataItem>): React.ReactNode;
|
|
11
|
+
export declare namespace ReportTable {
|
|
12
|
+
var displayName: string;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=ReportTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReportTable.d.ts","sourceRoot":"","sources":["../../src/report/ReportTable.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,WAAW,gBAAgB,CAAC,QAAQ;IACxC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,MAAM,EAAE,KAAK,CAAC,MAAM,QAAQ,CAAC,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;IACtC,eAAe,CAAC,EAAE,KAAK,CAAC,MAAM,QAAQ,CAAC,CAAC;CACzC;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAClC,KAAK,EAAE,gBAAgB,CAAC,QAAQ,CAAC,GAChC,KAAK,CAAC,SAAS,CA8DjB;yBAhEe,WAAW"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from "@patternfly/react-core";
|
|
3
|
+
import { Table, Tbody, Td, Th, Thead, Tr } from "@patternfly/react-table";
|
|
4
|
+
import { tableFullWidthStyle } from "./dashboardStyles.js";
|
|
5
|
+
export function ReportTable(props) {
|
|
6
|
+
const { columns, data, fields, caption, onRowClick, clickableFields = [], } = props;
|
|
7
|
+
const renderCell = (item, field) => {
|
|
8
|
+
const value = item[field];
|
|
9
|
+
if (value === "" || value == null) {
|
|
10
|
+
return "-";
|
|
11
|
+
}
|
|
12
|
+
if (typeof value === "boolean") {
|
|
13
|
+
return value ? "True" : "False";
|
|
14
|
+
}
|
|
15
|
+
// Make field clickable if specified
|
|
16
|
+
if (clickableFields.includes(field) && onRowClick) {
|
|
17
|
+
return (_jsx(Button, { variant: "link", isInline: true, onClick: () => onRowClick(item), style: { padding: 0, fontSize: "inherit" }, children: value }));
|
|
18
|
+
}
|
|
19
|
+
return value;
|
|
20
|
+
};
|
|
21
|
+
return (_jsxs(Table, { variant: "compact", borders: false, className: tableFullWidthStyle, children: [caption && _jsx("caption", { children: caption }), _jsx(Thead, { children: _jsx(Tr, { children: columns.map((name) => (_jsx(Th, { children: name }, name))) }) }), _jsx(Tbody, { children: data.map((item) => (_jsx(Tr, { children: fields.map((f) => (_jsx(Td, { children: renderCell(item, f) }, String(f)))) }, `row-${String(item[fields[0]])}`))) })] }));
|
|
22
|
+
}
|
|
23
|
+
ReportTable.displayName = "ReportTable";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { MigrationIssueLike } from "./ErrorTable.js";
|
|
3
|
+
export interface WarningsTableProps {
|
|
4
|
+
warnings: MigrationIssueLike[];
|
|
5
|
+
/** Optional drill-down callback invoked with an issue's `label`. */
|
|
6
|
+
onConcernClick?: (concernLabel: string) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const WarningsTable: React.FC<WarningsTableProps>;
|
|
9
|
+
//# sourceMappingURL=WarningsTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WarningsTable.d.ts","sourceRoot":"","sources":["../../src/report/WarningsTable.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAG1D,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,kBAAkB,EAAE,CAAC;IAC/B,oEAAoE;IACpE,cAAc,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;CACjD;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAgDtD,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 { ExclamationTriangleIcon } 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 WarningsTable = ({ warnings, onConcernClick, }) => {
|
|
11
|
+
const handleRowClick = (issue) => {
|
|
12
|
+
if (issue.label && onConcernClick) {
|
|
13
|
+
onConcernClick(issue.label);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
const chartId = "warnings-table";
|
|
17
|
+
const chartTitle = "Warnings";
|
|
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: "warning", children: _jsx(ExclamationTriangleIcon, {}) }), " ", "Warnings"] }), _jsx(ChartHeaderActions, { chartId: chartId, title: chartTitle })] }) }), _jsx(CardBody, { className: dashboardStyles.cardBodyScrollable, children: warnings.length === 0 ? (_jsx(CardEmptyState, { title: REPORT_CARD_EMPTY_STATE_TITLES.warnings })) : (_jsx("div", { children: _jsx(ReportTable, { data: warnings, columns: ["Description", "Total VMs"], fields: ["assessment", "count"], onRowClick: onConcernClick ? handleRowClick : undefined, clickableFields: onConcernClick ? ["assessment"] : [] }) })) })] }) }));
|
|
19
|
+
};
|
|
20
|
+
WarningsTable.displayName = "WarningsTable";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"captureChartElement.d.ts","sourceRoot":"","sources":["../../src/report/captureChartElement.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"captureChartElement.d.ts","sourceRoot":"","sources":["../../src/report/captureChartElement.ts"],"names":[],"mappings":"AAsCA;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,IAAI,CAqD3E;AAuQD,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,iBAAiB,CAAC,CAoC5B"}
|
|
@@ -1,5 +1,6 @@
|
|
|
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
|
+
import { applyLightThemeToDocument, CHART_EXPORT_CAPTURING_ATTR, CHART_EXPORT_SCROLL_ATTR, shouldIgnoreChartExportElement, } from "./chartExport.js";
|
|
3
4
|
/** CSS-pixel scale; 2x made zip-all of ~15 live cards too slow. */
|
|
4
5
|
const CHART_CAPTURE_SCALE = 1;
|
|
5
6
|
const HIDDEN_LAYOUT_STYLE_KEYS = [
|
|
@@ -71,6 +72,10 @@ export function revealHiddenChartAncestors(element) {
|
|
|
71
72
|
const PADDED_CAPTURE_SELECTOR = ".pf-v6-c-card__title, .pf-v6-c-card__header, .pf-v6-c-card__body";
|
|
72
73
|
const CARD_CAPTURE_SELECTOR = ".pf-v6-c-card";
|
|
73
74
|
const TRANSPARENT_FILLS = new Set(["", "transparent", "rgba(0, 0, 0, 0)"]);
|
|
75
|
+
/** PatternFly light-theme chrome. html2canvas inlines live computed SVG styles. */
|
|
76
|
+
const LIGHT_EXPORT_BACKGROUND = t_color_white.value;
|
|
77
|
+
const LIGHT_EXPORT_BORDER = t_color_gray_20.value;
|
|
78
|
+
const LIGHT_EXPORT_TEXT = t_global_text_color_regular.value;
|
|
74
79
|
function queryCards(root) {
|
|
75
80
|
const cards = Array.from(root.querySelectorAll(CARD_CAPTURE_SELECTOR));
|
|
76
81
|
if (root.matches(CARD_CAPTURE_SELECTOR)) {
|
|
@@ -112,16 +117,29 @@ function readCardBorder(source) {
|
|
|
112
117
|
}
|
|
113
118
|
return { width, style, color };
|
|
114
119
|
}
|
|
115
|
-
function applyCardChrome(source, dest) {
|
|
120
|
+
function applyCardChrome(source, dest, colors) {
|
|
116
121
|
const computed = window.getComputedStyle(source);
|
|
117
122
|
dest.style.borderRadius = computed.borderRadius;
|
|
118
|
-
dest.style.backgroundColor = resolvedFill(computed.backgroundColor);
|
|
119
123
|
dest.style.overflow = "hidden";
|
|
124
|
+
dest.style.backgroundColor =
|
|
125
|
+
colors === "light"
|
|
126
|
+
? LIGHT_EXPORT_BACKGROUND
|
|
127
|
+
: resolvedFill(computed.backgroundColor);
|
|
120
128
|
const border = readCardBorder(source);
|
|
121
129
|
if (border) {
|
|
122
130
|
dest.style.borderWidth = border.width;
|
|
123
131
|
dest.style.borderStyle = border.style;
|
|
124
|
-
dest.style.borderColor =
|
|
132
|
+
dest.style.borderColor =
|
|
133
|
+
colors === "light" ? LIGHT_EXPORT_BORDER : border.color;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
function applyLightThemeSvgText(root) {
|
|
137
|
+
for (const node of root.querySelectorAll("text, tspan")) {
|
|
138
|
+
if (!(node instanceof SVGElement)) {
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
node.style.fill = LIGHT_EXPORT_TEXT;
|
|
142
|
+
node.style.color = LIGHT_EXPORT_TEXT;
|
|
125
143
|
}
|
|
126
144
|
}
|
|
127
145
|
function hideCardBeforePseudo() {
|
|
@@ -162,7 +180,7 @@ function copyCardChrome(node) {
|
|
|
162
180
|
height: node.style.height,
|
|
163
181
|
maxHeight: node.style.maxHeight,
|
|
164
182
|
};
|
|
165
|
-
applyCardChrome(node, node);
|
|
183
|
+
applyCardChrome(node, node, "computed");
|
|
166
184
|
node.style.minHeight = "0px";
|
|
167
185
|
node.style.height = "auto";
|
|
168
186
|
node.style.maxHeight = "none";
|
|
@@ -174,7 +192,7 @@ function applyComputedStylesToClone(sourceRoot, clonedRoot) {
|
|
|
174
192
|
sourceCards.forEach((source, index) => {
|
|
175
193
|
const dest = cloneCards[index];
|
|
176
194
|
if (dest) {
|
|
177
|
-
applyCardChrome(source, dest);
|
|
195
|
+
applyCardChrome(source, dest, "light");
|
|
178
196
|
}
|
|
179
197
|
});
|
|
180
198
|
const sources = sourceRoot.querySelectorAll(PADDED_CAPTURE_SELECTOR);
|
|
@@ -264,14 +282,16 @@ export async function captureChartElement(element) {
|
|
|
264
282
|
}
|
|
265
283
|
return html2canvas(element, {
|
|
266
284
|
useCORS: true,
|
|
267
|
-
backgroundColor:
|
|
285
|
+
backgroundColor: LIGHT_EXPORT_BACKGROUND,
|
|
268
286
|
logging: false,
|
|
269
287
|
scale: CHART_CAPTURE_SCALE,
|
|
270
288
|
imageTimeout: 0,
|
|
271
289
|
ignoreElements: (node) => node instanceof Element &&
|
|
272
290
|
shouldIgnoreChartExportElement(node, element),
|
|
273
|
-
onclone: (
|
|
291
|
+
onclone: (clonedDoc, clonedElement) => {
|
|
292
|
+
applyLightThemeToDocument(clonedDoc);
|
|
274
293
|
applyComputedStylesToClone(element, clonedElement);
|
|
294
|
+
applyLightThemeSvgText(clonedElement);
|
|
275
295
|
},
|
|
276
296
|
});
|
|
277
297
|
}
|
|
@@ -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,E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cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,MAAM,IAAI,GACpD,kBAAkB,EAAE,CAyBtB;AAED,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,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"}
|
|
@@ -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
|
-
|
|
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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AqB,gDAA6C,CAAC;AAEhF,wBAAgB,cAAc,IAAI,cAAc,GAAG,IAAI,CAEtD;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,EAAE,EACF,KAAK,EACL,QAAQ,EACR,WAAW,EACX,kBAAkB,EAClB,aAAa,GACd,EAAE,eAAe,GAAG;IACnB,WAAW,CAAC,EAAE,eAAe,EAAE,CAAC;IAChC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACnD,GAAG,WAAW,CAAC,WAAW,CAAC,CA8B3B"}
|
|
@@ -19,6 +19,8 @@ export declare const REPORT_CARD_EMPTY_STATE_TITLES: {
|
|
|
19
19
|
readonly operatingSystems: "Operating system data not collected";
|
|
20
20
|
readonly migrationStatus: "Migration status data not collected";
|
|
21
21
|
readonly issuesBreakdown: "Issues breakdown data not collected";
|
|
22
|
+
readonly errors: "Error data not collected";
|
|
23
|
+
readonly warnings: "Warning data not collected";
|
|
22
24
|
readonly hostPowerStates: "Host power state data not collected";
|
|
23
25
|
readonly vmPowerStates: "VM power state data not collected";
|
|
24
26
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/report/constants.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,WAA6B,CAAC;AAC5D,eAAO,MAAM,iBAAiB,WAA+B,CAAC;AAE9D,eAAO,MAAM,8BAA8B
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/report/constants.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,WAA6B,CAAC;AAC5D,eAAO,MAAM,iBAAiB,WAA+B,CAAC;AAE9D,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;CAkBjC,CAAC"}
|
package/dist/report/constants.js
CHANGED
|
@@ -20,6 +20,8 @@ export const REPORT_CARD_EMPTY_STATE_TITLES = {
|
|
|
20
20
|
operatingSystems: "Operating system data not collected",
|
|
21
21
|
migrationStatus: "Migration status data not collected",
|
|
22
22
|
issuesBreakdown: "Issues breakdown data not collected",
|
|
23
|
+
errors: "Error data not collected",
|
|
24
|
+
warnings: "Warning data not collected",
|
|
23
25
|
hostPowerStates: "Host power state data not collected",
|
|
24
26
|
vmPowerStates: "VM power state data not collected",
|
|
25
27
|
};
|
package/dist/report/index.d.ts
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
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";
|
|
10
12
|
export { DashboardEmptyStateBase, type DashboardEmptyStateBaseProps, } from "./DashboardEmptyStateBase.js";
|
|
11
13
|
export { dashboardStyles, tableFullWidthStyle } from "./dashboardStyles.js";
|
|
12
14
|
export { EmptySearchResults, type EmptySearchResultsProps, } from "./EmptySearchResults.js";
|
|
15
|
+
export { ErrorTable, type ErrorTableProps, type MigrationIssueLike, } from "./ErrorTable.js";
|
|
13
16
|
export { FeatureStatusBadge, type FeatureStatusBadgeProps, } from "./FeatureStatusBadge.js";
|
|
14
17
|
export { HostPowerStates, type HostPowerStatesProps, } from "./HostPowerStates.js";
|
|
18
|
+
export { type HostLike, HostsOverview, type HostsOverviewProps, } from "./HostsOverview.js";
|
|
15
19
|
export { buildHtmlFromCharts, buildHtmlReport, escapeHtml, type HtmlReportImage, } from "./htmlExport.js";
|
|
16
20
|
export { InfrastructureSummary, type InfrastructureSummaryProps, } from "./InfrastructureSummary.js";
|
|
17
21
|
export type { ClusterDetailRow, ClusterDetailsModel, FeatureStatus, HostCapability, InfrastructureSummaryModel, InventoryCluster, InventoryDatastore, InventoryHost, InventoryInfra, InventoryNetwork, InventoryVms, NetworkLabel, } from "./infrastructureSummaryModel.js";
|
|
@@ -30,10 +34,12 @@ export { type PdfExportSegment, sliceCanvas, splitSegmentForPageHeight, } from "
|
|
|
30
34
|
export type { PowerStateChartModel } from "./powerStates.js";
|
|
31
35
|
export { buildHostPowerStateChart, buildVmPowerStateChart, HOST_POWER_COLORS, VM_POWER_COLORS, } from "./powerStates.js";
|
|
32
36
|
export { ExportReportButton, type ExportReportButtonProps, ReportExportMenu, type ReportExportMenuProps, } from "./ReportExportMenu.js";
|
|
37
|
+
export { ReportTable, type ReportTableProps } from "./ReportTable.js";
|
|
33
38
|
export { type ReportExportOption, type StandardReportExportHandlers, standardReportExportOptions, } from "./reportExportOptions.js";
|
|
34
39
|
export { SupportTierBadge } from "./SupportTierBadge.js";
|
|
35
40
|
export { ALL_TIERS_FILTER, type OsBarChartViewModel, type OsTableRow, useOsBarChartViewModel, } from "./useOsBarChartViewModel.js";
|
|
36
41
|
export { VCenterClusterDetails, type VCenterClusterDetailsProps, } from "./VCenterClusterDetails.js";
|
|
37
42
|
export { VmPowerStates, type VmPowerStatesProps, } from "./VmPowerStates.js";
|
|
43
|
+
export { WarningsTable, type WarningsTableProps, } from "./WarningsTable.js";
|
|
38
44
|
export { zipChartPngs } from "./zipChartPngs.js";
|
|
39
45
|
//# 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,KAAK,mBAAmB,EACxB,mBAAmB,EACnB,KAA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mB,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,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,KA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B,OAAO,EACL,aAAa,EACb,KAAK,kBAAkB,GACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/report/index.js
CHANGED
|
@@ -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";
|
|
@@ -10,8 +12,10 @@ export { chartColorFailure, chartColorSuccess, REPORT_CARD_EMPTY_STATE_TITLES, }
|
|
|
10
12
|
export { DashboardEmptyStateBase, } from "./DashboardEmptyStateBase.js";
|
|
11
13
|
export { dashboardStyles, tableFullWidthStyle } from "./dashboardStyles.js";
|
|
12
14
|
export { EmptySearchResults, } from "./EmptySearchResults.js";
|
|
15
|
+
export { ErrorTable, } from "./ErrorTable.js";
|
|
13
16
|
export { FeatureStatusBadge, } from "./FeatureStatusBadge.js";
|
|
14
17
|
export { HostPowerStates, } from "./HostPowerStates.js";
|
|
18
|
+
export { HostsOverview, } from "./HostsOverview.js";
|
|
15
19
|
export { buildHtmlFromCharts, buildHtmlReport, escapeHtml, } from "./htmlExport.js";
|
|
16
20
|
export { InfrastructureSummary, } from "./InfrastructureSummary.js";
|
|
17
21
|
export { booleanToFeatureStatus, buildClusterDetailRows, buildClusterDetails, buildInfrastructureSummary, countVCenters, formatVSphereVersion, hostCapabilityStatus, visibleNetworks, vsanStatus, } from "./infrastructureSummaryModel.js";
|
|
@@ -27,9 +31,11 @@ export { buildPdfFromCharts } from "./pdfExport.js";
|
|
|
27
31
|
export { sliceCanvas, splitSegmentForPageHeight, } from "./pdfPage.js";
|
|
28
32
|
export { buildHostPowerStateChart, buildVmPowerStateChart, HOST_POWER_COLORS, VM_POWER_COLORS, } from "./powerStates.js";
|
|
29
33
|
export { ExportReportButton, ReportExportMenu, } from "./ReportExportMenu.js";
|
|
34
|
+
export { ReportTable } from "./ReportTable.js";
|
|
30
35
|
export { standardReportExportOptions, } from "./reportExportOptions.js";
|
|
31
36
|
export { SupportTierBadge } from "./SupportTierBadge.js";
|
|
32
37
|
export { ALL_TIERS_FILTER, useOsBarChartViewModel, } from "./useOsBarChartViewModel.js";
|
|
33
38
|
export { VCenterClusterDetails, } from "./VCenterClusterDetails.js";
|
|
34
39
|
export { VmPowerStates, } from "./VmPowerStates.js";
|
|
40
|
+
export { WarningsTable, } from "./WarningsTable.js";
|
|
35
41
|
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,
|
|
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"}
|
package/dist/report/pdfExport.js
CHANGED
|
@@ -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.
|
|
3
|
+
"version": "0.27.0-5b72aa3d4938",
|
|
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.
|
|
49
|
+
"html2canvas-pro": "^2.5.0",
|
|
50
50
|
"jspdf": "^4.2.1",
|
|
51
51
|
"jszip": "^3.10.2"
|
|
52
52
|
}
|