@openshift-assisted/ui-lib
Version:
React component library for the Assisted Installer UI
16 lines • 1.14 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.LogsDownloadButton = void 0;
const tslib_1 = require("tslib");
const react_1 = tslib_1.__importDefault(require("react"));
const file_saver_1 = require("file-saver");
const react_core_1 = require("@patternfly/react-core");
const use_translation_wrapper_1 = require("../../../common/hooks/use-translation-wrapper");
const LogsDownloadButton = ({ Component = react_core_1.Button, agentClusterInstall, id, variant, }) => {
var _a, _b;
const { t } = (0, use_translation_wrapper_1.useTranslation)();
const logsURL = (_b = (_a = agentClusterInstall === null || agentClusterInstall === void 0 ? void 0 : agentClusterInstall.status) === null || _a === void 0 ? void 0 : _a.debugInfo) === null || _b === void 0 ? void 0 : _b.logsURL;
return (react_1.default.createElement(Component, { onClick: () => logsURL && (0, file_saver_1.saveAs)(logsURL, 'logs.tar'), isDisabled: !logsURL, id: id, variant: variant }, t('ai:Download Installation Logs')));
};
exports.LogsDownloadButton = LogsDownloadButton;
//# sourceMappingURL=LogsDownloadButton.js.map