"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const react_core_1 = require("@patternfly/react-core");
const React = tslib_1.__importStar(require("react"));
const utils_1 = require("../utils");
const use_translation_wrapper_1 = require("../../../../common/hooks/use-translation-wrapper");
const ConditionsTable_1 = tslib_1.__importDefault(require("./ConditionsTable"));
const ValidationsRunningAlert_1 = tslib_1.__importDefault(require("../../common/ValidationsRunningAlert"));
const NodePoolStatus = ({ nodePool, agents }) => {
    var _a;
    const { t } = (0, use_translation_wrapper_1.useTranslation)();
    const status = (0, utils_1.getNodePoolStatus)(nodePool, agents, t);
    return (React.createElement(react_core_1.Flex, { alignItems: { default: 'alignItemsCenter' }, spaceItems: { default: 'spaceItemsXs' } },
        React.createElement(react_core_1.FlexItem, null, status.icon),
        React.createElement(react_core_1.FlexItem, null,
            React.createElement(react_core_1.Popover, { "aria-label": "node pool status", headerContent: React.createElement("div", null, t('ai:Nodepool conditions')), hasAutoWidth: true, showClose: false, bodyContent: React.createElement(react_core_1.Stack, { hasGutter: true },
                    status.type === 'error' && (React.createElement(React.Fragment, null,
                        React.createElement(react_core_1.StackItem, null,
                            React.createElement(ValidationsRunningAlert_1.default, null)),
                        React.createElement(react_core_1.StackItem, null,
                            React.createElement(react_core_1.Alert, { variant: "danger", isInline: true, title: t('ai:Some hosts are in an error state.') })))),
                    status.type === 'warning' && (React.createElement(React.Fragment, null,
                        React.createElement(react_core_1.StackItem, null,
                            React.createElement(ValidationsRunningAlert_1.default, null)),
                        React.createElement(react_core_1.StackItem, null,
                            React.createElement(react_core_1.Alert, { variant: "warning", isInline: true, title: t('ai:Some hosts are in a warning state.') })))),
                    React.createElement(react_core_1.StackItem, null,
                        React.createElement(ConditionsTable_1.default, { conditions: (_a = nodePool.status) === null || _a === void 0 ? void 0 : _a.conditions, isDone: true }))) },
                React.createElement(react_core_1.Button, { variant: "link", isInline: true }, status.text)))));
};
exports.default = NodePoolStatus;
//# sourceMappingURL=NodePoolStatus.js.map