"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 utils_1 = require("../../../common/components/ui/table/utils");
const config_1 = require("../../../common/config");
const helpers_1 = require("../helpers");
const LogsDownloadButton_1 = require("./LogsDownloadButton");
const use_translation_wrapper_1 = require("../../../common/hooks/use-translation-wrapper");
const getID = (suffix) => `cluster-install-error-${suffix}`;
const ClusterInstallationError = ({ agentClusterInstall, }) => {
    const [clusterStatus, statusInfo] = (0, helpers_1.getClusterStatus)(agentClusterInstall);
    const { t } = (0, use_translation_wrapper_1.useTranslation)();
    const title = clusterStatus === 'cancelled'
        ? t('ai:Cluster installation was cancelled')
        : t('ai:Cluster installation failed');
    return (react_1.default.createElement(react_core_1.GridItem, null,
        react_1.default.createElement(react_core_1.Alert, { variant: react_core_1.AlertVariant.danger, title: title, actionLinks: react_1.default.createElement(react_1.default.Fragment, null,
                react_1.default.createElement(LogsDownloadButton_1.LogsDownloadButton, { id: getID('button-download-installation-logs'), Component: react_core_1.AlertActionLink, agentClusterInstall: agentClusterInstall }),
                react_1.default.createElement(react_core_1.AlertActionLink, { onClick: () => window.open((0, config_1.getReportIssueLink)(), '_blank'), id: getID('button-report-bug') }, t('ai:Report a bug'))), isInline: true }, (0, utils_1.toSentence)(statusInfo))));
};
exports.default = ClusterInstallationError;
//# sourceMappingURL=ClusterInstallationError.js.map