"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.odfUsageColumn = exports.numberOfDisksColumn = exports.roleColumn = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const react_core_1 = require("@patternfly/react-core");
const exclamation_triangle_icon_1 = require("@patternfly/react-icons/dist/js/icons/exclamation-triangle-icon");
const index_1 = require("../../index");
const SkipFormattingDisks = () => (React.createElement(react_core_1.Content, { component: react_core_1.ContentVariants.p }, "Some bootable disks will skip formatting"));
const roleColumn = (t, schedulableMasters) => {
    return {
        header: {
            title: 'Role',
            props: {
                id: 'col-header-role',
            },
            sort: true,
        },
        cell: (host) => {
            const hostRole = (0, index_1.getHostRole)(host, t, schedulableMasters);
            return {
                title: React.createElement(index_1.RoleCell, { host: host, role: hostRole }),
                props: { 'data-testid': 'host-role' },
                sortableValue: hostRole,
            };
        },
    };
};
exports.roleColumn = roleColumn;
exports.numberOfDisksColumn = {
    header: {
        title: 'Number of disks',
        props: {
            id: 'col-header-num-disks',
        },
        sort: true,
    },
    cell: (host) => {
        const inventory = (0, index_1.getInventory)(host);
        const disks = inventory.disks || [];
        return {
            title: (React.createElement(React.Fragment, null,
                ' ',
                disks.length,
                '   ',
                host.skipFormattingDisks && (React.createElement(react_core_1.Popover, { bodyContent: React.createElement(SkipFormattingDisks, null), minWidth: "20rem", maxWidth: "30rem" },
                    React.createElement(react_core_1.Icon, { size: "sm", status: "warning" },
                        React.createElement(exclamation_triangle_icon_1.ExclamationTriangleIcon, null)))))),
            props: { 'data-testid': 'disk-number' },
            sortableValue: disks.length,
        };
    },
};
const odfUsageColumn = (excludeMasters) => {
    return {
        header: {
            title: 'ODF Usage',
            props: {
                id: 'col-header-odf',
            },
            sort: true,
        },
        cell: (host) => {
            const isMaster = host.role === 'master' || host.suggestedRole === 'master';
            const isExcluded = excludeMasters && isMaster;
            return {
                title: isExcluded ? (React.createElement("div", { style: {
                        color: 'var(--pf-t--global--icon--color--disabled)',
                    } }, "Excluded for ODF")) : ('Use ODF'),
                props: { 'data-testid': 'use-odf' },
                sortableValue: Number(isExcluded),
            };
        },
    };
};
exports.odfUsageColumn = odfUsageColumn;
//# sourceMappingURL=StorageUtils.js.map