@openshift-assisted/ui-lib
Version:
React component library for the Assisted Installer UI
36 lines • 2.12 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.ReviewOperatorsTable = 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 TableSummaryExpandable_1 = require("./TableSummaryExpandable");
const operatorSpecs_1 = require("../../../../common/components/operators/operatorSpecs");
const ReviewOperatorsTable = ({ cluster }) => {
const { byKey: opSpecs } = (0, operatorSpecs_1.useOperatorSpecs)();
const rows = react_1.default.useMemo(() => {
var _a;
return (_a = cluster.monitoredOperators) === null || _a === void 0 ? void 0 : _a.filter(({ name }) => !!name && !!opSpecs[name]).map((op) => {
const opId = op.name;
return {
rowId: `operator-${opId}`,
cells: [
{ title: opSpecs[opId].title },
{
title: 'Enabled',
props: { 'data-testid': `operator-${opId}` },
},
],
};
});
}, [cluster.monitoredOperators, opSpecs]);
if (!(rows === null || rows === void 0 ? void 0 : rows.length)) {
return null;
}
return (react_1.default.createElement(TableSummaryExpandable_1.TableSummaryExpandable, { title: 'Operators', id: 'operators-expandable' },
react_1.default.createElement(react_table_1.Table, { variant: react_table_1.TableVariant.compact, borders: false, "aria-label": 'Operators 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.ReviewOperatorsTable = ReviewOperatorsTable;
//# sourceMappingURL=ReviewOperatorsTable.js.map
;