@openshift-migration-advisor/shared-components 0.21.0-8e9be07f572f → 0.21.0-bd9c6b9b659b
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 +6 -0
- package/dist/charts/MigrationDonutChart.d.ts +18 -1
- package/dist/charts/MigrationDonutChart.d.ts.map +1 -1
- package/dist/charts/MigrationDonutChart.js +109 -43
- 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/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 +9 -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 +5 -0
- package/dist/report/OSDistribution.d.ts.map +1 -1
- package/dist/report/OSDistribution.js +5 -13
- 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/PowerStateCard.d.ts +17 -0
- package/dist/report/PowerStateCard.d.ts.map +1 -0
- package/dist/report/PowerStateCard.js +7 -0
- package/dist/report/SupportTierBadge.d.ts.map +1 -1
- package/dist/report/SupportTierBadge.js +4 -2
- package/dist/report/VCenterClusterDetails.d.ts +10 -0
- package/dist/report/VCenterClusterDetails.d.ts.map +1 -0
- package/dist/report/VCenterClusterDetails.js +26 -0
- package/dist/report/VmPowerStates.d.ts +9 -0
- package/dist/report/VmPowerStates.d.ts.map +1 -0
- package/dist/report/VmPowerStates.js +11 -0
- package/dist/report/constants.d.ts +2 -0
- package/dist/report/constants.d.ts.map +1 -1
- package/dist/report/constants.js +3 -2
- package/dist/report/index.d.ts +10 -0
- package/dist/report/index.d.ts.map +1 -1
- package/dist/report/index.js +8 -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/osSupportTier.d.ts.map +1 -1
- package/dist/report/osSupportTier.js +1 -8
- 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/package.json +3 -2
- package/src/charts/MigrationDonutChart.tsx +241 -111
- package/src/charts/index.ts +1 -0
- package/src/forms/RadioButtonFormGroup.tsx +10 -3
- package/src/report/FeatureStatusBadge.tsx +30 -0
- package/src/report/HostPowerStates.tsx +41 -0
- package/src/report/InfrastructureSummary.tsx +56 -0
- package/src/report/OSDistribution.tsx +60 -67
- package/src/report/OsSupportTiersHelpPopover.tsx +32 -61
- package/src/report/OsUpgradeNotice.tsx +1 -7
- package/src/report/PowerStateCard.tsx +73 -0
- package/src/report/SupportTierBadge.tsx +4 -2
- package/src/report/VCenterClusterDetails.tsx +211 -0
- package/src/report/VmPowerStates.tsx +41 -0
- package/src/report/__tests__/HostPowerStates.test.tsx +47 -0
- package/src/report/__tests__/InfrastructureSummary.test.tsx +148 -0
- package/src/report/__tests__/infrastructureSummaryModel.test.ts +224 -0
- package/src/report/__tests__/powerStates.test.ts +70 -0
- package/src/report/constants.ts +6 -2
- package/src/report/index.ts +56 -0
- package/src/report/infrastructureSummaryModel.ts +281 -0
- package/src/report/osSupportTier.ts +10 -8
- package/src/report/powerStates.ts +169 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { css } from "@emotion/css";
|
|
3
|
+
import { Card, CardBody, CardTitle, Content, DescriptionList, DescriptionListDescription, DescriptionListGroup, DescriptionListTerm, Grid, GridItem, Label, LabelGroup, } from "@patternfly/react-core";
|
|
4
|
+
import { Table, Tbody, Td, Th, Thead, Tr } from "@patternfly/react-table";
|
|
5
|
+
import { FeatureStatusBadge } from "./FeatureStatusBadge.js";
|
|
6
|
+
const clusterDetailsTableScrollStyle = css `
|
|
7
|
+
max-height: 320px;
|
|
8
|
+
overflow: auto;
|
|
9
|
+
`;
|
|
10
|
+
const FeatureList = ({ items }) => (_jsx(DescriptionList, { isHorizontal: true, isCompact: true, children: items.map((item) => (_jsxs(DescriptionListGroup, { children: [_jsx(DescriptionListTerm, { children: item.label }), _jsx(DescriptionListDescription, { children: _jsx(FeatureStatusBadge, { status: item.status }) })] }, item.label))) }));
|
|
11
|
+
const AggregateClusterTable = ({ rows }) => (_jsxs(Table, { variant: "compact", borders: false, isStickyHeader: true, "data-testid": "vcenter-cluster-details-table", children: [_jsx(Thead, { children: _jsxs(Tr, { children: [_jsx(Th, { children: "Cluster name" }), _jsx(Th, { children: "Hosts" }), _jsx(Th, { children: "VMs" }), _jsx(Th, { children: "vMotion" }), _jsx(Th, { children: "DRS" }), _jsx(Th, { children: "vSAN" })] }) }), _jsx(Tbody, { children: rows.map((row) => (_jsxs(Tr, { children: [_jsx(Td, { dataLabel: "Cluster name", children: row.name }), _jsx(Td, { dataLabel: "Hosts", children: row.hosts }), _jsx(Td, { dataLabel: "VMs", children: row.vms }), _jsx(Td, { dataLabel: "vMotion", children: _jsx(FeatureStatusBadge, { status: row.vmotion }) }), _jsx(Td, { dataLabel: "DRS", children: _jsx(FeatureStatusBadge, { status: row.drs }) }), _jsx(Td, { dataLabel: "vSAN", children: _jsx(FeatureStatusBadge, { status: row.vsan }) })] }, row.id))) })] }));
|
|
12
|
+
const AggregateCluster = ({ rows, isExportMode }) => {
|
|
13
|
+
if (rows.length === 0) {
|
|
14
|
+
return _jsx(Content, { component: "p", children: "No vSphere clusters detected" });
|
|
15
|
+
}
|
|
16
|
+
return (_jsx("div", { className: isExportMode ? undefined : clusterDetailsTableScrollStyle, "data-scroll-constrained": isExportMode ? undefined : "true", children: _jsx(AggregateClusterTable, { rows: rows }) }));
|
|
17
|
+
};
|
|
18
|
+
const DetailedClusterView = ({ details, }) => (_jsxs(Grid, { hasGutter: true, children: [_jsx(GridItem, { children: _jsxs(DescriptionList, { isAutoFit: true, displaySize: "lg", children: [_jsxs(DescriptionListGroup, { children: [_jsx(DescriptionListTerm, { children: "Hosts" }), _jsx(DescriptionListDescription, { children: details.hosts })] }), _jsxs(DescriptionListGroup, { children: [_jsx(DescriptionListTerm, { children: "VMs" }), _jsx(DescriptionListDescription, { children: details.vms })] }), _jsxs(DescriptionListGroup, { children: [_jsx(DescriptionListTerm, { children: "Networks detected" }), _jsx(DescriptionListDescription, { children: details.networksDetected })] })] }) }), _jsx(GridItem, { md: 4, children: _jsxs(Card, { isFullHeight: true, children: [_jsx(CardTitle, { children: "Core infrastructure" }), _jsx(CardBody, { children: _jsx(FeatureList, { items: [
|
|
19
|
+
{ label: "vMotion", status: details.vmotion },
|
|
20
|
+
{ label: "DRS", status: details.drs },
|
|
21
|
+
{ label: "HA", status: details.ha },
|
|
22
|
+
] }) })] }) }), _jsx(GridItem, { md: 4, children: _jsxs(Card, { isFullHeight: true, children: [_jsx(CardTitle, { children: "vSAN capabilities" }), _jsx(CardBody, { children: _jsx(FeatureList, { items: [{ label: "vSAN", status: details.vsan }] }) })] }) }), _jsx(GridItem, { md: 4, children: _jsxs(Card, { isFullHeight: true, children: [_jsx(CardTitle, { children: "Network topology" }), _jsx(CardBody, { children: details.networks.length === 0 ? (_jsx(Content, { component: "p", children: "No networks detected" })) : (_jsxs(_Fragment, { children: [_jsxs(Content, { component: "p", children: [details.networksDetected, " ", details.networksDetected === 1
|
|
23
|
+
? "network detected"
|
|
24
|
+
: "networks detected"] }), _jsx(LabelGroup, { isCompact: true, numLabels: details.networks.length, "aria-label": "Detected networks", children: details.networks.map((network, index) => (_jsx(Label, { color: "blue", isCompact: true, children: network.displayName }, `${network.name}-${network.vlanId ?? index}`))) })] })) })] }) })] }));
|
|
25
|
+
export const VCenterClusterDetails = ({ isAggregateView, rows, details, isExportMode = false, }) => (_jsxs(Card, { isFullHeight: true, id: "vcenter-cluster-details", children: [_jsx(CardTitle, { children: "vCenter cluster details" }), _jsx(CardBody, { children: isAggregateView || !details ? (_jsx(AggregateCluster, { rows: rows, isExportMode: isExportMode })) : (_jsx(DetailedClusterView, { details: details })) })] }));
|
|
26
|
+
VCenterClusterDetails.displayName = "VCenterClusterDetails";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FC } from "react";
|
|
2
|
+
import type { MigrationDonutChartLegendVariant } from "../charts/MigrationDonutChart.js";
|
|
3
|
+
export interface VmPowerStatesProps {
|
|
4
|
+
powerStates?: Record<string, number>;
|
|
5
|
+
isExportMode?: boolean;
|
|
6
|
+
legendVariant?: MigrationDonutChartLegendVariant;
|
|
7
|
+
}
|
|
8
|
+
export declare const VmPowerStates: FC<VmPowerStatesProps>;
|
|
9
|
+
//# sourceMappingURL=VmPowerStates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VmPowerStates.d.ts","sourceRoot":"","sources":["../../src/report/VmPowerStates.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,kCAAkC,CAAC;AAKzF,MAAM,WAAW,kBAAkB;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,gCAAgC,CAAC;CAClD;AAED,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAwBhD,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { VirtualMachineIcon } 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 { buildVmPowerStateChart } from "./powerStates.js";
|
|
7
|
+
export const VmPowerStates = ({ powerStates, isExportMode = false, legendVariant, }) => {
|
|
8
|
+
const chart = useMemo(() => buildVmPowerStateChart(powerStates), [powerStates]);
|
|
9
|
+
return (_jsx(PowerStateCard, { id: "vm-power-states", title: "VM power states", icon: _jsx(VirtualMachineIcon, {}), emptyTitle: REPORT_CARD_EMPTY_STATE_TITLES.vmPowerStates, slices: chart.slices, legend: chart.legend, total: chart.total, subTitle: "VMs", isExportMode: isExportMode, legendVariant: legendVariant }));
|
|
10
|
+
};
|
|
11
|
+
VmPowerStates.displayName = "VmPowerStates";
|
|
@@ -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":"
|
|
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
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { chart_color_blue_300 } from "@patternfly/react-tokens
|
|
2
|
-
import { chart_color_yellow_300 } from "@patternfly/react-tokens/dist/esm/chart_color_yellow_300";
|
|
1
|
+
import { chart_color_blue_300, chart_color_yellow_300, } from "@patternfly/react-tokens";
|
|
3
2
|
/**
|
|
4
3
|
* PatternFly chart color semantics (https://www.patternfly.org/charts/colors-for-charts/design-guidelines/#best-practices):
|
|
5
4
|
* Blue → success / migratable / supported
|
|
@@ -21,4 +20,6 @@ export const REPORT_CARD_EMPTY_STATE_TITLES = {
|
|
|
21
20
|
operatingSystems: "Operating system data not collected",
|
|
22
21
|
migrationStatus: "Migration status data not collected",
|
|
23
22
|
issuesBreakdown: "Issues breakdown data not collected",
|
|
23
|
+
hostPowerStates: "Host power state data not collected",
|
|
24
|
+
vmPowerStates: "VM power state data not collected",
|
|
24
25
|
};
|
package/dist/report/index.d.ts
CHANGED
|
@@ -3,6 +3,11 @@ export { chartColorFailure, chartColorSuccess, REPORT_CARD_EMPTY_STATE_TITLES, }
|
|
|
3
3
|
export { DashboardEmptyStateBase, type DashboardEmptyStateBaseProps, } from "./DashboardEmptyStateBase.js";
|
|
4
4
|
export { dashboardStyles, tableFullWidthStyle } from "./dashboardStyles.js";
|
|
5
5
|
export { EmptySearchResults, type EmptySearchResultsProps, } from "./EmptySearchResults.js";
|
|
6
|
+
export { FeatureStatusBadge, type FeatureStatusBadgeProps, } from "./FeatureStatusBadge.js";
|
|
7
|
+
export { HostPowerStates, type HostPowerStatesProps, } from "./HostPowerStates.js";
|
|
8
|
+
export { InfrastructureSummary, type InfrastructureSummaryProps, } from "./InfrastructureSummary.js";
|
|
9
|
+
export type { ClusterDetailRow, ClusterDetailsModel, FeatureStatus, HostCapability, InfrastructureSummaryModel, InventoryCluster, InventoryDatastore, InventoryHost, InventoryInfra, InventoryNetwork, InventoryVms, NetworkLabel, } from "./infrastructureSummaryModel.js";
|
|
10
|
+
export { booleanToFeatureStatus, buildClusterDetailRows, buildClusterDetails, buildInfrastructureSummary, countVCenters, formatVSphereVersion, hostCapabilityStatus, visibleNetworks, vsanStatus, } from "./infrastructureSummaryModel.js";
|
|
6
11
|
export { OSBarChart, OSDistribution } from "./OSDistribution.js";
|
|
7
12
|
export { OsSupportTiersHelpPopover } from "./OsSupportTiersHelpPopover.js";
|
|
8
13
|
export { OsUpgradeNotice } from "./OsUpgradeNotice.js";
|
|
@@ -10,6 +15,11 @@ export { OsNameCell, OsUpgradeRecommendationPopover, } from "./OsUpgradeRecommen
|
|
|
10
15
|
export type { OSDistributionEntry, SupportTierBadgeStyle, } from "./osSupportTier.js";
|
|
11
16
|
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
17
|
export { default as PopoverIcon } from "./PopoverIcon.js";
|
|
18
|
+
export { PowerStateCard, type PowerStateCardProps, } from "./PowerStateCard.js";
|
|
19
|
+
export type { PowerStateChartModel } from "./powerStates.js";
|
|
20
|
+
export { buildHostPowerStateChart, buildVmPowerStateChart, HOST_POWER_COLORS, VM_POWER_COLORS, } from "./powerStates.js";
|
|
13
21
|
export { SupportTierBadge } from "./SupportTierBadge.js";
|
|
14
22
|
export { ALL_TIERS_FILTER, type OsBarChartViewModel, type OsTableRow, useOsBarChartViewModel, } from "./useOsBarChartViewModel.js";
|
|
23
|
+
export { VCenterClusterDetails, type VCenterClusterDetailsProps, } from "./VCenterClusterDetails.js";
|
|
24
|
+
export { VmPowerStates, type VmPowerStatesProps, } from "./VmPowerStates.js";
|
|
15
25
|
//# 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,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,EACL,kBAAkB,EAClB,KAAK,uBAAuB,GAC7B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,eAAe,EACf,KAAK,oBAAoB,GAC1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,qBAAqB,EACrB,KAAK,0BAA0B,GAChC,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,0BAA0B,EAC1B,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,YAAY,GACb,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,EACnB,0BAA0B,EAC1B,aAAa,EACb,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EACf,UAAU,GACX,MAAM,iCAAiC,CAAC;AACzC,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,EACL,cAAc,EACd,KAAK,mBAAmB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,iBAAiB,EACjB,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,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"}
|
package/dist/report/index.js
CHANGED
|
@@ -3,11 +3,19 @@ export { chartColorFailure, chartColorSuccess, REPORT_CARD_EMPTY_STATE_TITLES, }
|
|
|
3
3
|
export { DashboardEmptyStateBase, } from "./DashboardEmptyStateBase.js";
|
|
4
4
|
export { dashboardStyles, tableFullWidthStyle } from "./dashboardStyles.js";
|
|
5
5
|
export { EmptySearchResults, } from "./EmptySearchResults.js";
|
|
6
|
+
export { FeatureStatusBadge, } from "./FeatureStatusBadge.js";
|
|
7
|
+
export { HostPowerStates, } from "./HostPowerStates.js";
|
|
8
|
+
export { InfrastructureSummary, } from "./InfrastructureSummary.js";
|
|
9
|
+
export { booleanToFeatureStatus, buildClusterDetailRows, buildClusterDetails, buildInfrastructureSummary, countVCenters, formatVSphereVersion, hostCapabilityStatus, visibleNetworks, vsanStatus, } from "./infrastructureSummaryModel.js";
|
|
6
10
|
export { OSBarChart, OSDistribution } from "./OSDistribution.js";
|
|
7
11
|
export { OsSupportTiersHelpPopover } from "./OsSupportTiersHelpPopover.js";
|
|
8
12
|
export { OsUpgradeNotice } from "./OsUpgradeNotice.js";
|
|
9
13
|
export { OsNameCell, OsUpgradeRecommendationPopover, } from "./OsUpgradeRecommendationPopover.js";
|
|
10
14
|
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
15
|
export { default as PopoverIcon } from "./PopoverIcon.js";
|
|
16
|
+
export { PowerStateCard, } from "./PowerStateCard.js";
|
|
17
|
+
export { buildHostPowerStateChart, buildVmPowerStateChart, HOST_POWER_COLORS, VM_POWER_COLORS, } from "./powerStates.js";
|
|
12
18
|
export { SupportTierBadge } from "./SupportTierBadge.js";
|
|
13
19
|
export { ALL_TIERS_FILTER, useOsBarChartViewModel, } from "./useOsBarChartViewModel.js";
|
|
20
|
+
export { VCenterClusterDetails, } from "./VCenterClusterDetails.js";
|
|
21
|
+
export { VmPowerStates, } from "./VmPowerStates.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,GAAG,SAAS,GAAG,UAAU,G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AM,KACjB,MAAM,GAAG,SAWX,CAAC;AAWF,eAAO,MAAM,eAAe,GAAI,QAAQ,cAAc,KAAG,YAAY,EAK7C,CAAC;AAEzB,eAAO,MAAM,0BAA0B,GAAI,iDAKxC;IACD,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAC7C,KAAG,0BAKF,CAAC;AAuBH,eAAO,MAAM,sBAAsB,GACjC,WAAW,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,KAC1C,gBAAgB,EAoBlB,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC9B,UAAU,gBAAgB,KACzB,mBAAmB,GAAG,SAkBxB,CAAC"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
const VSAN_TYPE_PATTERN = /vsan/i;
|
|
2
|
+
export const formatVSphereVersion = (version) => {
|
|
3
|
+
if (!version?.trim()) {
|
|
4
|
+
return "—";
|
|
5
|
+
}
|
|
6
|
+
const withoutPrefix = version.trim().replace(/^vSphere\s+/i, "");
|
|
7
|
+
const parts = withoutPrefix.split(".");
|
|
8
|
+
while (parts.length > 3 && parts[parts.length - 1] === "0") {
|
|
9
|
+
parts.pop();
|
|
10
|
+
}
|
|
11
|
+
return `vSphere ${parts.join(".")}`;
|
|
12
|
+
};
|
|
13
|
+
export const booleanToFeatureStatus = (value) => {
|
|
14
|
+
if (value === true) {
|
|
15
|
+
return "enabled";
|
|
16
|
+
}
|
|
17
|
+
if (value === false) {
|
|
18
|
+
return "disabled";
|
|
19
|
+
}
|
|
20
|
+
return "unknown";
|
|
21
|
+
};
|
|
22
|
+
export const hostCapabilityStatus = (hosts, capability) => {
|
|
23
|
+
if (!hosts || hosts.length === 0) {
|
|
24
|
+
return "unknown";
|
|
25
|
+
}
|
|
26
|
+
const known = hosts
|
|
27
|
+
.map((host) => host[capability])
|
|
28
|
+
.filter((value) => typeof value === "boolean");
|
|
29
|
+
if (known.length === 0) {
|
|
30
|
+
return "unknown";
|
|
31
|
+
}
|
|
32
|
+
return known.some(Boolean) ? "enabled" : "disabled";
|
|
33
|
+
};
|
|
34
|
+
export const vsanStatus = (infra, vms) => {
|
|
35
|
+
const datastoreMatch = infra?.datastores?.some((datastore) => VSAN_TYPE_PATTERN.test(datastore.type ?? ""));
|
|
36
|
+
const diskTypeMatch = Object.keys(vms?.diskTypes ?? {}).some((type) => VSAN_TYPE_PATTERN.test(type));
|
|
37
|
+
if (datastoreMatch || diskTypeMatch) {
|
|
38
|
+
return "enabled";
|
|
39
|
+
}
|
|
40
|
+
if (infra?.datastores || vms?.diskTypes) {
|
|
41
|
+
return "disabled";
|
|
42
|
+
}
|
|
43
|
+
return "unknown";
|
|
44
|
+
};
|
|
45
|
+
const hostCount = (infra) => {
|
|
46
|
+
if (typeof infra?.totalHosts === "number") {
|
|
47
|
+
return infra.totalHosts;
|
|
48
|
+
}
|
|
49
|
+
if (infra?.hosts) {
|
|
50
|
+
return infra.hosts.length;
|
|
51
|
+
}
|
|
52
|
+
return undefined;
|
|
53
|
+
};
|
|
54
|
+
const datacenterCount = (infra) => {
|
|
55
|
+
if (typeof infra?.totalDatacenters === "number") {
|
|
56
|
+
return infra.totalDatacenters;
|
|
57
|
+
}
|
|
58
|
+
if (infra?.clustersPerDatacenter && infra.clustersPerDatacenter.length > 0) {
|
|
59
|
+
return infra.clustersPerDatacenter.length;
|
|
60
|
+
}
|
|
61
|
+
return undefined;
|
|
62
|
+
};
|
|
63
|
+
export const countVCenters = (clusters, vcenterId) => {
|
|
64
|
+
const ids = new Set();
|
|
65
|
+
if (vcenterId) {
|
|
66
|
+
ids.add(vcenterId);
|
|
67
|
+
}
|
|
68
|
+
for (const cluster of Object.values(clusters ?? {})) {
|
|
69
|
+
if (cluster.vcenter?.id) {
|
|
70
|
+
ids.add(cluster.vcenter.id);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return ids.size > 0 ? ids.size : undefined;
|
|
74
|
+
};
|
|
75
|
+
const toNetworkLabel = (network) => {
|
|
76
|
+
const vlanId = network.vlanId?.trim();
|
|
77
|
+
return {
|
|
78
|
+
name: network.name,
|
|
79
|
+
vlanId: vlanId || undefined,
|
|
80
|
+
displayName: vlanId ? `${network.name} (VLAN ${vlanId})` : network.name,
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
export const visibleNetworks = (infra) => (infra?.networks ?? [])
|
|
84
|
+
.filter((network) => Boolean(network.name?.trim()) && network.type !== "dvswitch")
|
|
85
|
+
.map(toNetworkLabel);
|
|
86
|
+
export const buildInfrastructureSummary = ({ infra, vcenterVersion, vcenterId, clusters, }) => ({
|
|
87
|
+
vmwareVersion: formatVSphereVersion(vcenterVersion),
|
|
88
|
+
datacenters: datacenterCount(infra),
|
|
89
|
+
vCenters: countVCenters(clusters, vcenterId),
|
|
90
|
+
esxiHosts: hostCount(infra),
|
|
91
|
+
});
|
|
92
|
+
const clusterFeatureStatus = (cluster) => ({
|
|
93
|
+
vmotion: hostCapabilityStatus(cluster.infra?.hosts, "vmotionSupported"),
|
|
94
|
+
drs: booleanToFeatureStatus(cluster.clusterFeatures?.drsEnabled),
|
|
95
|
+
ha: booleanToFeatureStatus(cluster.clusterFeatures?.haEnabled),
|
|
96
|
+
vsan: vsanStatus(cluster.infra, cluster.vms),
|
|
97
|
+
});
|
|
98
|
+
const compareClustersByVmCount = (a, b, clusters) => {
|
|
99
|
+
const vmsA = clusters[a]?.vms?.total ?? 0;
|
|
100
|
+
const vmsB = clusters[b]?.vms?.total ?? 0;
|
|
101
|
+
return vmsB - vmsA || a.localeCompare(b);
|
|
102
|
+
};
|
|
103
|
+
export const buildClusterDetailRows = (clusters) => {
|
|
104
|
+
if (!clusters) {
|
|
105
|
+
return [];
|
|
106
|
+
}
|
|
107
|
+
return Object.keys(clusters)
|
|
108
|
+
.sort((a, b) => compareClustersByVmCount(a, b, clusters))
|
|
109
|
+
.map((id) => {
|
|
110
|
+
const cluster = clusters[id];
|
|
111
|
+
const features = clusterFeatureStatus(cluster);
|
|
112
|
+
return {
|
|
113
|
+
id,
|
|
114
|
+
name: id,
|
|
115
|
+
hosts: hostCount(cluster.infra) ?? 0,
|
|
116
|
+
vms: cluster.vms?.total ?? 0,
|
|
117
|
+
vmotion: features.vmotion,
|
|
118
|
+
drs: features.drs,
|
|
119
|
+
vsan: features.vsan,
|
|
120
|
+
};
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
export const buildClusterDetails = (cluster) => {
|
|
124
|
+
if (!cluster) {
|
|
125
|
+
return undefined;
|
|
126
|
+
}
|
|
127
|
+
const networks = visibleNetworks(cluster.infra);
|
|
128
|
+
const features = clusterFeatureStatus(cluster);
|
|
129
|
+
return {
|
|
130
|
+
hosts: hostCount(cluster.infra) ?? 0,
|
|
131
|
+
vms: cluster.vms?.total ?? 0,
|
|
132
|
+
networksDetected: networks.length,
|
|
133
|
+
vmotion: features.vmotion,
|
|
134
|
+
drs: features.drs,
|
|
135
|
+
ha: features.ha,
|
|
136
|
+
vsan: features.vsan,
|
|
137
|
+
networks,
|
|
138
|
+
};
|
|
139
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"osSupportTier.d.ts","sourceRoot":"","sources":["../../src/report/osSupportTier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"osSupportTier.d.ts","sourceRoot":"","sources":["../../src/report/osSupportTier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAYzD;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;CAKd,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AA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8BAA8B,CAC5C,IAAI,EAAE,WAAW,GAChB,qBAAqB,CAEvB"}
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import { t_color_blue_20 } from "@patternfly/react-tokens
|
|
2
|
-
import { t_color_blue_60 } from "@patternfly/react-tokens/dist/esm/t_color_blue_60";
|
|
3
|
-
import { t_color_green_20 } from "@patternfly/react-tokens/dist/esm/t_color_green_20";
|
|
4
|
-
import { t_color_green_60 } from "@patternfly/react-tokens/dist/esm/t_color_green_60";
|
|
5
|
-
import { t_color_orange_20 } from "@patternfly/react-tokens/dist/esm/t_color_orange_20";
|
|
6
|
-
import { t_color_orange_60 } from "@patternfly/react-tokens/dist/esm/t_color_orange_60";
|
|
7
|
-
import { t_color_yellow_20 } from "@patternfly/react-tokens/dist/esm/t_color_yellow_20";
|
|
8
|
-
import { t_color_yellow_60 } from "@patternfly/react-tokens/dist/esm/t_color_yellow_60";
|
|
1
|
+
import { t_color_blue_20, t_color_blue_60, t_color_green_20, t_color_green_60, t_color_orange_20, t_color_orange_60, t_color_yellow_20, t_color_yellow_60, } from "@patternfly/react-tokens";
|
|
9
2
|
/**
|
|
10
3
|
* Guest OS support tiers (matches agent-sdk / planner-sdk `OsInfoSupportTierEnum` values).
|
|
11
4
|
* Defined locally so this package stays SDK-agnostic.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { MigrationDonutChartDatum } from "../charts/MigrationDonutChart.js";
|
|
2
|
+
export type PowerStateChartModel = {
|
|
3
|
+
slices: MigrationDonutChartDatum[];
|
|
4
|
+
legend: Record<string, string>;
|
|
5
|
+
total: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const HOST_POWER_COLORS: Record<string, string>;
|
|
8
|
+
export declare const VM_POWER_COLORS: Record<string, string>;
|
|
9
|
+
export declare const buildHostPowerStateChart: (hostPowerStates?: Record<string, number>) => PowerStateChartModel;
|
|
10
|
+
export declare const buildVmPowerStateChart: (powerStates?: Record<string, number>) => PowerStateChartModel;
|
|
11
|
+
//# sourceMappingURL=powerStates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"powerStates.d.ts","sourceRoot":"","sources":["../../src/report/powerStates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAEjF,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,wBAAwB,EAAE,CAAC;IACnC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AA8BF,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAMpD,CAAC;AAcF,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAIlD,CAAC;AAmCF,eAAO,MAAM,wBAAwB,GACnC,kBAAkB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KACvC,oBAgCF,CAAC;AAEF,eAAO,MAAM,sBAAsB,GACjC,cAAc,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KACnC,oBAmCF,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
const HOST_POWER_CATEGORIES = [
|
|
2
|
+
"Powered on",
|
|
3
|
+
"Powered off",
|
|
4
|
+
"Standby",
|
|
5
|
+
"Not responding",
|
|
6
|
+
"Maintenance",
|
|
7
|
+
];
|
|
8
|
+
const HOST_POWER_KEY_ALIASES = {
|
|
9
|
+
poweredon: "Powered on",
|
|
10
|
+
powered_on: "Powered on",
|
|
11
|
+
green: "Powered on",
|
|
12
|
+
poweredoff: "Powered off",
|
|
13
|
+
powered_off: "Powered off",
|
|
14
|
+
standby: "Standby",
|
|
15
|
+
stand_by: "Standby",
|
|
16
|
+
notresponding: "Not responding",
|
|
17
|
+
not_responding: "Not responding",
|
|
18
|
+
gray: "Not responding",
|
|
19
|
+
grey: "Not responding",
|
|
20
|
+
red: "Not responding",
|
|
21
|
+
maintenance: "Maintenance",
|
|
22
|
+
inmaintenance: "Maintenance",
|
|
23
|
+
inmaintenancemode: "Maintenance",
|
|
24
|
+
};
|
|
25
|
+
export const HOST_POWER_COLORS = {
|
|
26
|
+
"Powered on": "#0066cc",
|
|
27
|
+
"Powered off": "#dca614",
|
|
28
|
+
Standby: "#f0ab00",
|
|
29
|
+
"Not responding": "#c9190b",
|
|
30
|
+
Maintenance: "#002f5d",
|
|
31
|
+
};
|
|
32
|
+
const VM_POWER_CATEGORIES = ["Powered off", "Powered on", "Suspended"];
|
|
33
|
+
const VM_POWER_KEY_ALIASES = {
|
|
34
|
+
poweredoff: "Powered off",
|
|
35
|
+
powered_off: "Powered off",
|
|
36
|
+
poweredon: "Powered on",
|
|
37
|
+
powered_on: "Powered on",
|
|
38
|
+
suspended: "Suspended",
|
|
39
|
+
};
|
|
40
|
+
export const VM_POWER_COLORS = {
|
|
41
|
+
"Powered off": "#0066cc",
|
|
42
|
+
"Powered on": "#dca614",
|
|
43
|
+
Suspended: "#5e40be",
|
|
44
|
+
};
|
|
45
|
+
const OTHER_COLOR = "#6a6e73";
|
|
46
|
+
const normalizeKey = (key) => key
|
|
47
|
+
.trim()
|
|
48
|
+
.toLowerCase()
|
|
49
|
+
.replace(/[\s-]+/g, "");
|
|
50
|
+
const formatUnknownLabel = (key) => {
|
|
51
|
+
const spaced = key
|
|
52
|
+
.replace(/[_-]+/g, " ")
|
|
53
|
+
.replace(/([a-z])([A-Z])/g, "$1 $2")
|
|
54
|
+
.trim();
|
|
55
|
+
if (!spaced) {
|
|
56
|
+
return "Unknown";
|
|
57
|
+
}
|
|
58
|
+
return spaced.charAt(0).toUpperCase() + spaced.slice(1);
|
|
59
|
+
};
|
|
60
|
+
const toSlice = (name, count, unit) => ({
|
|
61
|
+
name,
|
|
62
|
+
count,
|
|
63
|
+
legendCategory: name,
|
|
64
|
+
countDisplay: `${count} ${count === 1 ? unit.replace(/s$/, "") : unit}`,
|
|
65
|
+
});
|
|
66
|
+
const sumCounts = (counts) => Object.values(counts).reduce((total, count) => total + (count || 0), 0);
|
|
67
|
+
export const buildHostPowerStateChart = (hostPowerStates) => {
|
|
68
|
+
const counts = Object.fromEntries(HOST_POWER_CATEGORIES.map((category) => [category, 0]));
|
|
69
|
+
for (const [key, count] of Object.entries(hostPowerStates ?? {})) {
|
|
70
|
+
const mapped = HOST_POWER_KEY_ALIASES[normalizeKey(key)];
|
|
71
|
+
const label = mapped ?? formatUnknownLabel(key);
|
|
72
|
+
counts[label] = (counts[label] ?? 0) + (count || 0);
|
|
73
|
+
}
|
|
74
|
+
const orderedLabels = [
|
|
75
|
+
...HOST_POWER_CATEGORIES,
|
|
76
|
+
...Object.keys(counts).filter((label) => !HOST_POWER_CATEGORIES.includes(label)),
|
|
77
|
+
];
|
|
78
|
+
const slices = orderedLabels.map((label) => toSlice(label, counts[label] ?? 0, "hosts"));
|
|
79
|
+
const legend = {};
|
|
80
|
+
for (const label of orderedLabels) {
|
|
81
|
+
legend[label] = HOST_POWER_COLORS[label] ?? OTHER_COLOR;
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
slices,
|
|
85
|
+
legend,
|
|
86
|
+
total: sumCounts(counts),
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
export const buildVmPowerStateChart = (powerStates) => {
|
|
90
|
+
const counts = {
|
|
91
|
+
"Powered off": 0,
|
|
92
|
+
"Powered on": 0,
|
|
93
|
+
};
|
|
94
|
+
for (const [key, count] of Object.entries(powerStates ?? {})) {
|
|
95
|
+
const mapped = VM_POWER_KEY_ALIASES[normalizeKey(key)];
|
|
96
|
+
const label = mapped ?? formatUnknownLabel(key);
|
|
97
|
+
counts[label] = (counts[label] ?? 0) + (count || 0);
|
|
98
|
+
}
|
|
99
|
+
const orderedLabels = [
|
|
100
|
+
...VM_POWER_CATEGORIES.filter((category) => category !== "Suspended" || (counts[category] ?? 0) > 0),
|
|
101
|
+
...Object.keys(counts).filter((label) => !VM_POWER_CATEGORIES.includes(label)),
|
|
102
|
+
];
|
|
103
|
+
const slices = orderedLabels.map((label) => toSlice(label, counts[label] ?? 0, "VMs"));
|
|
104
|
+
const legend = {};
|
|
105
|
+
for (const label of orderedLabels) {
|
|
106
|
+
legend[label] = VM_POWER_COLORS[label] ?? OTHER_COLOR;
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
slices,
|
|
110
|
+
legend,
|
|
111
|
+
total: sumCounts(counts),
|
|
112
|
+
};
|
|
113
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openshift-migration-advisor/shared-components",
|
|
3
|
-
"version": "0.21.0-
|
|
3
|
+
"version": "0.21.0-bd9c6b9b659b",
|
|
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",
|
|
@@ -35,7 +35,8 @@
|
|
|
35
35
|
"clean": "rm -rf node_modules dist .tmp",
|
|
36
36
|
"check": "yarn run -T biome check .",
|
|
37
37
|
"check:fix": "yarn run -T biome check --write .",
|
|
38
|
-
"test": "
|
|
38
|
+
"test": "yarn run -T vitest run",
|
|
39
|
+
"test:watch": "yarn run -T vitest",
|
|
39
40
|
"typecheck": "yarn run -T tsc -b --noEmit"
|
|
40
41
|
},
|
|
41
42
|
"files": [
|