@skbkontur/cassandra-distributed-task-queue-ui
Version:
.NET library implementing distributed task queue machinery using Apache Cassandra
62 lines • 6.64 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ErrorHandlingContainerModal = void 0;
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const edi_ui_1 = require("@skbkontur/edi-ui");
const CopyIcon16Regular_1 = require("@skbkontur/icons/CopyIcon16Regular");
const react_stack_layout_1 = require("@skbkontur/react-stack-layout");
const react_ui_1 = require("@skbkontur/react-ui");
const react_1 = tslib_1.__importDefault(require("react"));
const ErrorHandlingContainer_styles_1 = require("./ErrorHandlingContainer.styles");
class ErrorHandlingContainerModal extends react_1.default.Component {
constructor() {
super(...arguments);
Object.defineProperty(this, "state", {
enumerable: true,
configurable: true,
writable: true,
value: { showStack: false }
});
Object.defineProperty(this, "theme", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "handleKeyPress", {
enumerable: true,
configurable: true,
writable: true,
value: (e) => {
if (e.key === "h") {
this.setState({ showStack: true });
}
}
});
}
componentDidMount() {
window.addEventListener("keypress", this.handleKeyPress);
}
componentWillUnmount() {
window.removeEventListener("keypress", this.handleKeyPress);
}
render() {
return (jsx_runtime_1.jsx(react_ui_1.ThemeContext.Consumer, { children: theme => {
this.theme = theme;
return this.renderMain();
} }, void 0));
}
renderMain() {
const { canClose, message, onClose, serverStack, stack } = this.props;
const { showStack } = this.state;
return (jsx_runtime_1.jsxs(react_ui_1.Modal, Object.assign({ "data-tid": "ErrorHandlingContainerModal", onClose: canClose ? onClose : undefined, noClose: !canClose }, { children: [jsx_runtime_1.jsx(react_ui_1.Modal.Header, Object.assign({ "data-tid": "Header" }, { children: jsx_runtime_1.jsx("span", Object.assign({ className: ErrorHandlingContainer_styles_1.jsStyles.modalText(this.theme) }, { children: "\u041F\u0440\u043E\u0438\u0437\u043E\u0448\u043B\u0430 \u043D\u0435\u043F\u0440\u0435\u0434\u0432\u0438\u0434\u0435\u043D\u043D\u0430\u044F \u043E\u0448\u0438\u0431\u043A\u0430" }), void 0) }), void 0), jsx_runtime_1.jsx(react_ui_1.Modal.Body, { children: jsx_runtime_1.jsxs("div", Object.assign({ className: ErrorHandlingContainer_styles_1.jsStyles.modalText(this.theme) }, { children: [jsx_runtime_1.jsx("div", Object.assign({ className: ErrorHandlingContainer_styles_1.jsStyles.userMessage() }, { children: jsx_runtime_1.jsx("div", Object.assign({ "data-tid": "CallToActionInErrorMessage" }, { children: jsx_runtime_1.jsx("div", Object.assign({ className: ErrorHandlingContainer_styles_1.jsStyles.content() }, { children: jsx_runtime_1.jsx("p", { children: "\u041F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u043F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C \u0437\u0430\u043F\u0440\u043E\u0441 \u0438\u043B\u0438 \u043E\u0431\u043D\u043E\u0432\u0438\u0442\u044C \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0443 \u0447\u0435\u0440\u0435\u0437 \u043D\u0435\u043A\u043E\u0442\u043E\u0440\u043E\u0435 \u0432\u0440\u0435\u043C\u044F." }, void 0) }), void 0) }), void 0) }), void 0), showStack && (jsx_runtime_1.jsxs("div", { children: [jsx_runtime_1.jsx("hr", {}, void 0), jsx_runtime_1.jsx("div", Object.assign({ className: ErrorHandlingContainer_styles_1.jsStyles.errorMessageWrap(), "data-tid": "ErrorMessage" }, { children: message }), void 0)] }, void 0)), showStack && (jsx_runtime_1.jsxs("div", Object.assign({ className: ErrorHandlingContainer_styles_1.jsStyles.stackTraces() }, { children: [stack && (jsx_runtime_1.jsxs(react_stack_layout_1.RowStack, Object.assign({ baseline: true, block: true, gap: 2 }, { children: [jsx_runtime_1.jsx(react_stack_layout_1.Fit, { children: jsx_runtime_1.jsx("h4", Object.assign({ className: ErrorHandlingContainer_styles_1.jsStyles.header() }, { children: "Client stack trace" }), void 0) }, void 0), jsx_runtime_1.jsx(react_stack_layout_1.Fit, { children: jsx_runtime_1.jsx(react_ui_1.Link, Object.assign({ icon: jsx_runtime_1.jsx(CopyIcon16Regular_1.CopyIcon16Regular, {}, void 0), onClick: () => this.copyData(stack) }, { children: "\u0421\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C" }), void 0) }, void 0)] }), void 0)), stack && (jsx_runtime_1.jsx("div", Object.assign({ className: ErrorHandlingContainer_styles_1.jsStyles.stackTraceContainer() }, { children: jsx_runtime_1.jsx("pre", Object.assign({ "data-tid": "ClientErrorStack", className: ErrorHandlingContainer_styles_1.jsStyles.stackTrace(this.theme) }, { children: stack }), void 0) }), void 0)), serverStack && (jsx_runtime_1.jsxs(react_stack_layout_1.RowStack, Object.assign({ baseline: true, block: true, gap: 2 }, { children: [jsx_runtime_1.jsx(react_stack_layout_1.Fit, { children: jsx_runtime_1.jsx("h4", Object.assign({ className: ErrorHandlingContainer_styles_1.jsStyles.header() }, { children: "Server stack trace" }), void 0) }, void 0), jsx_runtime_1.jsx(react_stack_layout_1.Fit, { children: jsx_runtime_1.jsx(react_ui_1.Link, Object.assign({ icon: jsx_runtime_1.jsx(CopyIcon16Regular_1.CopyIcon16Regular, {}, void 0), onClick: () => this.copyData(serverStack) }, { children: "\u0421\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C" }), void 0) }, void 0)] }), void 0)), serverStack && (jsx_runtime_1.jsx("div", Object.assign({ className: ErrorHandlingContainer_styles_1.jsStyles.stackTraceContainer() }, { children: jsx_runtime_1.jsx("pre", Object.assign({ "data-tid": "ServerErrorStack", className: ErrorHandlingContainer_styles_1.jsStyles.stackTrace(this.theme) }, { children: serverStack }), void 0) }), void 0))] }), void 0))] }), void 0) }, void 0), canClose && (jsx_runtime_1.jsx(react_ui_1.Modal.Footer, Object.assign({ panel: true }, { children: jsx_runtime_1.jsx(react_ui_1.Button, Object.assign({ onClick: onClose, "data-tid": "CloseButton" }, { children: "\u0417\u0430\u043A\u0440\u044B\u0442\u044C" }), void 0) }), void 0))] }), void 0));
}
copyData(stack) {
if (stack != null) {
edi_ui_1.CopyToClipboardToast.copyText(stack);
}
}
}
exports.ErrorHandlingContainerModal = ErrorHandlingContainerModal;
//# sourceMappingURL=ErrorHandlingContainerModal.js.map