@openshift-assisted/ui-lib
Version:
React component library for the Assisted Installer UI
81 lines • 4.26 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ReviewClusterDetailTable = void 0;
const tslib_1 = require("tslib");
const react_1 = tslib_1.__importDefault(require("react"));
const react_table_1 = require("@patternfly/react-table");
const common_1 = require("../../../../common");
const ClusterProperties_1 = require("../../clusterDetail/ClusterProperties");
const OpenShiftVersionDetail_1 = tslib_1.__importDefault(require("../../clusterDetail/OpenShiftVersionDetail"));
const newFeatureSupportLevels_1 = require("../../../../common/components/newFeatureSupportLevels");
const ReviewClusterDetailTable = ({ cluster }) => {
const { activeFeatureConfiguration } = (0, newFeatureSupportLevels_1.useNewFeatureSupportLevel)();
const rows = react_1.default.useMemo(() => {
var _a;
const cpuArchitecture = (activeFeatureConfiguration === null || activeFeatureConfiguration === void 0 ? void 0 : activeFeatureConfiguration.underlyingCpuArchitecture) || (0, common_1.getDefaultCpuArchitecture)();
const hasStaticIp = (activeFeatureConfiguration === null || activeFeatureConfiguration === void 0 ? void 0 : activeFeatureConfiguration.hasStaticIpNetworking) || false;
const rows = [
{
rowId: 'address',
cells: [
{ title: 'Cluster address' },
{
title: (react_1.default.createElement(react_1.default.Fragment, null,
cluster.name || '',
'.',
cluster.baseDnsDomain || '')),
props: { 'data-testid': 'cluster-address' },
},
],
},
{
rowId: 'version',
cells: [
{ title: 'OpenShift version' },
{
title: react_1.default.createElement(OpenShiftVersionDetail_1.default, { cluster: cluster }),
props: { 'data-testid': 'openshift-version' },
},
],
},
{
rowId: 'cpuArchitecture',
cells: [
{ title: 'CPU architecture' },
{
title: react_1.default.createElement(react_1.default.Fragment, null, cpuArchitecture),
props: { 'data-testid': 'cpu-architecture' },
},
],
},
{
rowId: 'hostNetwork',
cells: [
{ title: "Hosts' network configuration" },
{
title: react_1.default.createElement(react_1.default.Fragment, null, hasStaticIp ? 'Static IP' : 'DHCP'),
props: { 'data-testid': 'network-configuration' },
},
],
},
];
const diskEncryptionTitle = (0, ClusterProperties_1.getDiskEncryptionEnabledOnStatus)((_a = cluster.diskEncryption) === null || _a === void 0 ? void 0 : _a.enableOn);
if (diskEncryptionTitle) {
rows.push({
rowId: 'diskEncryption',
cells: [
{ title: 'Disk encryption' },
{
title: diskEncryptionTitle,
props: { 'data-testid': 'disk-encryption' },
},
],
});
}
return rows;
}, [cluster, activeFeatureConfiguration]);
return (react_1.default.createElement(react_table_1.Table, { variant: react_table_1.TableVariant.compact, borders: false, "aria-label": 'Cluster details review table', className: "review-table" },
react_1.default.createElement(react_table_1.Tbody, null, rows.map((row, i) => (react_1.default.createElement(react_table_1.Tr, { key: (0, common_1.genericTableRowKey)(row.rowId) }, row.cells.map((cell, j) => (react_1.default.createElement(react_table_1.Td, Object.assign({ key: `cell-${i}-${j}` }, cell.props), cell.title)))))))));
};
exports.ReviewClusterDetailTable = ReviewClusterDetailTable;
//# sourceMappingURL=ReviewClusterDetailTable.js.map