@openshift-migration-advisor/shared-components 0.24.0 → 0.25.0-1c27267d2ea6
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/ErrorTable.d.ts +18 -0
- package/dist/report/ErrorTable.d.ts.map +1 -0
- package/dist/report/ErrorTable.js +20 -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/NetworkOverview.d.ts +31 -0
- package/dist/report/NetworkOverview.d.ts.map +1 -0
- package/dist/report/NetworkOverview.js +201 -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/ReportTable.d.ts +14 -0
- package/dist/report/ReportTable.d.ts.map +1 -0
- package/dist/report/ReportTable.js +23 -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 +284 -0
- package/dist/report/chartExport.d.ts +57 -0
- package/dist/report/chartExport.d.ts.map +1 -0
- package/dist/report/chartExport.js +162 -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 +3 -0
- package/dist/report/constants.d.ts.map +1 -1
- package/dist/report/constants.js +3 -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 +65 -0
- package/dist/report/index.d.ts +26 -0
- package/dist/report/index.d.ts.map +1 -1
- package/dist/report/index.js +24 -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 +82 -0
- package/dist/report/pdfPage.d.ts +15 -0
- package/dist/report/pdfPage.d.ts.map +1 -0
- package/dist/report/pdfPage.js +44 -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/ErrorTable.tsx +85 -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/NetworkOverview.tsx +405 -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/ReportTable.tsx +81 -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__/NetworkOverview.test.tsx +269 -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 +224 -0
- package/src/report/__tests__/infrastructureSummaryModel.test.ts +224 -0
- package/src/report/__tests__/powerStates.test.ts +70 -0
- package/src/report/captureChartElement.ts +368 -0
- package/src/report/chartExport.ts +237 -0
- package/src/report/chartExportContext.tsx +84 -0
- package/src/report/chartExportFilenames.ts +21 -0
- package/src/report/constants.ts +3 -0
- package/src/report/dashboardStyles.ts +0 -23
- package/src/report/htmlExport.ts +83 -0
- package/src/report/index.ts +142 -0
- package/src/report/infrastructureSummaryModel.ts +281 -0
- package/src/report/pdfExport.ts +154 -0
- package/src/report/pdfPage.ts +83 -0
- package/src/report/powerStates.ts +169 -0
- package/src/report/reportExportOptions.ts +53 -0
- package/src/report/zipChartPngs.ts +10 -0
package/README.md
CHANGED
|
@@ -7,7 +7,9 @@ Includes:
|
|
|
7
7
|
- PatternFly form field wrappers (`react-hook-form`)
|
|
8
8
|
- Guest OS support-tier helpers and badges
|
|
9
9
|
- Report chart primitives (`MigrationDonutChart`)
|
|
10
|
+
- Chart export (`ChartExportProvider`, `ChartExportSurface`, PDF / PNG / HTML)
|
|
10
11
|
- Operating Systems distribution card
|
|
12
|
+
- Infrastructure summary, vCenter cluster details, and host/VM power-state cards
|
|
11
13
|
|
|
12
14
|
## Installation
|
|
13
15
|
|
|
@@ -23,13 +25,42 @@ npm install @openshift-migration-advisor/shared-components
|
|
|
23
25
|
|
|
24
26
|
```tsx
|
|
25
27
|
import {
|
|
28
|
+
buildInfrastructureSummary,
|
|
29
|
+
ChartExportProvider,
|
|
30
|
+
HostPowerStates,
|
|
31
|
+
InfrastructureSummary,
|
|
26
32
|
MigrationDonutChart,
|
|
27
33
|
OSDistribution,
|
|
34
|
+
ReportExportMenu,
|
|
28
35
|
SupportTierBadge,
|
|
29
36
|
TextInputFormGroup,
|
|
37
|
+
useChartExport,
|
|
38
|
+
VCenterClusterDetails,
|
|
39
|
+
VmPowerStates,
|
|
30
40
|
} from "@openshift-migration-advisor/shared-components";
|
|
41
|
+
|
|
42
|
+
<ChartExportProvider>
|
|
43
|
+
<Dashboard />
|
|
44
|
+
</ChartExportProvider>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
`ChartExportProvider` lazy-loads capture, ZIP, PDF, and HTML. Wrap the chart visual (not the Card chrome) in `ChartExportSurface`. All formats snapshot those same nodes, encode one chart at a time, and drop the canvas. There is no second print tree and no `isExportMode` render:
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
import { ChartExportSurface } from "@openshift-migration-advisor/shared-components";
|
|
51
|
+
|
|
52
|
+
<Card>
|
|
53
|
+
<CardTitle>CPU and memory</CardTitle>
|
|
54
|
+
<CardBody>
|
|
55
|
+
<ChartExportSurface id="cpu-memory" title="CPU and memory">
|
|
56
|
+
<MigrationDonutChart {...chartProps} />
|
|
57
|
+
</ChartExportSurface>
|
|
58
|
+
</CardBody>
|
|
59
|
+
</Card>
|
|
31
60
|
```
|
|
32
61
|
|
|
62
|
+
`ReportExportMenu` accepts a fully custom `options` list. `standardReportExportOptions()` builds the PDF / HTML / PNG entries; omit a handler to hide that format.
|
|
63
|
+
|
|
33
64
|
Components are SDK-agnostic: pass already-shaped props (for example `OSDistributionEntry` maps). Map `agent-sdk` / `planner-sdk` models at the app boundary.
|
|
34
65
|
|
|
35
66
|
## Development
|
package/dist/charts/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { MigrationDonutChart, type MigrationDonutChartDatum, type MigrationDonutChartProps, } from "./MigrationDonutChart.js";
|
|
1
|
+
export { MigrationDonutChart, type MigrationDonutChartDatum, type MigrationDonutChartLegendVariant, type MigrationDonutChartProps, } from "./MigrationDonutChart.js";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/charts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,GAC9B,MAAM,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/charts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,KAAK,wBAAwB,EAC7B,KAAK,gCAAgC,EACrC,KAAK,wBAAwB,GAC9B,MAAM,0BAA0B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioButtonFormGroup.d.ts","sourceRoot":"","sources":["../../src/forms/RadioButtonFormGroup.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,UAAU,WAAW;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,UAAU,yBACR,SAAQ,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC;IAC3C,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB;AAED,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,EAC3C,EAAE,EACF,KAAK,EACL,IAAI,EACJ,UAAkB,EAClB,OAAO,EACP,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,yBAAyB,+
|
|
1
|
+
{"version":3,"file":"RadioButtonFormGroup.d.ts","sourceRoot":"","sources":["../../src/forms/RadioButtonFormGroup.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,UAAU,WAAW;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,UAAU,yBACR,SAAQ,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC;IAC3C,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB;AAED,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,EAC3C,EAAE,EACF,KAAK,EACL,IAAI,EACJ,UAAkB,EAClB,OAAO,EACP,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,yBAAyB,+BA2C3B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { FormGroup, Radio } from "@patternfly/react-core";
|
|
3
3
|
import { Controller, useFormContext } from "react-hook-form";
|
|
4
4
|
import FormFieldHelperText from "./FormFieldHelperText.js";
|
|
@@ -8,5 +8,5 @@ export default function RadioButtonFormGroup({ id, label, name, isRequired = fal
|
|
|
8
8
|
const isTouched = methods.formState.touchedFields[name];
|
|
9
9
|
const isSubmitted = methods.formState.isSubmitted;
|
|
10
10
|
const showError = error && (isTouched || isSubmitted);
|
|
11
|
-
return (_jsxs(FormGroup, { label: label, isRequired: isRequired, fieldId: id, ...props, children: [_jsx(Controller, { name: name, control: methods.control, render: ({ field }) => (_jsx(
|
|
11
|
+
return (_jsxs(FormGroup, { label: label, isRequired: isRequired, fieldId: id, role: "radiogroup", isInline: true, ...props, children: [_jsx(Controller, { name: name, control: methods.control, render: ({ field }) => (_jsx(_Fragment, { children: options.map((option) => (_jsx(Radio, { id: option.id, name: name, label: option.label, isChecked: field.value === option.value, onChange: () => field.onChange(option.value), onBlur: field.onBlur }, option.value))) })) }), _jsx(FormFieldHelperText, { helpText: helpText, errorMessage: showError ? error?.message : undefined })] }));
|
|
12
12
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FC, ReactNode } from "react";
|
|
2
|
+
export declare const ChartDownloadButton: FC<{
|
|
3
|
+
chartId: string;
|
|
4
|
+
title?: string;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const ChartHeaderActions: FC<{
|
|
7
|
+
chartId: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
}>;
|
|
11
|
+
//# sourceMappingURL=ChartDownloadButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChartDownloadButton.d.ts","sourceRoot":"","sources":["../../src/report/ChartDownloadButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAI3C,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAoBA,CAAC;AAIF,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAmBA,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button, Flex, FlexItem } from "@patternfly/react-core";
|
|
3
|
+
import { DownloadIcon } from "@patternfly/react-icons";
|
|
4
|
+
import { chartExportHideProps } from "./chartExport.js";
|
|
5
|
+
import { useChartExport } from "./chartExportContext.js";
|
|
6
|
+
export const ChartDownloadButton = ({ chartId, title }) => {
|
|
7
|
+
const exportApi = useChartExport();
|
|
8
|
+
if (!exportApi) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
const label = title ? `Download ${title} as PNG` : "Download chart as PNG";
|
|
12
|
+
return (_jsx(Button, { variant: "plain", icon: _jsx(DownloadIcon, {}), "aria-label": label, isLoading: exportApi.downloadingChartId === chartId, isDisabled: exportApi.isBusy, onClick: () => {
|
|
13
|
+
void exportApi.downloadChart(chartId);
|
|
14
|
+
} }));
|
|
15
|
+
};
|
|
16
|
+
ChartDownloadButton.displayName = "ChartDownloadButton";
|
|
17
|
+
export const ChartHeaderActions = ({ chartId, title, children }) => {
|
|
18
|
+
const exportApi = useChartExport();
|
|
19
|
+
if (!exportApi && !children) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
return (_jsx(FlexItem, { ...chartExportHideProps, children: _jsxs(Flex, { alignItems: { default: "alignItemsCenter" }, spaceItems: { default: "spaceItemsSm" }, children: [children, exportApi ? (_jsx(ChartDownloadButton, { chartId: chartId, title: title })) : null] }) }));
|
|
23
|
+
};
|
|
24
|
+
ChartHeaderActions.displayName = "ChartHeaderActions";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type FC, type ReactNode } from "react";
|
|
2
|
+
import { type ChartCaptureSource, type ChartExportFile } from "./chartExport.js";
|
|
3
|
+
export type CaptureChartElement = (element: HTMLElement) => Promise<HTMLCanvasElement>;
|
|
4
|
+
export type ZipChartFiles = (files: ChartExportFile[]) => Promise<Blob>;
|
|
5
|
+
export type EncodeChartPng = (canvas: HTMLCanvasElement) => Promise<Blob>;
|
|
6
|
+
export type BuildChartDocument = (charts: ChartCaptureSource[], documentTitle: string) => Promise<Blob>;
|
|
7
|
+
export type { ChartExportApi, ChartExportFormat, } from "./chartExportContext.js";
|
|
8
|
+
export { useChartExport, useRegisterChart } from "./chartExportContext.js";
|
|
9
|
+
export interface ChartExportProviderProps {
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
capture?: CaptureChartElement;
|
|
12
|
+
zipFiles?: ZipChartFiles;
|
|
13
|
+
encodePng?: EncodeChartPng;
|
|
14
|
+
buildPdf?: BuildChartDocument;
|
|
15
|
+
buildHtml?: BuildChartDocument;
|
|
16
|
+
downloadFile?: (blob: Blob, filename: string) => void;
|
|
17
|
+
getZipFilename?: () => string;
|
|
18
|
+
getPdfFilename?: () => string;
|
|
19
|
+
getHtmlFilename?: () => string;
|
|
20
|
+
}
|
|
21
|
+
export declare const ChartExportProvider: FC<ChartExportProviderProps>;
|
|
22
|
+
//# sourceMappingURL=ChartExportProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChartExportProvider.d.ts","sourceRoot":"","sources":["../../src/report/ChartExportProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EAAE,EACP,KAAK,SAAS,EAKf,MAAM,OAAO,CAAC;AACf,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,eAAe,EAQrB,MAAM,kBAAkB,CAAC;AAU1B,MAAM,MAAM,mBAAmB,GAAG,CAChC,OAAO,EAAE,WAAW,KACjB,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAChC,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,eAAe,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AACxE,MAAM,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,iBAAiB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAC1E,MAAM,MAAM,kBAAkB,GAAG,CAC/B,MAAM,EAAE,kBAAkB,EAAE,EAC5B,aAAa,EAAE,MAAM,KAClB,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnB,YAAY,EACV,cAAc,EACd,iBAAiB,GAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3E,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,SAAS,CAAC,EAAE,kBAAkB,CAAC;IAC/B,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACtD,cAAc,CAAC,EAAE,MAAM,MAAM,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,MAAM,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,MAAM,CAAC;CAChC;AAsED,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC,wBAAwB,CAgQ5D,CAAC"}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useMemo, useRef, useState, } from "react";
|
|
3
|
+
import { canvasToBlob, downloadBlob, releaseCanvas, restoreChartExportViews, sortRegisteredChartsByDocumentOrder, toBulkChartCaptureSources, } from "./chartExport.js";
|
|
4
|
+
import { ChartExportApiContext, ChartExportRegistryContext, } from "./chartExportContext.js";
|
|
5
|
+
import { getChartExportFilename } from "./chartExportFilenames.js";
|
|
6
|
+
export { useChartExport, useRegisterChart } from "./chartExportContext.js";
|
|
7
|
+
const EXPORT_LOADING_LABELS = {
|
|
8
|
+
pdf: "Generating PDF...",
|
|
9
|
+
png: "Generating PNG...",
|
|
10
|
+
html: "Generating HTML...",
|
|
11
|
+
};
|
|
12
|
+
const defaultZipFilename = () => getChartExportFilename("zip");
|
|
13
|
+
const defaultPdfFilename = () => getChartExportFilename("pdf");
|
|
14
|
+
const defaultHtmlFilename = () => getChartExportFilename("html");
|
|
15
|
+
async function resolveCapture(override) {
|
|
16
|
+
if (override) {
|
|
17
|
+
return override;
|
|
18
|
+
}
|
|
19
|
+
const { captureChartElement } = await import("./captureChartElement.js");
|
|
20
|
+
return captureChartElement;
|
|
21
|
+
}
|
|
22
|
+
async function resolvePrepareElement(overrideCapture) {
|
|
23
|
+
if (overrideCapture) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
const { revealHiddenChartAncestors } = await import("./captureChartElement.js");
|
|
27
|
+
return revealHiddenChartAncestors;
|
|
28
|
+
}
|
|
29
|
+
async function resolveZip(override) {
|
|
30
|
+
if (override) {
|
|
31
|
+
return override;
|
|
32
|
+
}
|
|
33
|
+
const { zipChartPngs } = await import("./zipChartPngs.js");
|
|
34
|
+
return zipChartPngs;
|
|
35
|
+
}
|
|
36
|
+
async function resolvePdf(override) {
|
|
37
|
+
if (override) {
|
|
38
|
+
return override;
|
|
39
|
+
}
|
|
40
|
+
const { buildPdfFromCharts } = await import("./pdfExport.js");
|
|
41
|
+
return buildPdfFromCharts;
|
|
42
|
+
}
|
|
43
|
+
async function resolveHtml(override) {
|
|
44
|
+
if (override) {
|
|
45
|
+
return override;
|
|
46
|
+
}
|
|
47
|
+
const { buildHtmlFromCharts } = await import("./htmlExport.js");
|
|
48
|
+
return buildHtmlFromCharts;
|
|
49
|
+
}
|
|
50
|
+
function toCaptureSources(charts, capture, prepareElement) {
|
|
51
|
+
return toBulkChartCaptureSources(charts, capture, prepareElement);
|
|
52
|
+
}
|
|
53
|
+
export const ChartExportProvider = ({ children, capture, zipFiles, encodePng = canvasToBlob, buildPdf, buildHtml, downloadFile = downloadBlob, getZipFilename = defaultZipFilename, getPdfFilename = defaultPdfFilename, getHtmlFilename = defaultHtmlFilename, }) => {
|
|
54
|
+
const chartsRef = useRef(new Map());
|
|
55
|
+
const isBusyRef = useRef(false);
|
|
56
|
+
const [downloadingChartId, setDownloadingChartId] = useState(null);
|
|
57
|
+
const [exportingFormat, setExportingFormat] = useState(null);
|
|
58
|
+
const [exportError, setExportError] = useState(null);
|
|
59
|
+
const registry = useMemo(() => ({
|
|
60
|
+
register(chart) {
|
|
61
|
+
const existing = chartsRef.current.get(chart.id);
|
|
62
|
+
if (existing &&
|
|
63
|
+
existing.element !== chart.element &&
|
|
64
|
+
existing.element.isConnected) {
|
|
65
|
+
console.warn(`Duplicate chart export id "${chart.id}". The previous chart will not be exported.`);
|
|
66
|
+
}
|
|
67
|
+
chartsRef.current.set(chart.id, chart);
|
|
68
|
+
return () => {
|
|
69
|
+
const current = chartsRef.current.get(chart.id);
|
|
70
|
+
if (current?.element === chart.element) {
|
|
71
|
+
chartsRef.current.delete(chart.id);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
},
|
|
75
|
+
}), []);
|
|
76
|
+
const listCharts = useCallback(() => {
|
|
77
|
+
return sortRegisteredChartsByDocumentOrder(Array.from(chartsRef.current.values()).filter((chart) => chart.element.isConnected));
|
|
78
|
+
}, []);
|
|
79
|
+
const runCapture = useCallback(async (work, chartId, format) => {
|
|
80
|
+
if (isBusyRef.current) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
isBusyRef.current = true;
|
|
84
|
+
setExportError(null);
|
|
85
|
+
if (chartId) {
|
|
86
|
+
setDownloadingChartId(chartId);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
setExportingFormat(format);
|
|
90
|
+
}
|
|
91
|
+
try {
|
|
92
|
+
await work();
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
console.error(`Error exporting ${format}:`, error);
|
|
96
|
+
setExportError(`Failed to export ${format.toUpperCase()}. Please try again.`);
|
|
97
|
+
}
|
|
98
|
+
finally {
|
|
99
|
+
isBusyRef.current = false;
|
|
100
|
+
setDownloadingChartId(null);
|
|
101
|
+
setExportingFormat(null);
|
|
102
|
+
}
|
|
103
|
+
}, []);
|
|
104
|
+
const downloadChart = useCallback(async (id) => {
|
|
105
|
+
await runCapture(async () => {
|
|
106
|
+
const chart = chartsRef.current.get(id);
|
|
107
|
+
if (!chart?.element.isConnected) {
|
|
108
|
+
throw new Error("The chart is not ready to export yet.");
|
|
109
|
+
}
|
|
110
|
+
const captureFn = await resolveCapture(capture);
|
|
111
|
+
const canvas = await captureFn(chart.element);
|
|
112
|
+
try {
|
|
113
|
+
downloadFile(await encodePng(canvas), chart.filename);
|
|
114
|
+
}
|
|
115
|
+
finally {
|
|
116
|
+
releaseCanvas(canvas);
|
|
117
|
+
}
|
|
118
|
+
}, id, "png");
|
|
119
|
+
}, [capture, downloadFile, encodePng, runCapture]);
|
|
120
|
+
const downloadAll = useCallback(async () => {
|
|
121
|
+
await runCapture(async () => {
|
|
122
|
+
const charts = listCharts();
|
|
123
|
+
if (charts.length === 0) {
|
|
124
|
+
throw new Error("The report is not ready to export yet.");
|
|
125
|
+
}
|
|
126
|
+
const captureFn = await resolveCapture(capture);
|
|
127
|
+
const prepareElement = await resolvePrepareElement(capture);
|
|
128
|
+
const zipFn = await resolveZip(zipFiles);
|
|
129
|
+
const files = [];
|
|
130
|
+
const sources = toBulkChartCaptureSources(charts, captureFn, prepareElement);
|
|
131
|
+
try {
|
|
132
|
+
for (const [index, source] of sources.entries()) {
|
|
133
|
+
const canvas = await source.capture();
|
|
134
|
+
try {
|
|
135
|
+
files.push({
|
|
136
|
+
filename: `${String(index + 1).padStart(2, "0")}-${source.filename}`,
|
|
137
|
+
blob: await encodePng(canvas),
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
finally {
|
|
141
|
+
releaseCanvas(canvas);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
finally {
|
|
146
|
+
await restoreChartExportViews(charts);
|
|
147
|
+
}
|
|
148
|
+
downloadFile(await zipFn(files), getZipFilename());
|
|
149
|
+
}, null, "png");
|
|
150
|
+
}, [
|
|
151
|
+
capture,
|
|
152
|
+
downloadFile,
|
|
153
|
+
encodePng,
|
|
154
|
+
getZipFilename,
|
|
155
|
+
listCharts,
|
|
156
|
+
runCapture,
|
|
157
|
+
zipFiles,
|
|
158
|
+
]);
|
|
159
|
+
const downloadPdf = useCallback(async (documentTitle) => {
|
|
160
|
+
await runCapture(async () => {
|
|
161
|
+
const charts = listCharts();
|
|
162
|
+
if (charts.length === 0) {
|
|
163
|
+
throw new Error("The report is not ready to export yet.");
|
|
164
|
+
}
|
|
165
|
+
const captureFn = await resolveCapture(capture);
|
|
166
|
+
const prepareElement = await resolvePrepareElement(capture);
|
|
167
|
+
const build = await resolvePdf(buildPdf);
|
|
168
|
+
try {
|
|
169
|
+
downloadFile(await build(toCaptureSources(charts, captureFn, prepareElement), documentTitle), getPdfFilename());
|
|
170
|
+
}
|
|
171
|
+
finally {
|
|
172
|
+
await restoreChartExportViews(charts);
|
|
173
|
+
}
|
|
174
|
+
}, null, "pdf");
|
|
175
|
+
}, [buildPdf, capture, downloadFile, getPdfFilename, listCharts, runCapture]);
|
|
176
|
+
const downloadHtml = useCallback(async (documentTitle) => {
|
|
177
|
+
await runCapture(async () => {
|
|
178
|
+
const charts = listCharts();
|
|
179
|
+
if (charts.length === 0) {
|
|
180
|
+
throw new Error("The report is not ready to export yet.");
|
|
181
|
+
}
|
|
182
|
+
const captureFn = await resolveCapture(capture);
|
|
183
|
+
const prepareElement = await resolvePrepareElement(capture);
|
|
184
|
+
const build = await resolveHtml(buildHtml);
|
|
185
|
+
try {
|
|
186
|
+
downloadFile(await build(toCaptureSources(charts, captureFn, prepareElement), documentTitle), getHtmlFilename());
|
|
187
|
+
}
|
|
188
|
+
finally {
|
|
189
|
+
await restoreChartExportViews(charts);
|
|
190
|
+
}
|
|
191
|
+
}, null, "html");
|
|
192
|
+
}, [buildHtml, capture, downloadFile, getHtmlFilename, listCharts, runCapture]);
|
|
193
|
+
const clearExportError = useCallback(() => {
|
|
194
|
+
setExportError(null);
|
|
195
|
+
}, []);
|
|
196
|
+
const api = useMemo(() => ({
|
|
197
|
+
downloadChart,
|
|
198
|
+
downloadAll,
|
|
199
|
+
downloadPdf,
|
|
200
|
+
downloadHtml,
|
|
201
|
+
downloadingChartId,
|
|
202
|
+
exportingFormat,
|
|
203
|
+
exportLoadingLabel: exportingFormat
|
|
204
|
+
? EXPORT_LOADING_LABELS[exportingFormat]
|
|
205
|
+
: null,
|
|
206
|
+
isExportingAll: exportingFormat !== null,
|
|
207
|
+
isBusy: downloadingChartId !== null || exportingFormat !== null,
|
|
208
|
+
exportError,
|
|
209
|
+
clearExportError,
|
|
210
|
+
}), [
|
|
211
|
+
clearExportError,
|
|
212
|
+
downloadAll,
|
|
213
|
+
downloadChart,
|
|
214
|
+
downloadHtml,
|
|
215
|
+
downloadPdf,
|
|
216
|
+
downloadingChartId,
|
|
217
|
+
exportError,
|
|
218
|
+
exportingFormat,
|
|
219
|
+
]);
|
|
220
|
+
return (_jsx(ChartExportRegistryContext.Provider, { value: registry, children: _jsx(ChartExportApiContext.Provider, { value: api, children: children }) }));
|
|
221
|
+
};
|
|
222
|
+
ChartExportProvider.displayName = "ChartExportProvider";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type FC, type ReactNode } from "react";
|
|
2
|
+
import { type ChartExportView } from "./chartExport.js";
|
|
3
|
+
export declare const ChartExportSurface: FC<{
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
filename?: string;
|
|
7
|
+
exportViews?: ChartExportView[];
|
|
8
|
+
activeExportViewId?: string;
|
|
9
|
+
onExportViewChange?: (viewId: string) => void;
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
}>;
|
|
12
|
+
//# sourceMappingURL=ChartExportSurface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChartExportSurface.d.ts","sourceRoot":"","sources":["../../src/report/ChartExportSurface.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,SAAS,EAAuB,MAAM,OAAO,CAAC;AACrE,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,kBAAkB,CAAC;AAG1B,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,eAAe,EAAE,CAAC;IAChC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,QAAQ,EAAE,SAAS,CAAC;CACrB,CAyCA,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useRef } from "react";
|
|
3
|
+
import { chartExportRootStyle, waitForChartExportPaint, } from "./chartExport.js";
|
|
4
|
+
import { useRegisterChart } from "./chartExportContext.js";
|
|
5
|
+
export const ChartExportSurface = ({ id, title, filename, exportViews, activeExportViewId, onExportViewChange, children, }) => {
|
|
6
|
+
const activeViewRef = useRef(activeExportViewId);
|
|
7
|
+
activeViewRef.current = activeExportViewId;
|
|
8
|
+
const onExportViewChangeRef = useRef(onExportViewChange);
|
|
9
|
+
onExportViewChangeRef.current = onExportViewChange;
|
|
10
|
+
const setExportView = useCallback(async (viewId) => {
|
|
11
|
+
const change = onExportViewChangeRef.current;
|
|
12
|
+
if (change && activeViewRef.current !== viewId) {
|
|
13
|
+
change(viewId);
|
|
14
|
+
await new Promise((resolve) => {
|
|
15
|
+
window.setTimeout(resolve, 0);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
await waitForChartExportPaint();
|
|
19
|
+
}, []);
|
|
20
|
+
const ref = useRegisterChart({
|
|
21
|
+
id,
|
|
22
|
+
title,
|
|
23
|
+
filename,
|
|
24
|
+
exportViews,
|
|
25
|
+
activeExportViewId,
|
|
26
|
+
setExportView: exportViews && exportViews.length > 1 && onExportViewChange
|
|
27
|
+
? setExportView
|
|
28
|
+
: undefined,
|
|
29
|
+
});
|
|
30
|
+
return (_jsx("div", { ref: ref, id: id, style: chartExportRootStyle, children: children }));
|
|
31
|
+
};
|
|
32
|
+
ChartExportSurface.displayName = "ChartExportSurface";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Minimal shape of a migration issue consumed by {@link ErrorTable}. Declared
|
|
4
|
+
* locally so this package does not depend on a specific SDK (`agent-sdk` or
|
|
5
|
+
* `planner-sdk`); callers pass the subset of `MigrationIssue` fields read here.
|
|
6
|
+
*/
|
|
7
|
+
export interface MigrationIssueLike {
|
|
8
|
+
label: string;
|
|
9
|
+
assessment: string;
|
|
10
|
+
count: number;
|
|
11
|
+
}
|
|
12
|
+
export interface ErrorTableProps {
|
|
13
|
+
errors: MigrationIssueLike[];
|
|
14
|
+
/** Optional drill-down callback invoked with an issue's `label`. */
|
|
15
|
+
onConcernClick?: (concernLabel: string) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare const ErrorTable: React.FC<ErrorTableProps>;
|
|
18
|
+
//# sourceMappingURL=ErrorTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorTable.d.ts","sourceRoot":"","sources":["../../src/report/ErrorTable.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAC7B,oEAAoE;IACpE,cAAc,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;CACjD;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAgDhD,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Card, CardBody, CardTitle, Flex, FlexItem, Icon, } from "@patternfly/react-core";
|
|
3
|
+
import { ExclamationCircleIcon } from "@patternfly/react-icons";
|
|
4
|
+
import { CardEmptyState } from "./CardEmptyState.js";
|
|
5
|
+
import { ChartHeaderActions } from "./ChartDownloadButton.js";
|
|
6
|
+
import { ChartExportSurface } from "./ChartExportSurface.js";
|
|
7
|
+
import { REPORT_CARD_EMPTY_STATE_TITLES } from "./constants.js";
|
|
8
|
+
import { dashboardStyles } from "./dashboardStyles.js";
|
|
9
|
+
import { ReportTable } from "./ReportTable.js";
|
|
10
|
+
export const ErrorTable = ({ errors, onConcernClick, }) => {
|
|
11
|
+
const handleRowClick = (issue) => {
|
|
12
|
+
if (issue.label && onConcernClick) {
|
|
13
|
+
onConcernClick(issue.label);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
const chartId = "errors-table";
|
|
17
|
+
const chartTitle = "Errors";
|
|
18
|
+
return (_jsx(ChartExportSurface, { id: chartId, title: chartTitle, children: _jsxs(Card, { className: dashboardStyles.card, children: [_jsx(CardTitle, { children: _jsxs(Flex, { justifyContent: { default: "justifyContentSpaceBetween" }, alignItems: { default: "alignItemsCenter" }, children: [_jsxs(FlexItem, { children: [_jsx(Icon, { status: "danger", children: _jsx(ExclamationCircleIcon, {}) }), " ", "Errors"] }), _jsx(ChartHeaderActions, { chartId: chartId, title: chartTitle })] }) }), _jsx(CardBody, { className: dashboardStyles.cardBodyScrollable, children: errors.length === 0 ? (_jsx(CardEmptyState, { title: REPORT_CARD_EMPTY_STATE_TITLES.errors })) : (_jsx("div", { children: _jsx(ReportTable, { data: errors, columns: ["Description", "Total VMs"], fields: ["assessment", "count"], onRowClick: onConcernClick ? handleRowClick : undefined, clickableFields: onConcernClick ? ["assessment"] : [] }) })) })] }) }));
|
|
19
|
+
};
|
|
20
|
+
ErrorTable.displayName = "ErrorTable";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FC } from "react";
|
|
2
|
+
import type { FeatureStatus } from "./infrastructureSummaryModel.js";
|
|
3
|
+
export interface FeatureStatusBadgeProps {
|
|
4
|
+
status: FeatureStatus;
|
|
5
|
+
}
|
|
6
|
+
export declare const FeatureStatusBadge: FC<FeatureStatusBadgeProps>;
|
|
7
|
+
//# sourceMappingURL=FeatureStatusBadge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FeatureStatusBadge.d.ts","sourceRoot":"","sources":["../../src/report/FeatureStatusBadge.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAErE,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,aAAa,CAAC;CACvB;AAED,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,uBAAuB,CAkB1D,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Label } from "@patternfly/react-core";
|
|
3
|
+
import { CheckCircleIcon, TimesCircleIcon } from "@patternfly/react-icons";
|
|
4
|
+
export const FeatureStatusBadge = ({ status }) => {
|
|
5
|
+
if (status === "unknown") {
|
|
6
|
+
return _jsx("span", { children: "\u2014" });
|
|
7
|
+
}
|
|
8
|
+
if (status === "enabled") {
|
|
9
|
+
return (_jsx(Label, { color: "green", isCompact: true, icon: _jsx(CheckCircleIcon, {}), children: "Enabled" }));
|
|
10
|
+
}
|
|
11
|
+
return (_jsx(Label, { color: "grey", isCompact: true, icon: _jsx(TimesCircleIcon, {}), children: "Disabled" }));
|
|
12
|
+
};
|
|
13
|
+
FeatureStatusBadge.displayName = "FeatureStatusBadge";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FC } from "react";
|
|
2
|
+
import type { MigrationDonutChartLegendVariant } from "../charts/MigrationDonutChart.js";
|
|
3
|
+
export interface HostPowerStatesProps {
|
|
4
|
+
hostPowerStates?: Record<string, number>;
|
|
5
|
+
legendVariant?: MigrationDonutChartLegendVariant;
|
|
6
|
+
}
|
|
7
|
+
export declare const HostPowerStates: FC<HostPowerStatesProps>;
|
|
8
|
+
//# sourceMappingURL=HostPowerStates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HostPowerStates.d.ts","sourceRoot":"","sources":["../../src/report/HostPowerStates.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,kCAAkC,CAAC;AAKzF,MAAM,WAAW,oBAAoB;IACnC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,aAAa,CAAC,EAAE,gCAAgC,CAAC;CAClD;AAED,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CAsBpD,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ServerIcon } from "@patternfly/react-icons";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { REPORT_CARD_EMPTY_STATE_TITLES } from "./constants.js";
|
|
5
|
+
import { PowerStateCard } from "./PowerStateCard.js";
|
|
6
|
+
import { buildHostPowerStateChart } from "./powerStates.js";
|
|
7
|
+
export const HostPowerStates = ({ hostPowerStates, legendVariant, }) => {
|
|
8
|
+
const chart = useMemo(() => buildHostPowerStateChart(hostPowerStates), [hostPowerStates]);
|
|
9
|
+
return (_jsx(PowerStateCard, { id: "esxi-host-power-states", title: "ESXi host power states", icon: _jsx(ServerIcon, {}), emptyTitle: REPORT_CARD_EMPTY_STATE_TITLES.hostPowerStates, slices: chart.slices, legend: chart.legend, total: chart.total, subTitle: "Hosts", legendVariant: legendVariant }));
|
|
10
|
+
};
|
|
11
|
+
HostPowerStates.displayName = "HostPowerStates";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FC } from "react";
|
|
2
|
+
import type { InfrastructureSummaryModel } from "./infrastructureSummaryModel.js";
|
|
3
|
+
export interface InfrastructureSummaryProps {
|
|
4
|
+
summary: InfrastructureSummaryModel;
|
|
5
|
+
}
|
|
6
|
+
export declare const InfrastructureSummary: FC<InfrastructureSummaryProps>;
|
|
7
|
+
//# sourceMappingURL=InfrastructureSummary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InfrastructureSummary.d.ts","sourceRoot":"","sources":["../../src/report/InfrastructureSummary.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAGhC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAElF,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,0BAA0B,CAAC;CACrC;AAQD,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,0BAA0B,CA4ChE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Card, CardBody, CardTitle, DescriptionList, DescriptionListDescription, DescriptionListGroup, DescriptionListTerm, Flex, FlexItem, } from "@patternfly/react-core";
|
|
3
|
+
import { ChartHeaderActions } from "./ChartDownloadButton.js";
|
|
4
|
+
import { ChartExportSurface } from "./ChartExportSurface.js";
|
|
5
|
+
const formatCount = (value) => typeof value === "number" ? String(value) : "—";
|
|
6
|
+
const INFRA_CHART_ID = "infrastructure-summary";
|
|
7
|
+
const INFRA_TITLE = "Infrastructure summary";
|
|
8
|
+
export const InfrastructureSummary = ({ summary, }) => (_jsx(ChartExportSurface, { id: INFRA_CHART_ID, title: INFRA_TITLE, children: _jsxs(Card, { isFullHeight: true, children: [_jsx(CardTitle, { children: _jsxs(Flex, { justifyContent: { default: "justifyContentSpaceBetween" }, alignItems: { default: "alignItemsCenter" }, children: [_jsx(FlexItem, { children: INFRA_TITLE }), _jsx(ChartHeaderActions, { chartId: INFRA_CHART_ID, title: INFRA_TITLE })] }) }), _jsx(CardBody, { children: _jsxs(DescriptionList, { isAutoFit: true, displaySize: "lg", children: [_jsxs(DescriptionListGroup, { children: [_jsx(DescriptionListTerm, { children: "VMware version" }), _jsx(DescriptionListDescription, { children: summary.vmwareVersion })] }), _jsxs(DescriptionListGroup, { children: [_jsx(DescriptionListTerm, { children: "Datacenters" }), _jsx(DescriptionListDescription, { children: formatCount(summary.datacenters) })] }), _jsxs(DescriptionListGroup, { children: [_jsx(DescriptionListTerm, { children: "vCenters" }), _jsx(DescriptionListDescription, { children: formatCount(summary.vCenters) })] }), _jsxs(DescriptionListGroup, { children: [_jsx(DescriptionListTerm, { children: "ESXi hosts" }), _jsx(DescriptionListDescription, { children: formatCount(summary.esxiHosts) })] })] }) })] }) }));
|
|
9
|
+
InfrastructureSummary.displayName = "InfrastructureSummary";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { FC } from "react";
|
|
2
|
+
import { type MigrationDonutChartLegendVariant } from "../charts/MigrationDonutChart.js";
|
|
3
|
+
/** Network fields this card reads. Apps pass SDK networks structurally. */
|
|
4
|
+
export interface NetworkLike {
|
|
5
|
+
vmsCount?: number;
|
|
6
|
+
vlanId?: string | number;
|
|
7
|
+
}
|
|
8
|
+
/** Infra fields this card reads. */
|
|
9
|
+
export interface NetworkInfraLike {
|
|
10
|
+
networks?: NetworkLike[];
|
|
11
|
+
}
|
|
12
|
+
/** Deprecated NIC histogram used when `distributionByNicCount` is absent. */
|
|
13
|
+
export interface NicCountHistogram {
|
|
14
|
+
data?: number[];
|
|
15
|
+
minValue?: number;
|
|
16
|
+
step?: number;
|
|
17
|
+
}
|
|
18
|
+
/** NIC summary fields this card reads from the VM resource breakdown. */
|
|
19
|
+
export interface NicCountSummary {
|
|
20
|
+
total?: number;
|
|
21
|
+
histogram?: NicCountHistogram;
|
|
22
|
+
}
|
|
23
|
+
export interface NetworkOverviewProps {
|
|
24
|
+
infra?: NetworkInfraLike;
|
|
25
|
+
nicCount?: NicCountSummary;
|
|
26
|
+
distributionByNicCount?: Record<string, number>;
|
|
27
|
+
/** `"html"` in agent-ui; ui-app passes `"chart"`. */
|
|
28
|
+
legendVariant?: MigrationDonutChartLegendVariant;
|
|
29
|
+
}
|
|
30
|
+
export declare const NetworkOverview: FC<NetworkOverviewProps>;
|
|
31
|
+
//# sourceMappingURL=NetworkOverview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NetworkOverview.d.ts","sourceRoot":"","sources":["../../src/report/NetworkOverview.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,EAAE,EAAO,MAAM,OAAO,CAAC;AAErC,OAAO,EAGL,KAAK,gCAAgC,EACtC,MAAM,kCAAkC,CAAC;AAQ1C,2EAA2E;AAC3E,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAED,oCAAoC;AACpC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;CAC1B;AAED,6EAA6E;AAC7E,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,yEAAyE;AACzE,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,iBAAiB,CAAC;CAC/B;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,sBAAsB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChD,qDAAqD;IACrD,aAAa,CAAC,EAAE,gCAAgC,CAAC;CAClD;AAiND,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CA2HpD,CAAC"}
|