@openshift-migration-advisor/shared-components 0.23.0-e6249b8ada7d → 0.24.0
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 +0 -6
- 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/OSDistribution.d.ts.map +1 -1
- package/dist/report/OSDistribution.js +13 -5
- package/dist/report/OsSupportTiersHelpPopover.d.ts.map +1 -1
- package/dist/report/OsSupportTiersHelpPopover.js +31 -2
- package/dist/report/OsUpgradeNotice.d.ts.map +1 -1
- package/dist/report/OsUpgradeNotice.js +5 -1
- package/dist/report/SupportTierBadge.d.ts.map +1 -1
- package/dist/report/SupportTierBadge.js +2 -4
- package/dist/report/constants.d.ts +0 -2
- package/dist/report/constants.d.ts.map +1 -1
- package/dist/report/constants.js +0 -2
- package/dist/report/index.d.ts +0 -10
- package/dist/report/index.d.ts.map +1 -1
- package/dist/report/index.js +0 -8
- package/package.json +1 -1
- package/src/charts/index.ts +0 -1
- package/src/forms/RadioButtonFormGroup.tsx +3 -10
- package/src/report/OSDistribution.tsx +67 -60
- package/src/report/OsSupportTiersHelpPopover.tsx +62 -32
- package/src/report/OsUpgradeNotice.tsx +7 -1
- package/src/report/SupportTierBadge.tsx +2 -4
- package/src/report/constants.ts +0 -2
- package/src/report/index.ts +0 -56
- package/dist/report/FeatureStatusBadge.d.ts +0 -7
- package/dist/report/FeatureStatusBadge.d.ts.map +0 -1
- package/dist/report/FeatureStatusBadge.js +0 -13
- package/dist/report/HostPowerStates.d.ts +0 -9
- package/dist/report/HostPowerStates.d.ts.map +0 -1
- package/dist/report/HostPowerStates.js +0 -11
- package/dist/report/InfrastructureSummary.d.ts +0 -7
- package/dist/report/InfrastructureSummary.d.ts.map +0 -1
- package/dist/report/InfrastructureSummary.js +0 -5
- package/dist/report/PowerStateCard.d.ts +0 -17
- package/dist/report/PowerStateCard.d.ts.map +0 -1
- package/dist/report/PowerStateCard.js +0 -7
- package/dist/report/VCenterClusterDetails.d.ts +0 -10
- package/dist/report/VCenterClusterDetails.d.ts.map +0 -1
- package/dist/report/VCenterClusterDetails.js +0 -26
- package/dist/report/VmPowerStates.d.ts +0 -9
- package/dist/report/VmPowerStates.d.ts.map +0 -1
- package/dist/report/VmPowerStates.js +0 -11
- package/dist/report/infrastructureSummaryModel.d.ts +0 -82
- package/dist/report/infrastructureSummaryModel.d.ts.map +0 -1
- package/dist/report/infrastructureSummaryModel.js +0 -139
- package/dist/report/powerStates.d.ts +0 -11
- package/dist/report/powerStates.d.ts.map +0 -1
- package/dist/report/powerStates.js +0 -113
- package/src/report/FeatureStatusBadge.tsx +0 -30
- package/src/report/HostPowerStates.tsx +0 -41
- package/src/report/InfrastructureSummary.tsx +0 -56
- package/src/report/PowerStateCard.tsx +0 -73
- package/src/report/VCenterClusterDetails.tsx +0 -211
- package/src/report/VmPowerStates.tsx +0 -41
- package/src/report/__tests__/HostPowerStates.test.tsx +0 -47
- package/src/report/__tests__/InfrastructureSummary.test.tsx +0 -148
- package/src/report/__tests__/infrastructureSummaryModel.test.ts +0 -224
- package/src/report/__tests__/powerStates.test.ts +0 -70
- package/src/report/infrastructureSummaryModel.ts +0 -281
- package/src/report/powerStates.ts +0 -169
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Label } from "@patternfly/react-core";
|
|
2
|
-
import { CheckCircleIcon, TimesCircleIcon } from "@patternfly/react-icons";
|
|
3
|
-
import type { FC } from "react";
|
|
4
|
-
import type { FeatureStatus } from "./infrastructureSummaryModel.js";
|
|
5
|
-
|
|
6
|
-
export interface FeatureStatusBadgeProps {
|
|
7
|
-
status: FeatureStatus;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const FeatureStatusBadge: FC<FeatureStatusBadgeProps> = ({ status }) => {
|
|
11
|
-
if (status === "unknown") {
|
|
12
|
-
return <span>—</span>;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
if (status === "enabled") {
|
|
16
|
-
return (
|
|
17
|
-
<Label color="green" isCompact icon={<CheckCircleIcon />}>
|
|
18
|
-
Enabled
|
|
19
|
-
</Label>
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<Label color="grey" isCompact icon={<TimesCircleIcon />}>
|
|
25
|
-
Disabled
|
|
26
|
-
</Label>
|
|
27
|
-
);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
FeatureStatusBadge.displayName = "FeatureStatusBadge";
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { ServerIcon } from "@patternfly/react-icons";
|
|
2
|
-
import type { FC } from "react";
|
|
3
|
-
import { useMemo } from "react";
|
|
4
|
-
import type { MigrationDonutChartLegendVariant } from "../charts/MigrationDonutChart.js";
|
|
5
|
-
import { REPORT_CARD_EMPTY_STATE_TITLES } from "./constants.js";
|
|
6
|
-
import { PowerStateCard } from "./PowerStateCard.js";
|
|
7
|
-
import { buildHostPowerStateChart } from "./powerStates.js";
|
|
8
|
-
|
|
9
|
-
export interface HostPowerStatesProps {
|
|
10
|
-
hostPowerStates?: Record<string, number>;
|
|
11
|
-
isExportMode?: boolean;
|
|
12
|
-
legendVariant?: MigrationDonutChartLegendVariant;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const HostPowerStates: FC<HostPowerStatesProps> = ({
|
|
16
|
-
hostPowerStates,
|
|
17
|
-
isExportMode = false,
|
|
18
|
-
legendVariant,
|
|
19
|
-
}) => {
|
|
20
|
-
const chart = useMemo(
|
|
21
|
-
() => buildHostPowerStateChart(hostPowerStates),
|
|
22
|
-
[hostPowerStates],
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<PowerStateCard
|
|
27
|
-
id="esxi-host-power-states"
|
|
28
|
-
title="ESXi host power states"
|
|
29
|
-
icon={<ServerIcon />}
|
|
30
|
-
emptyTitle={REPORT_CARD_EMPTY_STATE_TITLES.hostPowerStates}
|
|
31
|
-
slices={chart.slices}
|
|
32
|
-
legend={chart.legend}
|
|
33
|
-
total={chart.total}
|
|
34
|
-
subTitle="Hosts"
|
|
35
|
-
isExportMode={isExportMode}
|
|
36
|
-
legendVariant={legendVariant}
|
|
37
|
-
/>
|
|
38
|
-
);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
HostPowerStates.displayName = "HostPowerStates";
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Card,
|
|
3
|
-
CardBody,
|
|
4
|
-
CardTitle,
|
|
5
|
-
DescriptionList,
|
|
6
|
-
DescriptionListDescription,
|
|
7
|
-
DescriptionListGroup,
|
|
8
|
-
DescriptionListTerm,
|
|
9
|
-
} from "@patternfly/react-core";
|
|
10
|
-
import type { FC } from "react";
|
|
11
|
-
import type { InfrastructureSummaryModel } from "./infrastructureSummaryModel.js";
|
|
12
|
-
|
|
13
|
-
export interface InfrastructureSummaryProps {
|
|
14
|
-
summary: InfrastructureSummaryModel;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const formatCount = (value: number | undefined): string =>
|
|
18
|
-
typeof value === "number" ? String(value) : "—";
|
|
19
|
-
|
|
20
|
-
export const InfrastructureSummary: FC<InfrastructureSummaryProps> = ({
|
|
21
|
-
summary,
|
|
22
|
-
}) => (
|
|
23
|
-
<Card isFullHeight id="infrastructure-summary">
|
|
24
|
-
<CardTitle>Infrastructure summary</CardTitle>
|
|
25
|
-
<CardBody>
|
|
26
|
-
<DescriptionList isAutoFit displaySize="lg">
|
|
27
|
-
<DescriptionListGroup>
|
|
28
|
-
<DescriptionListTerm>VMware version</DescriptionListTerm>
|
|
29
|
-
<DescriptionListDescription>
|
|
30
|
-
{summary.vmwareVersion}
|
|
31
|
-
</DescriptionListDescription>
|
|
32
|
-
</DescriptionListGroup>
|
|
33
|
-
<DescriptionListGroup>
|
|
34
|
-
<DescriptionListTerm>Datacenters</DescriptionListTerm>
|
|
35
|
-
<DescriptionListDescription>
|
|
36
|
-
{formatCount(summary.datacenters)}
|
|
37
|
-
</DescriptionListDescription>
|
|
38
|
-
</DescriptionListGroup>
|
|
39
|
-
<DescriptionListGroup>
|
|
40
|
-
<DescriptionListTerm>vCenters</DescriptionListTerm>
|
|
41
|
-
<DescriptionListDescription>
|
|
42
|
-
{formatCount(summary.vCenters)}
|
|
43
|
-
</DescriptionListDescription>
|
|
44
|
-
</DescriptionListGroup>
|
|
45
|
-
<DescriptionListGroup>
|
|
46
|
-
<DescriptionListTerm>ESXi hosts</DescriptionListTerm>
|
|
47
|
-
<DescriptionListDescription>
|
|
48
|
-
{formatCount(summary.esxiHosts)}
|
|
49
|
-
</DescriptionListDescription>
|
|
50
|
-
</DescriptionListGroup>
|
|
51
|
-
</DescriptionList>
|
|
52
|
-
</CardBody>
|
|
53
|
-
</Card>
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
InfrastructureSummary.displayName = "InfrastructureSummary";
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { Card, CardBody, CardTitle } from "@patternfly/react-core";
|
|
2
|
-
import type { FC, ReactNode } from "react";
|
|
3
|
-
import {
|
|
4
|
-
MigrationDonutChart,
|
|
5
|
-
type MigrationDonutChartDatum,
|
|
6
|
-
type MigrationDonutChartLegendVariant,
|
|
7
|
-
} from "../charts/MigrationDonutChart.js";
|
|
8
|
-
import { CardEmptyState } from "./CardEmptyState.js";
|
|
9
|
-
import { dashboardStyles } from "./dashboardStyles.js";
|
|
10
|
-
|
|
11
|
-
export interface PowerStateCardProps {
|
|
12
|
-
id: string;
|
|
13
|
-
title: string;
|
|
14
|
-
icon: ReactNode;
|
|
15
|
-
emptyTitle: string;
|
|
16
|
-
slices: MigrationDonutChartDatum[];
|
|
17
|
-
legend: Record<string, string>;
|
|
18
|
-
total: number;
|
|
19
|
-
subTitle: string;
|
|
20
|
-
isExportMode?: boolean;
|
|
21
|
-
itemsPerRow?: number;
|
|
22
|
-
legendVariant?: MigrationDonutChartLegendVariant;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export const PowerStateCard: FC<PowerStateCardProps> = ({
|
|
26
|
-
id,
|
|
27
|
-
title,
|
|
28
|
-
icon,
|
|
29
|
-
emptyTitle,
|
|
30
|
-
slices,
|
|
31
|
-
legend,
|
|
32
|
-
total,
|
|
33
|
-
subTitle,
|
|
34
|
-
isExportMode = false,
|
|
35
|
-
itemsPerRow = 2,
|
|
36
|
-
legendVariant = "html",
|
|
37
|
-
}) => (
|
|
38
|
-
<Card
|
|
39
|
-
className={isExportMode ? dashboardStyles.cardPrint : dashboardStyles.card}
|
|
40
|
-
id={id}
|
|
41
|
-
>
|
|
42
|
-
<CardTitle>
|
|
43
|
-
{icon} {title}
|
|
44
|
-
</CardTitle>
|
|
45
|
-
<CardBody>
|
|
46
|
-
{total === 0 ? (
|
|
47
|
-
<CardEmptyState title={emptyTitle} />
|
|
48
|
-
) : (
|
|
49
|
-
<MigrationDonutChart
|
|
50
|
-
legendVariant={legendVariant}
|
|
51
|
-
data={slices}
|
|
52
|
-
legend={legend}
|
|
53
|
-
height={300}
|
|
54
|
-
width={420}
|
|
55
|
-
donutThickness={18}
|
|
56
|
-
padAngle={1}
|
|
57
|
-
title={`${total}`}
|
|
58
|
-
subTitle={subTitle}
|
|
59
|
-
subTitleColor="var(--pf-t--global--text--color--subtle)"
|
|
60
|
-
titleFontSize={34}
|
|
61
|
-
labelFontSize={16}
|
|
62
|
-
itemsPerRow={itemsPerRow}
|
|
63
|
-
marginLeft="0%"
|
|
64
|
-
tooltipLabelFormatter={({ datum, percent }) =>
|
|
65
|
-
`${datum.countDisplay}\n${percent.toFixed(1)}%`
|
|
66
|
-
}
|
|
67
|
-
/>
|
|
68
|
-
)}
|
|
69
|
-
</CardBody>
|
|
70
|
-
</Card>
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
PowerStateCard.displayName = "PowerStateCard";
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import { css } from "@emotion/css";
|
|
2
|
-
import {
|
|
3
|
-
Card,
|
|
4
|
-
CardBody,
|
|
5
|
-
CardTitle,
|
|
6
|
-
Content,
|
|
7
|
-
DescriptionList,
|
|
8
|
-
DescriptionListDescription,
|
|
9
|
-
DescriptionListGroup,
|
|
10
|
-
DescriptionListTerm,
|
|
11
|
-
Grid,
|
|
12
|
-
GridItem,
|
|
13
|
-
Label,
|
|
14
|
-
LabelGroup,
|
|
15
|
-
} from "@patternfly/react-core";
|
|
16
|
-
import { Table, Tbody, Td, Th, Thead, Tr } from "@patternfly/react-table";
|
|
17
|
-
import type { FC } from "react";
|
|
18
|
-
import { FeatureStatusBadge } from "./FeatureStatusBadge.js";
|
|
19
|
-
import type {
|
|
20
|
-
ClusterDetailRow,
|
|
21
|
-
ClusterDetailsModel,
|
|
22
|
-
FeatureStatus,
|
|
23
|
-
} from "./infrastructureSummaryModel.js";
|
|
24
|
-
|
|
25
|
-
export interface VCenterClusterDetailsProps {
|
|
26
|
-
isAggregateView: boolean;
|
|
27
|
-
rows: ClusterDetailRow[];
|
|
28
|
-
details?: ClusterDetailsModel;
|
|
29
|
-
isExportMode?: boolean;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const clusterDetailsTableScrollStyle = css`
|
|
33
|
-
max-height: 320px;
|
|
34
|
-
overflow: auto;
|
|
35
|
-
`;
|
|
36
|
-
|
|
37
|
-
const FeatureList: FC<{
|
|
38
|
-
items: { label: string; status: FeatureStatus }[];
|
|
39
|
-
}> = ({ items }) => (
|
|
40
|
-
<DescriptionList isHorizontal isCompact>
|
|
41
|
-
{items.map((item) => (
|
|
42
|
-
<DescriptionListGroup key={item.label}>
|
|
43
|
-
<DescriptionListTerm>{item.label}</DescriptionListTerm>
|
|
44
|
-
<DescriptionListDescription>
|
|
45
|
-
<FeatureStatusBadge status={item.status} />
|
|
46
|
-
</DescriptionListDescription>
|
|
47
|
-
</DescriptionListGroup>
|
|
48
|
-
))}
|
|
49
|
-
</DescriptionList>
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
const AggregateClusterTable: FC<{
|
|
53
|
-
rows: ClusterDetailRow[];
|
|
54
|
-
}> = ({ rows }) => (
|
|
55
|
-
<Table
|
|
56
|
-
variant="compact"
|
|
57
|
-
borders={false}
|
|
58
|
-
isStickyHeader
|
|
59
|
-
data-testid="vcenter-cluster-details-table"
|
|
60
|
-
>
|
|
61
|
-
<Thead>
|
|
62
|
-
<Tr>
|
|
63
|
-
<Th>Cluster name</Th>
|
|
64
|
-
<Th>Hosts</Th>
|
|
65
|
-
<Th>VMs</Th>
|
|
66
|
-
<Th>vMotion</Th>
|
|
67
|
-
<Th>DRS</Th>
|
|
68
|
-
<Th>vSAN</Th>
|
|
69
|
-
</Tr>
|
|
70
|
-
</Thead>
|
|
71
|
-
<Tbody>
|
|
72
|
-
{rows.map((row) => (
|
|
73
|
-
<Tr key={row.id}>
|
|
74
|
-
<Td dataLabel="Cluster name">{row.name}</Td>
|
|
75
|
-
<Td dataLabel="Hosts">{row.hosts}</Td>
|
|
76
|
-
<Td dataLabel="VMs">{row.vms}</Td>
|
|
77
|
-
<Td dataLabel="vMotion">
|
|
78
|
-
<FeatureStatusBadge status={row.vmotion} />
|
|
79
|
-
</Td>
|
|
80
|
-
<Td dataLabel="DRS">
|
|
81
|
-
<FeatureStatusBadge status={row.drs} />
|
|
82
|
-
</Td>
|
|
83
|
-
<Td dataLabel="vSAN">
|
|
84
|
-
<FeatureStatusBadge status={row.vsan} />
|
|
85
|
-
</Td>
|
|
86
|
-
</Tr>
|
|
87
|
-
))}
|
|
88
|
-
</Tbody>
|
|
89
|
-
</Table>
|
|
90
|
-
);
|
|
91
|
-
|
|
92
|
-
const AggregateCluster: FC<{
|
|
93
|
-
rows: ClusterDetailRow[];
|
|
94
|
-
isExportMode: boolean;
|
|
95
|
-
}> = ({ rows, isExportMode }) => {
|
|
96
|
-
if (rows.length === 0) {
|
|
97
|
-
return <Content component="p">No vSphere clusters detected</Content>;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return (
|
|
101
|
-
<div
|
|
102
|
-
className={isExportMode ? undefined : clusterDetailsTableScrollStyle}
|
|
103
|
-
data-scroll-constrained={isExportMode ? undefined : "true"}
|
|
104
|
-
>
|
|
105
|
-
<AggregateClusterTable rows={rows} />
|
|
106
|
-
</div>
|
|
107
|
-
);
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
const DetailedClusterView: FC<{ details: ClusterDetailsModel }> = ({
|
|
111
|
-
details,
|
|
112
|
-
}) => (
|
|
113
|
-
<Grid hasGutter>
|
|
114
|
-
<GridItem span={12}>
|
|
115
|
-
<DescriptionList isAutoFit displaySize="lg">
|
|
116
|
-
<DescriptionListGroup>
|
|
117
|
-
<DescriptionListTerm>Hosts</DescriptionListTerm>
|
|
118
|
-
<DescriptionListDescription>
|
|
119
|
-
{details.hosts}
|
|
120
|
-
</DescriptionListDescription>
|
|
121
|
-
</DescriptionListGroup>
|
|
122
|
-
<DescriptionListGroup>
|
|
123
|
-
<DescriptionListTerm>VMs</DescriptionListTerm>
|
|
124
|
-
<DescriptionListDescription>{details.vms}</DescriptionListDescription>
|
|
125
|
-
</DescriptionListGroup>
|
|
126
|
-
<DescriptionListGroup>
|
|
127
|
-
<DescriptionListTerm>Networks detected</DescriptionListTerm>
|
|
128
|
-
<DescriptionListDescription>
|
|
129
|
-
{details.networksDetected}
|
|
130
|
-
</DescriptionListDescription>
|
|
131
|
-
</DescriptionListGroup>
|
|
132
|
-
</DescriptionList>
|
|
133
|
-
</GridItem>
|
|
134
|
-
<GridItem md={4} span={12}>
|
|
135
|
-
<Card isFullHeight>
|
|
136
|
-
<CardTitle>Core infrastructure</CardTitle>
|
|
137
|
-
<CardBody>
|
|
138
|
-
<FeatureList
|
|
139
|
-
items={[
|
|
140
|
-
{ label: "vMotion", status: details.vmotion },
|
|
141
|
-
{ label: "DRS", status: details.drs },
|
|
142
|
-
{ label: "HA", status: details.ha },
|
|
143
|
-
]}
|
|
144
|
-
/>
|
|
145
|
-
</CardBody>
|
|
146
|
-
</Card>
|
|
147
|
-
</GridItem>
|
|
148
|
-
<GridItem md={4} span={12}>
|
|
149
|
-
<Card isFullHeight>
|
|
150
|
-
<CardTitle>vSAN capabilities</CardTitle>
|
|
151
|
-
<CardBody>
|
|
152
|
-
<FeatureList items={[{ label: "vSAN", status: details.vsan }]} />
|
|
153
|
-
</CardBody>
|
|
154
|
-
</Card>
|
|
155
|
-
</GridItem>
|
|
156
|
-
<GridItem md={4} span={12}>
|
|
157
|
-
<Card isFullHeight>
|
|
158
|
-
<CardTitle>Network topology</CardTitle>
|
|
159
|
-
<CardBody>
|
|
160
|
-
{details.networks.length === 0 ? (
|
|
161
|
-
<Content component="p">No networks detected</Content>
|
|
162
|
-
) : (
|
|
163
|
-
<>
|
|
164
|
-
<Content component="p">
|
|
165
|
-
{details.networksDetected}{" "}
|
|
166
|
-
{details.networksDetected === 1
|
|
167
|
-
? "network detected"
|
|
168
|
-
: "networks detected"}
|
|
169
|
-
</Content>
|
|
170
|
-
<LabelGroup
|
|
171
|
-
isCompact
|
|
172
|
-
numLabels={details.networks.length}
|
|
173
|
-
aria-label="Detected networks"
|
|
174
|
-
>
|
|
175
|
-
{details.networks.map((network, index) => (
|
|
176
|
-
<Label
|
|
177
|
-
key={`${network.name}-${network.vlanId ?? index}`}
|
|
178
|
-
color="blue"
|
|
179
|
-
isCompact
|
|
180
|
-
>
|
|
181
|
-
{network.displayName}
|
|
182
|
-
</Label>
|
|
183
|
-
))}
|
|
184
|
-
</LabelGroup>
|
|
185
|
-
</>
|
|
186
|
-
)}
|
|
187
|
-
</CardBody>
|
|
188
|
-
</Card>
|
|
189
|
-
</GridItem>
|
|
190
|
-
</Grid>
|
|
191
|
-
);
|
|
192
|
-
|
|
193
|
-
export const VCenterClusterDetails: FC<VCenterClusterDetailsProps> = ({
|
|
194
|
-
isAggregateView,
|
|
195
|
-
rows,
|
|
196
|
-
details,
|
|
197
|
-
isExportMode = false,
|
|
198
|
-
}) => (
|
|
199
|
-
<Card isFullHeight id="vcenter-cluster-details">
|
|
200
|
-
<CardTitle>vCenter cluster details</CardTitle>
|
|
201
|
-
<CardBody>
|
|
202
|
-
{isAggregateView || !details ? (
|
|
203
|
-
<AggregateCluster rows={rows} isExportMode={isExportMode} />
|
|
204
|
-
) : (
|
|
205
|
-
<DetailedClusterView details={details} />
|
|
206
|
-
)}
|
|
207
|
-
</CardBody>
|
|
208
|
-
</Card>
|
|
209
|
-
);
|
|
210
|
-
|
|
211
|
-
VCenterClusterDetails.displayName = "VCenterClusterDetails";
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { VirtualMachineIcon } from "@patternfly/react-icons";
|
|
2
|
-
import type { FC } from "react";
|
|
3
|
-
import { useMemo } from "react";
|
|
4
|
-
import type { MigrationDonutChartLegendVariant } from "../charts/MigrationDonutChart.js";
|
|
5
|
-
import { REPORT_CARD_EMPTY_STATE_TITLES } from "./constants.js";
|
|
6
|
-
import { PowerStateCard } from "./PowerStateCard.js";
|
|
7
|
-
import { buildVmPowerStateChart } from "./powerStates.js";
|
|
8
|
-
|
|
9
|
-
export interface VmPowerStatesProps {
|
|
10
|
-
powerStates?: Record<string, number>;
|
|
11
|
-
isExportMode?: boolean;
|
|
12
|
-
legendVariant?: MigrationDonutChartLegendVariant;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const VmPowerStates: FC<VmPowerStatesProps> = ({
|
|
16
|
-
powerStates,
|
|
17
|
-
isExportMode = false,
|
|
18
|
-
legendVariant,
|
|
19
|
-
}) => {
|
|
20
|
-
const chart = useMemo(
|
|
21
|
-
() => buildVmPowerStateChart(powerStates),
|
|
22
|
-
[powerStates],
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<PowerStateCard
|
|
27
|
-
id="vm-power-states"
|
|
28
|
-
title="VM power states"
|
|
29
|
-
icon={<VirtualMachineIcon />}
|
|
30
|
-
emptyTitle={REPORT_CARD_EMPTY_STATE_TITLES.vmPowerStates}
|
|
31
|
-
slices={chart.slices}
|
|
32
|
-
legend={chart.legend}
|
|
33
|
-
total={chart.total}
|
|
34
|
-
subTitle="VMs"
|
|
35
|
-
isExportMode={isExportMode}
|
|
36
|
-
legendVariant={legendVariant}
|
|
37
|
-
/>
|
|
38
|
-
);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
VmPowerStates.displayName = "VmPowerStates";
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import "@testing-library/jest-dom";
|
|
2
|
-
import { cleanup, render, screen } from "@testing-library/react";
|
|
3
|
-
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
4
|
-
import { HostPowerStates } from "../HostPowerStates.js";
|
|
5
|
-
import { VmPowerStates } from "../VmPowerStates.js";
|
|
6
|
-
|
|
7
|
-
vi.mock("../../charts/MigrationDonutChart.js", () => ({
|
|
8
|
-
MigrationDonutChart: ({
|
|
9
|
-
title,
|
|
10
|
-
subTitle,
|
|
11
|
-
}: {
|
|
12
|
-
title?: string;
|
|
13
|
-
subTitle?: string;
|
|
14
|
-
}): JSX.Element => (
|
|
15
|
-
<div data-testid="power-donut">
|
|
16
|
-
{title} {subTitle}
|
|
17
|
-
</div>
|
|
18
|
-
),
|
|
19
|
-
}));
|
|
20
|
-
|
|
21
|
-
afterEach(() => cleanup());
|
|
22
|
-
|
|
23
|
-
describe("HostPowerStates", () => {
|
|
24
|
-
it("renders the host power donut from inventory data", () => {
|
|
25
|
-
render(<HostPowerStates hostPowerStates={{ green: 7 }} />);
|
|
26
|
-
|
|
27
|
-
expect(screen.getByText("ESXi host power states")).toBeInTheDocument();
|
|
28
|
-
expect(screen.getByTestId("power-donut")).toHaveTextContent("7 Hosts");
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it("shows an empty state when host power data is missing", () => {
|
|
32
|
-
render(<HostPowerStates hostPowerStates={{}} />);
|
|
33
|
-
|
|
34
|
-
expect(
|
|
35
|
-
screen.getByText("Host power state data not collected"),
|
|
36
|
-
).toBeInTheDocument();
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
describe("VmPowerStates", () => {
|
|
41
|
-
it("renders the VM power donut from inventory data", () => {
|
|
42
|
-
render(<VmPowerStates powerStates={{ poweredOff: 297, poweredOn: 53 }} />);
|
|
43
|
-
|
|
44
|
-
expect(screen.getByText("VM power states")).toBeInTheDocument();
|
|
45
|
-
expect(screen.getByTestId("power-donut")).toHaveTextContent("350 VMs");
|
|
46
|
-
});
|
|
47
|
-
});
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import "@testing-library/jest-dom";
|
|
2
|
-
import { cleanup, render, screen } from "@testing-library/react";
|
|
3
|
-
import { afterEach, describe, expect, it } from "vitest";
|
|
4
|
-
import { InfrastructureSummary } from "../InfrastructureSummary.js";
|
|
5
|
-
import { VCenterClusterDetails } from "../VCenterClusterDetails.js";
|
|
6
|
-
|
|
7
|
-
afterEach(() => cleanup());
|
|
8
|
-
|
|
9
|
-
describe("InfrastructureSummary", () => {
|
|
10
|
-
it("renders inventory summary fields from the mapped model", () => {
|
|
11
|
-
render(
|
|
12
|
-
<InfrastructureSummary
|
|
13
|
-
summary={{
|
|
14
|
-
vmwareVersion: "vSphere 7.0.3",
|
|
15
|
-
datacenters: 1,
|
|
16
|
-
vCenters: 1,
|
|
17
|
-
esxiHosts: 12,
|
|
18
|
-
}}
|
|
19
|
-
/>,
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
expect(screen.getByText("Infrastructure summary")).toBeInTheDocument();
|
|
23
|
-
expect(screen.getByText("vSphere 7.0.3")).toBeInTheDocument();
|
|
24
|
-
expect(screen.getByText("Datacenters")).toBeInTheDocument();
|
|
25
|
-
expect(screen.getByText("vCenters")).toBeInTheDocument();
|
|
26
|
-
expect(screen.getByText("ESXi hosts")).toBeInTheDocument();
|
|
27
|
-
expect(screen.getByText("12")).toBeInTheDocument();
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
describe("VCenterClusterDetails", () => {
|
|
32
|
-
it("renders the aggregate cluster table with feature statuses", () => {
|
|
33
|
-
render(
|
|
34
|
-
<VCenterClusterDetails
|
|
35
|
-
isAggregateView
|
|
36
|
-
rows={[
|
|
37
|
-
{
|
|
38
|
-
id: "Cluster-Prod-01",
|
|
39
|
-
name: "Cluster-Prod-01",
|
|
40
|
-
hosts: 5,
|
|
41
|
-
vms: 280,
|
|
42
|
-
vmotion: "enabled",
|
|
43
|
-
drs: "enabled",
|
|
44
|
-
vsan: "enabled",
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
id: "Cluster-Dev-02",
|
|
48
|
-
name: "Cluster-Dev-02",
|
|
49
|
-
hosts: 7,
|
|
50
|
-
vms: 350,
|
|
51
|
-
vmotion: "enabled",
|
|
52
|
-
drs: "disabled",
|
|
53
|
-
vsan: "enabled",
|
|
54
|
-
},
|
|
55
|
-
]}
|
|
56
|
-
/>,
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
expect(screen.getByText("vCenter cluster details")).toBeInTheDocument();
|
|
60
|
-
expect(screen.getByText("Cluster-Prod-01")).toBeInTheDocument();
|
|
61
|
-
expect(screen.getByText("Cluster-Dev-02")).toBeInTheDocument();
|
|
62
|
-
expect(screen.getAllByText("Enabled").length).toBeGreaterThan(0);
|
|
63
|
-
expect(screen.getByText("Disabled")).toBeInTheDocument();
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
it("limits the aggregate table height so long cluster lists can scroll", () => {
|
|
67
|
-
render(
|
|
68
|
-
<VCenterClusterDetails
|
|
69
|
-
isAggregateView
|
|
70
|
-
rows={Array.from({ length: 12 }, (_, index) => ({
|
|
71
|
-
id: `cluster-${index}`,
|
|
72
|
-
name: `cluster-${index}`,
|
|
73
|
-
hosts: index + 1,
|
|
74
|
-
vms: (index + 1) * 10,
|
|
75
|
-
vmotion: "unknown",
|
|
76
|
-
drs: "unknown",
|
|
77
|
-
vsan: "disabled",
|
|
78
|
-
}))}
|
|
79
|
-
/>,
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
expect(
|
|
83
|
-
screen.getByTestId("vcenter-cluster-details-table").parentElement,
|
|
84
|
-
).toHaveAttribute("data-scroll-constrained", "true");
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
it("does not clip the aggregate table in export mode", () => {
|
|
88
|
-
render(
|
|
89
|
-
<VCenterClusterDetails
|
|
90
|
-
isAggregateView
|
|
91
|
-
isExportMode
|
|
92
|
-
rows={Array.from({ length: 12 }, (_, index) => ({
|
|
93
|
-
id: `cluster-${index}`,
|
|
94
|
-
name: `cluster-${index}`,
|
|
95
|
-
hosts: index + 1,
|
|
96
|
-
vms: (index + 1) * 10,
|
|
97
|
-
vmotion: "unknown",
|
|
98
|
-
drs: "unknown",
|
|
99
|
-
vsan: "disabled",
|
|
100
|
-
}))}
|
|
101
|
-
/>,
|
|
102
|
-
);
|
|
103
|
-
|
|
104
|
-
expect(
|
|
105
|
-
screen.getByTestId("vcenter-cluster-details-table").parentElement,
|
|
106
|
-
).not.toHaveAttribute("data-scroll-constrained");
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
it("renders the detailed cluster cards for a single cluster", () => {
|
|
110
|
-
render(
|
|
111
|
-
<VCenterClusterDetails
|
|
112
|
-
isAggregateView={false}
|
|
113
|
-
rows={[]}
|
|
114
|
-
details={{
|
|
115
|
-
hosts: 7,
|
|
116
|
-
vms: 350,
|
|
117
|
-
networksDetected: 2,
|
|
118
|
-
vmotion: "enabled",
|
|
119
|
-
drs: "disabled",
|
|
120
|
-
ha: "enabled",
|
|
121
|
-
vsan: "disabled",
|
|
122
|
-
networks: [
|
|
123
|
-
{
|
|
124
|
-
name: "VDS-Dev",
|
|
125
|
-
vlanId: "10",
|
|
126
|
-
displayName: "VDS-Dev (VLAN 10)",
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
name: "VDS-Dev",
|
|
130
|
-
vlanId: "11",
|
|
131
|
-
displayName: "VDS-Dev (VLAN 11)",
|
|
132
|
-
},
|
|
133
|
-
],
|
|
134
|
-
}}
|
|
135
|
-
/>,
|
|
136
|
-
);
|
|
137
|
-
|
|
138
|
-
expect(screen.getByText("Core infrastructure")).toBeInTheDocument();
|
|
139
|
-
expect(screen.getByText("vSAN capabilities")).toBeInTheDocument();
|
|
140
|
-
expect(screen.getByText("Network topology")).toBeInTheDocument();
|
|
141
|
-
expect(screen.getByText("vMotion")).toBeInTheDocument();
|
|
142
|
-
expect(screen.getByText("DRS")).toBeInTheDocument();
|
|
143
|
-
expect(screen.getByText("HA")).toBeInTheDocument();
|
|
144
|
-
expect(screen.getByText("VDS-Dev (VLAN 10)")).toBeInTheDocument();
|
|
145
|
-
expect(screen.getByText("VDS-Dev (VLAN 11)")).toBeInTheDocument();
|
|
146
|
-
expect(screen.queryByText("VM encryption")).toBeNull();
|
|
147
|
-
});
|
|
148
|
-
});
|