"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const react_1 = tslib_1.__importDefault(require("react"));
const react_core_1 = require("@patternfly/react-core");
const common_1 = require("../../../common");
const ClusterHostsTable_1 = tslib_1.__importDefault(require("../hosts/ClusterHostsTable"));
const ClusterDetailsButtonGroup_1 = tslib_1.__importDefault(require("./ClusterDetailsButtonGroup"));
const ClusterStatus_1 = require("../clusters/ClusterStatus");
const ClusterDetailStatusVarieties_1 = tslib_1.__importStar(require("./ClusterDetailStatusVarieties"));
const ClusterInstallationProgressCard = ({ cluster }) => {
    var _a;
    const [isCardExpanded, setIsCardExpanded] = react_1.default.useState(true);
    const clusterVarieties = (0, ClusterDetailStatusVarieties_1.useClusterStatusVarieties)(cluster);
    return (react_1.default.createElement(react_core_1.Card, { "data-testid": "ai-cluster-details-card", isExpanded: isCardExpanded },
        react_1.default.createElement(react_core_1.CardHeader, { onExpand: () => setIsCardExpanded(!isCardExpanded), toggleButtonProps: {
                'data-testid': 'toggle-ai-cluster-details',
                'aria-label': 'AI Cluster Details',
                'aria-labelledby': 'titleId toggle-button',
                'aria-expanded': isCardExpanded,
            } },
            react_1.default.createElement(react_core_1.Title, { headingLevel: "h1", size: "lg", className: "card-title" }, "Installation progress"),
            !isCardExpanded && (react_1.default.createElement("div", { className: "pf-v6-u-ml-md" },
                react_1.default.createElement(ClusterStatus_1.ClusterStatusIcon, { status: cluster.status })))),
        react_1.default.createElement(react_core_1.CardBody, null,
            react_1.default.createElement(react_core_1.Stack, { hasGutter: true },
                react_1.default.createElement(react_core_1.StackItem, null,
                    react_1.default.createElement(common_1.ClusterProgress, { cluster: cluster, minimizedView: !isCardExpanded, totalPercentage: ((_a = cluster.progress) === null || _a === void 0 ? void 0 : _a.totalPercentage) || 0 })),
                react_1.default.createElement(react_core_1.StackItem, null,
                    react_1.default.createElement(ClusterDetailsButtonGroup_1.default, { cluster: cluster, credentials: clusterVarieties.credentials, credentialsError: clusterVarieties.credentialsError, showKubeConfig: false })))),
        react_1.default.createElement(react_core_1.CardExpandableContent, null,
            react_1.default.createElement(react_core_1.CardBody, null,
                react_1.default.createElement(react_core_1.Stack, { hasGutter: true },
                    react_1.default.createElement(react_core_1.StackItem, { className: "pf-v6-u-mt-lg" },
                        react_1.default.createElement(ClusterDetailStatusVarieties_1.default, { cluster: cluster, clusterVarieties: clusterVarieties, showAddHostsInfo: false })),
                    react_1.default.createElement(react_core_1.StackItem, { className: "pf-v6-u-mt-lg" },
                        react_1.default.createElement(ClusterHostsTable_1.default, { cluster: cluster, skipDisabled: true })))))));
};
exports.default = ClusterInstallationProgressCard;
//# sourceMappingURL=ClusterInstallationProgressCard.js.map