@openshift-migration-advisor/shared-components 0.23.0 → 0.25.0-6a4104ca5ed2
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/README.md +31 -0
- package/dist/charts/index.d.ts +1 -1
- package/dist/charts/index.d.ts.map +1 -1
- package/dist/forms/RadioButtonFormGroup.d.ts.map +1 -1
- package/dist/forms/RadioButtonFormGroup.js +2 -2
- package/dist/report/ChartDownloadButton.d.ts +11 -0
- package/dist/report/ChartDownloadButton.d.ts.map +1 -0
- package/dist/report/ChartDownloadButton.js +24 -0
- package/dist/report/ChartExportProvider.d.ts +22 -0
- package/dist/report/ChartExportProvider.d.ts.map +1 -0
- package/dist/report/ChartExportProvider.js +222 -0
- package/dist/report/ChartExportSurface.d.ts +12 -0
- package/dist/report/ChartExportSurface.d.ts.map +1 -0
- package/dist/report/ChartExportSurface.js +32 -0
- package/dist/report/FeatureStatusBadge.d.ts +7 -0
- package/dist/report/FeatureStatusBadge.d.ts.map +1 -0
- package/dist/report/FeatureStatusBadge.js +13 -0
- package/dist/report/HostPowerStates.d.ts +8 -0
- package/dist/report/HostPowerStates.d.ts.map +1 -0
- package/dist/report/HostPowerStates.js +11 -0
- package/dist/report/InfrastructureSummary.d.ts +7 -0
- package/dist/report/InfrastructureSummary.d.ts.map +1 -0
- package/dist/report/InfrastructureSummary.js +9 -0
- package/dist/report/OSDistribution.d.ts +0 -2
- package/dist/report/OSDistribution.d.ts.map +1 -1
- package/dist/report/OSDistribution.js +10 -15
- package/dist/report/OsSupportTiersHelpPopover.d.ts.map +1 -1
- package/dist/report/OsSupportTiersHelpPopover.js +2 -31
- package/dist/report/OsUpgradeNotice.d.ts.map +1 -1
- package/dist/report/OsUpgradeNotice.js +1 -5
- package/dist/report/OsUpgradeRecommendationPopover.d.ts +0 -1
- package/dist/report/OsUpgradeRecommendationPopover.d.ts.map +1 -1
- package/dist/report/OsUpgradeRecommendationPopover.js +4 -3
- package/dist/report/PowerStateCard.d.ts +16 -0
- package/dist/report/PowerStateCard.d.ts.map +1 -0
- package/dist/report/PowerStateCard.js +9 -0
- package/dist/report/ReportExportMenu.d.ts +19 -0
- package/dist/report/ReportExportMenu.d.ts.map +1 -0
- package/dist/report/ReportExportMenu.js +31 -0
- package/dist/report/SupportTierBadge.d.ts +0 -1
- package/dist/report/SupportTierBadge.d.ts.map +1 -1
- package/dist/report/SupportTierBadge.js +1 -19
- package/dist/report/VCenterClusterDetails.d.ts +9 -0
- package/dist/report/VCenterClusterDetails.d.ts.map +1 -0
- package/dist/report/VCenterClusterDetails.js +31 -0
- package/dist/report/VmPowerStates.d.ts +8 -0
- package/dist/report/VmPowerStates.d.ts.map +1 -0
- package/dist/report/VmPowerStates.js +11 -0
- package/dist/report/captureChartElement.d.ts +8 -0
- package/dist/report/captureChartElement.d.ts.map +1 -0
- package/dist/report/captureChartElement.js +264 -0
- package/dist/report/chartExport.d.ts +57 -0
- package/dist/report/chartExport.d.ts.map +1 -0
- package/dist/report/chartExport.js +159 -0
- package/dist/report/chartExportContext.d.ts +28 -0
- package/dist/report/chartExportContext.d.ts.map +1 -0
- package/dist/report/chartExportContext.js +36 -0
- package/dist/report/chartExportFilenames.d.ts +4 -0
- package/dist/report/chartExportFilenames.d.ts.map +1 -0
- package/dist/report/chartExportFilenames.js +16 -0
- 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/dashboardStyles.d.ts +0 -4
- package/dist/report/dashboardStyles.d.ts.map +1 -1
- package/dist/report/dashboardStyles.js +0 -19
- package/dist/report/htmlExport.d.ts +9 -0
- package/dist/report/htmlExport.d.ts.map +1 -0
- package/dist/report/htmlExport.js +67 -0
- package/dist/report/index.d.ts +23 -0
- package/dist/report/index.d.ts.map +1 -1
- package/dist/report/index.js +21 -0
- package/dist/report/infrastructureSummaryModel.d.ts +82 -0
- package/dist/report/infrastructureSummaryModel.d.ts.map +1 -0
- package/dist/report/infrastructureSummaryModel.js +139 -0
- package/dist/report/pdfExport.d.ts +3 -0
- package/dist/report/pdfExport.d.ts.map +1 -0
- package/dist/report/pdfExport.js +87 -0
- package/dist/report/pdfPage.d.ts +7 -0
- package/dist/report/pdfPage.d.ts.map +1 -0
- package/dist/report/pdfPage.js +27 -0
- package/dist/report/powerStates.d.ts +11 -0
- package/dist/report/powerStates.d.ts.map +1 -0
- package/dist/report/powerStates.js +113 -0
- package/dist/report/reportExportOptions.d.ts +17 -0
- package/dist/report/reportExportOptions.d.ts.map +1 -0
- package/dist/report/reportExportOptions.js +31 -0
- package/dist/report/zipChartPngs.d.ts +3 -0
- package/dist/report/zipChartPngs.d.ts.map +1 -0
- package/dist/report/zipChartPngs.js +8 -0
- package/package.json +7 -2
- package/src/charts/index.ts +1 -0
- package/src/forms/RadioButtonFormGroup.tsx +10 -3
- package/src/report/ChartDownloadButton.tsx +59 -0
- package/src/report/ChartExportProvider.tsx +384 -0
- package/src/report/ChartExportSurface.tsx +60 -0
- package/src/report/FeatureStatusBadge.tsx +30 -0
- package/src/report/HostPowerStates.tsx +38 -0
- package/src/report/InfrastructureSummary.tsx +73 -0
- package/src/report/OSDistribution.tsx +96 -99
- package/src/report/OsSupportTiersHelpPopover.tsx +32 -62
- package/src/report/OsUpgradeNotice.tsx +1 -7
- package/src/report/OsUpgradeRecommendationPopover.tsx +3 -4
- package/src/report/PowerStateCard.tsx +86 -0
- package/src/report/ReportExportMenu.tsx +119 -0
- package/src/report/SupportTierBadge.tsx +12 -38
- package/src/report/VCenterClusterDetails.tsx +233 -0
- package/src/report/VmPowerStates.tsx +38 -0
- package/src/report/__tests__/ChartExportProvider.test.tsx +474 -0
- package/src/report/__tests__/HostPowerStates.test.tsx +47 -0
- package/src/report/__tests__/InfrastructureSummary.test.tsx +126 -0
- package/src/report/__tests__/OSDistribution.test.tsx +10 -11
- package/src/report/__tests__/captureChartElement.test.ts +132 -0
- package/src/report/__tests__/chartExportPackagers.test.ts +185 -0
- package/src/report/__tests__/infrastructureSummaryModel.test.ts +224 -0
- package/src/report/__tests__/powerStates.test.ts +70 -0
- package/src/report/captureChartElement.ts +351 -0
- package/src/report/chartExport.ts +234 -0
- package/src/report/chartExportContext.tsx +84 -0
- package/src/report/chartExportFilenames.ts +21 -0
- package/src/report/constants.ts +2 -0
- package/src/report/dashboardStyles.ts +0 -23
- package/src/report/htmlExport.ts +85 -0
- package/src/report/index.ts +128 -0
- package/src/report/infrastructureSummaryModel.ts +281 -0
- package/src/report/pdfExport.ts +161 -0
- package/src/report/pdfPage.ts +54 -0
- package/src/report/powerStates.ts +169 -0
- package/src/report/reportExportOptions.ts +53 -0
- package/src/report/zipChartPngs.ts +10 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
export const CHART_EXPORT_HIDE_ATTR = "data-chart-export-hide";
|
|
2
|
+
export const CHART_EXPORT_SCROLL_ATTR = "data-chart-export-scroll";
|
|
3
|
+
export const CHART_EXPORT_CAPTURING_ATTR = "data-chart-capturing";
|
|
4
|
+
export const chartExportHideProps = {
|
|
5
|
+
[CHART_EXPORT_HIDE_ATTR]: "",
|
|
6
|
+
};
|
|
7
|
+
export const chartExportScrollProps = {
|
|
8
|
+
[CHART_EXPORT_SCROLL_ATTR]: "",
|
|
9
|
+
};
|
|
10
|
+
export const chartExportRootStyle = { height: "100%" };
|
|
11
|
+
export function releaseCanvas(canvas) {
|
|
12
|
+
canvas.width = 0;
|
|
13
|
+
canvas.height = 0;
|
|
14
|
+
}
|
|
15
|
+
export function waitForChartExportPaint() {
|
|
16
|
+
if (typeof requestAnimationFrame !== "function") {
|
|
17
|
+
return Promise.resolve();
|
|
18
|
+
}
|
|
19
|
+
return new Promise((resolve) => {
|
|
20
|
+
requestAnimationFrame(() => {
|
|
21
|
+
requestAnimationFrame(() => resolve());
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export function chartExportViewsFromLabels(titlePrefix, labels) {
|
|
26
|
+
return Object.entries(labels).map(([id, label]) => ({
|
|
27
|
+
id,
|
|
28
|
+
title: `${titlePrefix} — ${label}`,
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
function shouldCycleExportViews(chart) {
|
|
32
|
+
return Boolean(chart.exportViews && chart.exportViews.length > 1 && chart.setExportView);
|
|
33
|
+
}
|
|
34
|
+
function bulkExportViews(chart) {
|
|
35
|
+
if (shouldCycleExportViews(chart) && chart.exportViews) {
|
|
36
|
+
return chart.exportViews;
|
|
37
|
+
}
|
|
38
|
+
return [
|
|
39
|
+
{
|
|
40
|
+
id: chart.id,
|
|
41
|
+
title: chart.title,
|
|
42
|
+
filename: chart.filename,
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
export function toBulkChartCaptureSources(charts, capture, prepareElement) {
|
|
47
|
+
return charts.flatMap((chart) => {
|
|
48
|
+
const views = bulkExportViews(chart);
|
|
49
|
+
const cyclesViews = shouldCycleExportViews(chart);
|
|
50
|
+
return views.map((view) => ({
|
|
51
|
+
id: cyclesViews ? `${chart.id}--${view.id}` : chart.id,
|
|
52
|
+
title: view.title,
|
|
53
|
+
filename: view.filename ??
|
|
54
|
+
(cyclesViews
|
|
55
|
+
? chartPngFilename(view.title, `${chart.id}-${view.id}`)
|
|
56
|
+
: chart.filename),
|
|
57
|
+
capture: async () => {
|
|
58
|
+
const restore = prepareElement?.(chart.element);
|
|
59
|
+
try {
|
|
60
|
+
if (cyclesViews && chart.setExportView) {
|
|
61
|
+
await chart.setExportView(view.id);
|
|
62
|
+
}
|
|
63
|
+
return await capture(chart.element);
|
|
64
|
+
}
|
|
65
|
+
finally {
|
|
66
|
+
restore?.();
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
}));
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
export async function restoreChartExportViews(charts) {
|
|
73
|
+
for (const chart of charts) {
|
|
74
|
+
if (shouldCycleExportViews(chart) &&
|
|
75
|
+
chart.setExportView &&
|
|
76
|
+
chart.activeExportViewId) {
|
|
77
|
+
try {
|
|
78
|
+
await chart.setExportView(chart.activeExportViewId);
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
console.error("Failed to restore the selected chart view:", error);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
export function sortRegisteredChartsByDocumentOrder(charts) {
|
|
87
|
+
return [...charts].sort((left, right) => {
|
|
88
|
+
if (left.element === right.element) {
|
|
89
|
+
return 0;
|
|
90
|
+
}
|
|
91
|
+
const position = left.element.compareDocumentPosition(right.element);
|
|
92
|
+
if (position & Node.DOCUMENT_POSITION_FOLLOWING) {
|
|
93
|
+
return -1;
|
|
94
|
+
}
|
|
95
|
+
if (position & Node.DOCUMENT_POSITION_PRECEDING) {
|
|
96
|
+
return 1;
|
|
97
|
+
}
|
|
98
|
+
return 0;
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
export function canvasToBlob(canvas) {
|
|
102
|
+
return new Promise((resolve, reject) => {
|
|
103
|
+
if (canvas.width < 1 || canvas.height < 1) {
|
|
104
|
+
reject(new Error("Failed to encode canvas as PNG"));
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
canvas.toBlob((blob) => {
|
|
108
|
+
if (blob) {
|
|
109
|
+
resolve(blob);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
reject(new Error("Failed to encode canvas as PNG"));
|
|
113
|
+
}, "image/png");
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
export function slugifyExportName(value) {
|
|
117
|
+
const slug = value
|
|
118
|
+
.toLowerCase()
|
|
119
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
120
|
+
.replace(/^-|-$/g, "");
|
|
121
|
+
return slug || "chart";
|
|
122
|
+
}
|
|
123
|
+
export function chartPngFilename(title, id = "chart") {
|
|
124
|
+
return `${slugifyExportName(title) || slugifyExportName(id)}.png`;
|
|
125
|
+
}
|
|
126
|
+
const KEEP_TAGS = new Set(["HTML", "HEAD", "BODY", "STYLE", "LINK"]);
|
|
127
|
+
function isHiddenForChartExport(node) {
|
|
128
|
+
return (node.hasAttribute(CHART_EXPORT_HIDE_ATTR) ||
|
|
129
|
+
Boolean(node.closest(`[${CHART_EXPORT_HIDE_ATTR}]`)));
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* html2canvas clones the whole document for every capture. Ignore everything
|
|
133
|
+
* except the target card (and ancestors / stylesheet nodes) so zip-all does
|
|
134
|
+
* not re-render every other chart.
|
|
135
|
+
*/
|
|
136
|
+
export function shouldIgnoreChartExportElement(node, captureRoot) {
|
|
137
|
+
if (!captureRoot) {
|
|
138
|
+
return isHiddenForChartExport(node);
|
|
139
|
+
}
|
|
140
|
+
if (KEEP_TAGS.has(node.tagName)) {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
if (node !== captureRoot &&
|
|
144
|
+
!captureRoot.contains(node) &&
|
|
145
|
+
!node.contains(captureRoot)) {
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
return isHiddenForChartExport(node);
|
|
149
|
+
}
|
|
150
|
+
export function downloadBlob(blob, filename) {
|
|
151
|
+
const url = URL.createObjectURL(blob);
|
|
152
|
+
const link = document.createElement("a");
|
|
153
|
+
link.href = url;
|
|
154
|
+
link.download = filename;
|
|
155
|
+
document.body.appendChild(link);
|
|
156
|
+
link.click();
|
|
157
|
+
document.body.removeChild(link);
|
|
158
|
+
URL.revokeObjectURL(url);
|
|
159
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type RefCallback } from "react";
|
|
2
|
+
import { type ChartExportMeta, type ChartExportView, type RegisteredChart } from "./chartExport.js";
|
|
3
|
+
export type ChartExportFormat = "pdf" | "png" | "html";
|
|
4
|
+
export type ChartExportApi = {
|
|
5
|
+
downloadChart: (id: string) => Promise<void>;
|
|
6
|
+
downloadAll: () => Promise<void>;
|
|
7
|
+
downloadPdf: (documentTitle: string) => Promise<void>;
|
|
8
|
+
downloadHtml: (documentTitle: string) => Promise<void>;
|
|
9
|
+
downloadingChartId: string | null;
|
|
10
|
+
exportingFormat: ChartExportFormat | null;
|
|
11
|
+
exportLoadingLabel: string | null;
|
|
12
|
+
isExportingAll: boolean;
|
|
13
|
+
isBusy: boolean;
|
|
14
|
+
exportError: string | null;
|
|
15
|
+
clearExportError: () => void;
|
|
16
|
+
};
|
|
17
|
+
export type ChartExportRegistry = {
|
|
18
|
+
register: (chart: RegisteredChart) => () => void;
|
|
19
|
+
};
|
|
20
|
+
export declare const ChartExportRegistryContext: import("react").Context<ChartExportRegistry | null>;
|
|
21
|
+
export declare const ChartExportApiContext: import("react").Context<ChartExportApi | null>;
|
|
22
|
+
export declare function useChartExport(): ChartExportApi | null;
|
|
23
|
+
export declare function useRegisterChart({ id, title, filename, exportViews, activeExportViewId, setExportView, }: ChartExportMeta & {
|
|
24
|
+
exportViews?: ChartExportView[];
|
|
25
|
+
activeExportViewId?: string;
|
|
26
|
+
setExportView?: (viewId: string) => Promise<void>;
|
|
27
|
+
}): RefCallback<HTMLElement>;
|
|
28
|
+
//# sourceMappingURL=chartExportContext.d.ts.map
|
|
@@ -0,0 +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;IAClC,eAAe,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAC1C,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,cAAc,EAAE,OAAO,CAAC;IACxB,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,gBAAgB,EAAE,MAAM,IAAI,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,MAAM,IAAI,CAAC;CAClD,CAAC;AAEF,eAAO,MAAM,0BAA0B,qDACU,CAAC;AAClD,eAAO,MAAM,qBAAqB,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"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { createContext, useContext, useEffect, useState, } from "react";
|
|
2
|
+
import { chartPngFilename, } from "./chartExport.js";
|
|
3
|
+
export const ChartExportRegistryContext = createContext(null);
|
|
4
|
+
export const ChartExportApiContext = createContext(null);
|
|
5
|
+
export function useChartExport() {
|
|
6
|
+
return useContext(ChartExportApiContext);
|
|
7
|
+
}
|
|
8
|
+
export function useRegisterChart({ id, title, filename, exportViews, activeExportViewId, setExportView, }) {
|
|
9
|
+
const registry = useContext(ChartExportRegistryContext);
|
|
10
|
+
const [element, setElement] = useState(null);
|
|
11
|
+
const resolvedFilename = filename ?? chartPngFilename(title, id);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (!registry || !element) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
return registry.register({
|
|
17
|
+
id,
|
|
18
|
+
title,
|
|
19
|
+
filename: resolvedFilename,
|
|
20
|
+
element,
|
|
21
|
+
exportViews,
|
|
22
|
+
activeExportViewId,
|
|
23
|
+
setExportView,
|
|
24
|
+
});
|
|
25
|
+
}, [
|
|
26
|
+
activeExportViewId,
|
|
27
|
+
element,
|
|
28
|
+
exportViews,
|
|
29
|
+
id,
|
|
30
|
+
registry,
|
|
31
|
+
resolvedFilename,
|
|
32
|
+
setExportView,
|
|
33
|
+
title,
|
|
34
|
+
]);
|
|
35
|
+
return setElement;
|
|
36
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function getDatedChartExportBasename(date?: Date): string;
|
|
2
|
+
export declare function getChartExportFilename(format: "pdf" | "html" | "zip", date?: Date): string;
|
|
3
|
+
export declare function getChartZipFilename(date?: Date): string;
|
|
4
|
+
//# sourceMappingURL=chartExportFilenames.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chartExportFilenames.d.ts","sourceRoot":"","sources":["../../src/report/chartExportFilenames.ts"],"names":[],"mappings":"AAAA,wBAAgB,2BAA2B,CAAC,IAAI,OAAa,GAAG,MAAM,CAKrE;AAED,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,EAC9B,IAAI,OAAa,GAChB,MAAM,CAMR;AAED,wBAAgB,mBAAmB,CAAC,IAAI,OAAa,GAAG,MAAM,CAE7D"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function getDatedChartExportBasename(date = new Date()) {
|
|
2
|
+
const year = date.getFullYear();
|
|
3
|
+
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
4
|
+
const day = String(date.getDate()).padStart(2, "0");
|
|
5
|
+
return `migration-export-${year}-${month}-${day}`;
|
|
6
|
+
}
|
|
7
|
+
export function getChartExportFilename(format, date = new Date()) {
|
|
8
|
+
const base = getDatedChartExportBasename(date);
|
|
9
|
+
if (format === "zip") {
|
|
10
|
+
return `${base}-charts.zip`;
|
|
11
|
+
}
|
|
12
|
+
return `${base}.${format}`;
|
|
13
|
+
}
|
|
14
|
+
export function getChartZipFilename(date = new Date()) {
|
|
15
|
+
return getChartExportFilename("zip", date);
|
|
16
|
+
}
|
|
@@ -19,5 +19,7 @@ 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 hostPowerStates: "Host power state data not collected";
|
|
23
|
+
readonly vmPowerStates: "VM power state data not collected";
|
|
22
24
|
};
|
|
23
25
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -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;;;;;;;;;;;;;;;;CAgBjC,CAAC"}
|
package/dist/report/constants.js
CHANGED
|
@@ -20,4 +20,6 @@ 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
|
+
hostPowerStates: "Host power state data not collected",
|
|
24
|
+
vmPowerStates: "VM power state data not collected",
|
|
23
25
|
};
|
|
@@ -5,12 +5,8 @@ export declare const dashboardStyles: {
|
|
|
5
5
|
equalHeight: string;
|
|
6
6
|
cardBodyScrollable: string;
|
|
7
7
|
card: string;
|
|
8
|
-
cardPrint: string;
|
|
9
8
|
storageCardOverflowHidden: string;
|
|
10
|
-
storageCardOverflowVisible: string;
|
|
11
9
|
storageChartWrapper: string;
|
|
12
|
-
storageExportSectionMargin: string;
|
|
13
|
-
storageExportSectionTitle: string;
|
|
14
10
|
storageFlexFullWidth: string;
|
|
15
11
|
storageMenuToggleMinWidth: string;
|
|
16
12
|
storageNoDataContainer: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboardStyles.d.ts","sourceRoot":"","sources":["../../src/report/dashboardStyles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe
|
|
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"}
|
|
@@ -39,20 +39,9 @@ export const dashboardStyles = {
|
|
|
39
39
|
flex-direction: column;
|
|
40
40
|
justify-content: space-between;
|
|
41
41
|
overflow: hidden !important;
|
|
42
|
-
`,
|
|
43
|
-
cardPrint: css `
|
|
44
|
-
border: 1px solid #d2d2d2 !important;
|
|
45
|
-
border-radius: 10px;
|
|
46
|
-
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
|
|
47
|
-
min-height: unset;
|
|
48
|
-
max-height: unset;
|
|
49
|
-
page-break-inside: avoid;
|
|
50
42
|
`,
|
|
51
43
|
storageCardOverflowHidden: css `
|
|
52
44
|
overflow: hidden;
|
|
53
|
-
`,
|
|
54
|
-
storageCardOverflowVisible: css `
|
|
55
|
-
overflow: visible;
|
|
56
45
|
`,
|
|
57
46
|
storageChartWrapper: css `
|
|
58
47
|
display: flex;
|
|
@@ -60,14 +49,6 @@ export const dashboardStyles = {
|
|
|
60
49
|
align-items: center;
|
|
61
50
|
width: 100%;
|
|
62
51
|
padding: 20px 0;
|
|
63
|
-
`,
|
|
64
|
-
storageExportSectionMargin: css `
|
|
65
|
-
margin-bottom: 24px;
|
|
66
|
-
`,
|
|
67
|
-
storageExportSectionTitle: css `
|
|
68
|
-
font-size: 14px;
|
|
69
|
-
font-weight: 600;
|
|
70
|
-
margin-bottom: 12px;
|
|
71
52
|
`,
|
|
72
53
|
storageFlexFullWidth: css `
|
|
73
54
|
width: 100%;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ChartCaptureSource } from "./chartExport.js";
|
|
2
|
+
export interface HtmlReportImage {
|
|
3
|
+
name: string;
|
|
4
|
+
dataUrl: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function escapeHtml(value: string): string;
|
|
7
|
+
export declare function buildHtmlReport(documentTitle: string, images: HtmlReportImage[], generatedAt?: Date): string;
|
|
8
|
+
export declare function buildHtmlFromCharts(charts: ChartCaptureSource[], documentTitle: string): Promise<Blob>;
|
|
9
|
+
//# sourceMappingURL=htmlExport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"htmlExport.d.ts","sourceRoot":"","sources":["../../src/report/htmlExport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAiB,MAAM,kBAAkB,CAAC;AAE1E,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAOhD;AAED,wBAAgB,eAAe,CAC7B,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,eAAe,EAAE,EACzB,WAAW,OAAa,GACvB,MAAM,CA0CR;AAED,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,kBAAkB,EAAE,EAC5B,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,IAAI,CAAC,CAiBf"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { releaseCanvas } from "./chartExport.js";
|
|
2
|
+
export function escapeHtml(value) {
|
|
3
|
+
return value
|
|
4
|
+
.replace(/&/g, "&")
|
|
5
|
+
.replace(/</g, "<")
|
|
6
|
+
.replace(/>/g, ">")
|
|
7
|
+
.replace(/"/g, """)
|
|
8
|
+
.replace(/'/g, "'");
|
|
9
|
+
}
|
|
10
|
+
export function buildHtmlReport(documentTitle, images, generatedAt = new Date()) {
|
|
11
|
+
const sections = images
|
|
12
|
+
.map((image) => `
|
|
13
|
+
<section>
|
|
14
|
+
<h2>${escapeHtml(image.name)}</h2>
|
|
15
|
+
<img src="${image.dataUrl}" alt="${escapeHtml(image.name)}" />
|
|
16
|
+
</section>`)
|
|
17
|
+
.join("\n");
|
|
18
|
+
return `<!DOCTYPE html>
|
|
19
|
+
<html lang="en">
|
|
20
|
+
<head>
|
|
21
|
+
<meta charset="utf-8" />
|
|
22
|
+
<title>${escapeHtml(documentTitle)}</title>
|
|
23
|
+
<style>
|
|
24
|
+
body {
|
|
25
|
+
font-family: RedHatText, Helvetica, Arial, sans-serif;
|
|
26
|
+
margin: 32px auto;
|
|
27
|
+
max-width: 1100px;
|
|
28
|
+
background: #fff;
|
|
29
|
+
color: #151515;
|
|
30
|
+
}
|
|
31
|
+
h1 { font-size: 28px; margin-bottom: 8px; }
|
|
32
|
+
h2 { font-size: 18px; margin: 32px 0 12px; }
|
|
33
|
+
.meta { color: #6a6e73; margin-bottom: 24px; }
|
|
34
|
+
img {
|
|
35
|
+
max-width: 100%;
|
|
36
|
+
height: auto;
|
|
37
|
+
border: 1px solid #d2d2d2;
|
|
38
|
+
border-radius: 8px;
|
|
39
|
+
}
|
|
40
|
+
</style>
|
|
41
|
+
</head>
|
|
42
|
+
<body>
|
|
43
|
+
<h1>${escapeHtml(documentTitle)}</h1>
|
|
44
|
+
<p class="meta">Generated ${escapeHtml(generatedAt.toLocaleString())}</p>
|
|
45
|
+
${sections}
|
|
46
|
+
</body>
|
|
47
|
+
</html>
|
|
48
|
+
`;
|
|
49
|
+
}
|
|
50
|
+
export async function buildHtmlFromCharts(charts, documentTitle) {
|
|
51
|
+
const images = [];
|
|
52
|
+
for (const chart of charts) {
|
|
53
|
+
const canvas = await chart.capture();
|
|
54
|
+
try {
|
|
55
|
+
images.push({
|
|
56
|
+
name: chart.title,
|
|
57
|
+
dataUrl: canvas.toDataURL("image/png"),
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
finally {
|
|
61
|
+
releaseCanvas(canvas);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return new Blob([buildHtmlReport(documentTitle, images)], {
|
|
65
|
+
type: "text/html;charset=utf-8",
|
|
66
|
+
});
|
|
67
|
+
}
|
package/dist/report/index.d.ts
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
export { CARD_EMPTY_STATE_DESCRIPTION, CardEmptyState, type CardEmptyStateProps, } from "./CardEmptyState.js";
|
|
2
|
+
export { ChartDownloadButton, ChartHeaderActions, } from "./ChartDownloadButton.js";
|
|
3
|
+
export { type BuildChartDocument, type CaptureChartElement, ChartExportProvider, type ChartExportProviderProps, type EncodeChartPng, type ZipChartFiles, } from "./ChartExportProvider.js";
|
|
4
|
+
export { ChartExportSurface } from "./ChartExportSurface.js";
|
|
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";
|
|
7
|
+
export { type ChartExportApi, type ChartExportFormat, useChartExport, useRegisterChart, } from "./chartExportContext.js";
|
|
8
|
+
export { getChartExportFilename, getChartZipFilename, getDatedChartExportBasename, } from "./chartExportFilenames.js";
|
|
2
9
|
export { chartColorFailure, chartColorSuccess, REPORT_CARD_EMPTY_STATE_TITLES, } from "./constants.js";
|
|
3
10
|
export { DashboardEmptyStateBase, type DashboardEmptyStateBaseProps, } from "./DashboardEmptyStateBase.js";
|
|
4
11
|
export { dashboardStyles, tableFullWidthStyle } from "./dashboardStyles.js";
|
|
5
12
|
export { EmptySearchResults, type EmptySearchResultsProps, } from "./EmptySearchResults.js";
|
|
13
|
+
export { FeatureStatusBadge, type FeatureStatusBadgeProps, } from "./FeatureStatusBadge.js";
|
|
14
|
+
export { HostPowerStates, type HostPowerStatesProps, } from "./HostPowerStates.js";
|
|
15
|
+
export { buildHtmlFromCharts, buildHtmlReport, escapeHtml, type HtmlReportImage, } from "./htmlExport.js";
|
|
16
|
+
export { InfrastructureSummary, type InfrastructureSummaryProps, } from "./InfrastructureSummary.js";
|
|
17
|
+
export type { ClusterDetailRow, ClusterDetailsModel, FeatureStatus, HostCapability, InfrastructureSummaryModel, InventoryCluster, InventoryDatastore, InventoryHost, InventoryInfra, InventoryNetwork, InventoryVms, NetworkLabel, } from "./infrastructureSummaryModel.js";
|
|
18
|
+
export { booleanToFeatureStatus, buildClusterDetailRows, buildClusterDetails, buildInfrastructureSummary, countVCenters, formatVSphereVersion, hostCapabilityStatus, visibleNetworks, vsanStatus, } from "./infrastructureSummaryModel.js";
|
|
6
19
|
export { OSBarChart, OSDistribution } from "./OSDistribution.js";
|
|
7
20
|
export { OsSupportTiersHelpPopover } from "./OsSupportTiersHelpPopover.js";
|
|
8
21
|
export { OsUpgradeNotice } from "./OsUpgradeNotice.js";
|
|
@@ -10,6 +23,16 @@ export { OsNameCell, OsUpgradeRecommendationPopover, } from "./OsUpgradeRecommen
|
|
|
10
23
|
export type { OSDistributionEntry, SupportTierBadgeStyle, } from "./osSupportTier.js";
|
|
11
24
|
export { getSupportTierBadgeColor, getSupportTierBadgeInlineStyle, getSupportTierDefinition, getSupportTierLegendLabel, getSupportTierSortOrder, hasOsUpgradeNotice, ORDERED_SUPPORT_TIERS, resolveSupportTier, SUPPORT_TIER_BADGE_COLORS, SUPPORT_TIER_BADGE_INLINE_STYLES, SUPPORT_TIER_DEFINITIONS, SUPPORT_TIER_LABELS, SUPPORT_TIER_LEARN_MORE_URL, SupportTier, } from "./osSupportTier.js";
|
|
12
25
|
export { default as PopoverIcon } from "./PopoverIcon.js";
|
|
26
|
+
export { PowerStateCard, type PowerStateCardProps, } from "./PowerStateCard.js";
|
|
27
|
+
export { buildPdfFromCharts } from "./pdfExport.js";
|
|
28
|
+
export { type PdfExportSegment, sliceCanvas, splitSegmentForPageHeight, } from "./pdfPage.js";
|
|
29
|
+
export type { PowerStateChartModel } from "./powerStates.js";
|
|
30
|
+
export { buildHostPowerStateChart, buildVmPowerStateChart, HOST_POWER_COLORS, VM_POWER_COLORS, } from "./powerStates.js";
|
|
31
|
+
export { ExportReportButton, type ExportReportButtonProps, ReportExportMenu, type ReportExportMenuProps, } from "./ReportExportMenu.js";
|
|
32
|
+
export { type ReportExportOption, type StandardReportExportHandlers, standardReportExportOptions, } from "./reportExportOptions.js";
|
|
13
33
|
export { SupportTierBadge } from "./SupportTierBadge.js";
|
|
14
34
|
export { ALL_TIERS_FILTER, type OsBarChartViewModel, type OsTableRow, useOsBarChartViewModel, } from "./useOsBarChartViewModel.js";
|
|
35
|
+
export { VCenterClusterDetails, type VCenterClusterDetailsProps, } from "./VCenterClusterDetails.js";
|
|
36
|
+
export { VmPowerStates, type VmPowerStatesProps, } from "./VmPowerStates.js";
|
|
37
|
+
export { zipChartPngs } from "./zipChartPngs.js";
|
|
15
38
|
//# 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,iBAAiB,EACjB,iBAAiB,EACjB,8BAA8B,GAC/B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,uBAAuB,EACvB,KAAK,4BAA4B,GAClC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EACL,kBAAkB,EAClB,KAAK,uBAAuB,GAC7B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EACL,UAAU,EACV,8BAA8B,GAC/B,MAAM,qCAAqC,CAAC;AAC7C,YAAY,EACV,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,wBAAwB,EACxB,8BAA8B,EAC9B,wBAAwB,EACxB,yBAAyB,EACzB,uBAAuB,EACvB,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EAClB,yBAAyB,EACzB,gCAAgC,EAChC,wBAAwB,EACxB,mBAAmB,EACnB,2BAA2B,EAC3B,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EACL,gBAAgB,EAChB,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,sBAAsB,GACvB,MAAM,6BAA6B,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,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,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,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,EACnB,2BAA2B,GAC5B,MAAM,2BAA2B,CAAC;AACn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dist/report/index.js
CHANGED
|
@@ -1,13 +1,34 @@
|
|
|
1
1
|
export { CARD_EMPTY_STATE_DESCRIPTION, CardEmptyState, } from "./CardEmptyState.js";
|
|
2
|
+
export { ChartDownloadButton, ChartHeaderActions, } from "./ChartDownloadButton.js";
|
|
3
|
+
export { ChartExportProvider, } from "./ChartExportProvider.js";
|
|
4
|
+
export { ChartExportSurface } from "./ChartExportSurface.js";
|
|
5
|
+
export { captureChartElement } from "./captureChartElement.js";
|
|
6
|
+
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
|
+
export { useChartExport, useRegisterChart, } from "./chartExportContext.js";
|
|
8
|
+
export { getChartExportFilename, getChartZipFilename, getDatedChartExportBasename, } from "./chartExportFilenames.js";
|
|
2
9
|
export { chartColorFailure, chartColorSuccess, REPORT_CARD_EMPTY_STATE_TITLES, } from "./constants.js";
|
|
3
10
|
export { DashboardEmptyStateBase, } from "./DashboardEmptyStateBase.js";
|
|
4
11
|
export { dashboardStyles, tableFullWidthStyle } from "./dashboardStyles.js";
|
|
5
12
|
export { EmptySearchResults, } from "./EmptySearchResults.js";
|
|
13
|
+
export { FeatureStatusBadge, } from "./FeatureStatusBadge.js";
|
|
14
|
+
export { HostPowerStates, } from "./HostPowerStates.js";
|
|
15
|
+
export { buildHtmlFromCharts, buildHtmlReport, escapeHtml, } from "./htmlExport.js";
|
|
16
|
+
export { InfrastructureSummary, } from "./InfrastructureSummary.js";
|
|
17
|
+
export { booleanToFeatureStatus, buildClusterDetailRows, buildClusterDetails, buildInfrastructureSummary, countVCenters, formatVSphereVersion, hostCapabilityStatus, visibleNetworks, vsanStatus, } from "./infrastructureSummaryModel.js";
|
|
6
18
|
export { OSBarChart, OSDistribution } from "./OSDistribution.js";
|
|
7
19
|
export { OsSupportTiersHelpPopover } from "./OsSupportTiersHelpPopover.js";
|
|
8
20
|
export { OsUpgradeNotice } from "./OsUpgradeNotice.js";
|
|
9
21
|
export { OsNameCell, OsUpgradeRecommendationPopover, } from "./OsUpgradeRecommendationPopover.js";
|
|
10
22
|
export { getSupportTierBadgeColor, getSupportTierBadgeInlineStyle, getSupportTierDefinition, getSupportTierLegendLabel, getSupportTierSortOrder, hasOsUpgradeNotice, ORDERED_SUPPORT_TIERS, resolveSupportTier, SUPPORT_TIER_BADGE_COLORS, SUPPORT_TIER_BADGE_INLINE_STYLES, SUPPORT_TIER_DEFINITIONS, SUPPORT_TIER_LABELS, SUPPORT_TIER_LEARN_MORE_URL, SupportTier, } from "./osSupportTier.js";
|
|
11
23
|
export { default as PopoverIcon } from "./PopoverIcon.js";
|
|
24
|
+
export { PowerStateCard, } from "./PowerStateCard.js";
|
|
25
|
+
export { buildPdfFromCharts } from "./pdfExport.js";
|
|
26
|
+
export { sliceCanvas, splitSegmentForPageHeight, } from "./pdfPage.js";
|
|
27
|
+
export { buildHostPowerStateChart, buildVmPowerStateChart, HOST_POWER_COLORS, VM_POWER_COLORS, } from "./powerStates.js";
|
|
28
|
+
export { ExportReportButton, ReportExportMenu, } from "./ReportExportMenu.js";
|
|
29
|
+
export { standardReportExportOptions, } from "./reportExportOptions.js";
|
|
12
30
|
export { SupportTierBadge } from "./SupportTierBadge.js";
|
|
13
31
|
export { ALL_TIERS_FILTER, useOsBarChartViewModel, } from "./useOsBarChartViewModel.js";
|
|
32
|
+
export { VCenterClusterDetails, } from "./VCenterClusterDetails.js";
|
|
33
|
+
export { VmPowerStates, } from "./VmPowerStates.js";
|
|
34
|
+
export { zipChartPngs } from "./zipChartPngs.js";
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export type FeatureStatus = "enabled" | "disabled" | "unknown";
|
|
2
|
+
export type HostCapability = "vmotionSupported" | "storageVmotionSupported";
|
|
3
|
+
export type InventoryHost = {
|
|
4
|
+
vmotionSupported?: boolean;
|
|
5
|
+
storageVmotionSupported?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export type InventoryDatastore = {
|
|
8
|
+
type?: string;
|
|
9
|
+
};
|
|
10
|
+
export type InventoryNetwork = {
|
|
11
|
+
name: string;
|
|
12
|
+
type?: string;
|
|
13
|
+
vlanId?: string;
|
|
14
|
+
};
|
|
15
|
+
export type InventoryInfra = {
|
|
16
|
+
totalHosts?: number;
|
|
17
|
+
totalDatacenters?: number;
|
|
18
|
+
hosts?: InventoryHost[];
|
|
19
|
+
clustersPerDatacenter?: number[];
|
|
20
|
+
networks?: InventoryNetwork[];
|
|
21
|
+
datastores?: InventoryDatastore[];
|
|
22
|
+
};
|
|
23
|
+
export type InventoryVms = {
|
|
24
|
+
total?: number;
|
|
25
|
+
diskTypes?: Record<string, unknown>;
|
|
26
|
+
};
|
|
27
|
+
export type InventoryCluster = {
|
|
28
|
+
infra?: InventoryInfra;
|
|
29
|
+
vms?: InventoryVms;
|
|
30
|
+
vcenter?: {
|
|
31
|
+
id?: string;
|
|
32
|
+
};
|
|
33
|
+
clusterFeatures?: {
|
|
34
|
+
drsEnabled?: boolean;
|
|
35
|
+
haEnabled?: boolean;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export type InfrastructureSummaryModel = {
|
|
39
|
+
vmwareVersion: string;
|
|
40
|
+
datacenters: number | undefined;
|
|
41
|
+
vCenters: number | undefined;
|
|
42
|
+
esxiHosts: number | undefined;
|
|
43
|
+
};
|
|
44
|
+
export type NetworkLabel = {
|
|
45
|
+
name: string;
|
|
46
|
+
vlanId?: string;
|
|
47
|
+
displayName: string;
|
|
48
|
+
};
|
|
49
|
+
export type ClusterDetailRow = {
|
|
50
|
+
id: string;
|
|
51
|
+
name: string;
|
|
52
|
+
hosts: number;
|
|
53
|
+
vms: number;
|
|
54
|
+
vmotion: FeatureStatus;
|
|
55
|
+
drs: FeatureStatus;
|
|
56
|
+
vsan: FeatureStatus;
|
|
57
|
+
};
|
|
58
|
+
export type ClusterDetailsModel = {
|
|
59
|
+
hosts: number;
|
|
60
|
+
vms: number;
|
|
61
|
+
networksDetected: number;
|
|
62
|
+
vmotion: FeatureStatus;
|
|
63
|
+
drs: FeatureStatus;
|
|
64
|
+
ha: FeatureStatus;
|
|
65
|
+
vsan: FeatureStatus;
|
|
66
|
+
networks: NetworkLabel[];
|
|
67
|
+
};
|
|
68
|
+
export declare const formatVSphereVersion: (version?: string) => string;
|
|
69
|
+
export declare const booleanToFeatureStatus: (value: boolean | undefined) => FeatureStatus;
|
|
70
|
+
export declare const hostCapabilityStatus: (hosts: InventoryHost[] | undefined, capability: HostCapability) => FeatureStatus;
|
|
71
|
+
export declare const vsanStatus: (infra?: InventoryInfra, vms?: InventoryVms) => FeatureStatus;
|
|
72
|
+
export declare const countVCenters: (clusters?: Record<string, InventoryCluster>, vcenterId?: string) => number | undefined;
|
|
73
|
+
export declare const visibleNetworks: (infra?: InventoryInfra) => NetworkLabel[];
|
|
74
|
+
export declare const buildInfrastructureSummary: ({ infra, vcenterVersion, vcenterId, clusters, }: {
|
|
75
|
+
infra?: InventoryInfra;
|
|
76
|
+
vcenterVersion?: string;
|
|
77
|
+
vcenterId?: string;
|
|
78
|
+
clusters?: Record<string, InventoryCluster>;
|
|
79
|
+
}) => InfrastructureSummaryModel;
|
|
80
|
+
export declare const buildClusterDetailRows: (clusters?: Record<string, InventoryCluster>) => ClusterDetailRow[];
|
|
81
|
+
export declare const buildClusterDetails: (cluster?: InventoryCluster) => ClusterDetailsModel | undefined;
|
|
82
|
+
//# sourceMappingURL=infrastructureSummaryModel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infrastructureSummaryModel.d.ts","sourceRoot":"","sources":["../../src/report/infrastructureSummaryModel.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,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