"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 utils_1 = require("./utils");
const ModalDialogsContext_1 = require("../hosts/ModalDialogsContext");
const getID = (suffix) => `cluster-install-error-${suffix}`;
const ClusterInstallationError = ({ cluster, title = 'Cluster installation failed', }) => {
    const { addAlert, clearAlerts } = (0, common_1.useAlerts)();
    const { resetClusterDialog } = (0, ModalDialogsContext_1.useModalDialogsContext)();
    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(react_core_1.AlertActionLink, { onClick: () => resetClusterDialog.open({ cluster }), id: getID('button-reset-cluster') }, "Reset Cluster"),
                react_1.default.createElement(react_core_1.AlertActionLink, { onClick: () => {
                        void (0, utils_1.downloadClusterInstallationLogs)(addAlert, cluster.id, clearAlerts);
                    }, isDisabled: !(0, common_1.canDownloadClusterLogs)(cluster), id: getID('button-download-installation-logs') }, "Download Installation Logs"),
                react_1.default.createElement(react_core_1.AlertActionLink, { onClick: () => window.open((0, common_1.getReportIssueLink)(), '_blank'), id: getID('button-report-bug') }, "Report a bug")), isInline: true },
            react_1.default.createElement(react_core_1.Content, { component: "p" },
                (0, common_1.toSentence)(cluster.statusInfo),
                react_1.default.createElement("br", null),
                "Reset the installation process to return to the configuration and try again. Some hosts may need to be re-registered by rebooting into the Discovery ISO."))));
};
exports.default = ClusterInstallationError;
//# sourceMappingURL=ClusterInstallationError.js.map