"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EnvironmentErrors = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const helpers_1 = require("../helpers");
const ResourceAlerts_1 = require("../common/ResourceAlerts");
const react_core_1 = require("@patternfly/react-core");
const constants_1 = require("../common/constants");
const use_translation_wrapper_1 = require("../../../common/hooks/use-translation-wrapper");
const EnvironmentErrors = ({ infraEnv, docVersion, children, }) => {
    const infraEnvAlerts = (0, helpers_1.getFailingResourceConditions)(infraEnv, ['ImageCreated']);
    const { t } = (0, use_translation_wrapper_1.useTranslation)();
    if (infraEnv.status && !infraEnvAlerts.length) {
        return React.createElement(React.Fragment, null, children);
    }
    return (React.createElement(React.Fragment, null,
        !infraEnv.status && (React.createElement(react_core_1.Alert, { title: t('ai:Central infrastructure management is not running'), variant: react_core_1.AlertVariant.warning, isInline: true, className: "cim-resource-alerts", actionLinks: React.createElement("a", { href: (0, constants_1.getInfraEnvDocs)(docVersion), target: "_blank", rel: "noopener noreferrer" }, t('ai:Open documentation')) }, t('ai:It seems the Central infrastructure management is not configured which will prevent its features to be used. Please refer to the documentation for the first time setup steps.'))),
        React.createElement(ResourceAlerts_1.SingleResourceAlerts, { title: t('ai:Failing infrastructure environment'), conditions: infraEnvAlerts })));
};
exports.EnvironmentErrors = EnvironmentErrors;
//# sourceMappingURL=EnvironmentErrors.js.map