@skbkontur/cassandra-distributed-task-queue-ui
Version:
.NET library implementing distributed task queue machinery using Apache Cassandra
61 lines • 6.08 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.ErrorHandlingContainerModal = void 0;
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 = require("react");
const ErrorHandlingContainer_styles_1 = require("./ErrorHandlingContainer.styles");
class ErrorHandlingContainerModal extends react_1.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 ((0, jsx_runtime_1.jsx)(react_ui_1.ThemeContext.Consumer, { children: theme => {
this.theme = theme;
return this.renderMain();
} }));
}
renderMain() {
const { canClose, message, onClose, serverStack, stack } = this.props;
const { showStack } = this.state;
return ((0, jsx_runtime_1.jsxs)(react_ui_1.Modal, { "data-tid": "ErrorHandlingContainerModal", onClose: canClose ? onClose : undefined, noClose: !canClose, children: [(0, jsx_runtime_1.jsx)(react_ui_1.Modal.Header, { "data-tid": "Header", children: (0, jsx_runtime_1.jsx)("span", { 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" }) }), (0, jsx_runtime_1.jsx)(react_ui_1.Modal.Body, { children: (0, jsx_runtime_1.jsxs)("div", { className: ErrorHandlingContainer_styles_1.jsStyles.modalText(this.theme), children: [(0, jsx_runtime_1.jsx)("div", { className: ErrorHandlingContainer_styles_1.jsStyles.userMessage(), children: (0, jsx_runtime_1.jsx)("div", { "data-tid": "CallToActionInErrorMessage", children: (0, jsx_runtime_1.jsx)("div", { className: ErrorHandlingContainer_styles_1.jsStyles.content(), children: (0, 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." }) }) }) }), showStack && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("hr", {}), (0, jsx_runtime_1.jsx)("div", { className: ErrorHandlingContainer_styles_1.jsStyles.errorMessageWrap(), "data-tid": "ErrorMessage", children: message })] })), showStack && ((0, jsx_runtime_1.jsxs)("div", { className: ErrorHandlingContainer_styles_1.jsStyles.stackTraces(), children: [stack && ((0, jsx_runtime_1.jsxs)(react_stack_layout_1.RowStack, { baseline: true, block: true, gap: 2, children: [(0, jsx_runtime_1.jsx)(react_stack_layout_1.Fit, { children: (0, jsx_runtime_1.jsx)("h4", { className: ErrorHandlingContainer_styles_1.jsStyles.header(), children: "Client stack trace" }) }), (0, jsx_runtime_1.jsx)(react_stack_layout_1.Fit, { children: (0, jsx_runtime_1.jsx)(react_ui_1.Link, { icon: (0, jsx_runtime_1.jsx)(CopyIcon16Regular_1.CopyIcon16Regular, {}), onClick: () => this.copyData(stack), children: "\u0421\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C" }) })] })), stack && ((0, jsx_runtime_1.jsx)("div", { className: ErrorHandlingContainer_styles_1.jsStyles.stackTraceContainer(), children: (0, jsx_runtime_1.jsx)("pre", { "data-tid": "ClientErrorStack", className: ErrorHandlingContainer_styles_1.jsStyles.stackTrace(this.theme), children: stack }) })), serverStack && ((0, jsx_runtime_1.jsxs)(react_stack_layout_1.RowStack, { baseline: true, block: true, gap: 2, children: [(0, jsx_runtime_1.jsx)(react_stack_layout_1.Fit, { children: (0, jsx_runtime_1.jsx)("h4", { className: ErrorHandlingContainer_styles_1.jsStyles.header(), children: "Server stack trace" }) }), (0, jsx_runtime_1.jsx)(react_stack_layout_1.Fit, { children: (0, jsx_runtime_1.jsx)(react_ui_1.Link, { icon: (0, jsx_runtime_1.jsx)(CopyIcon16Regular_1.CopyIcon16Regular, {}), onClick: () => this.copyData(serverStack), children: "\u0421\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C" }) })] })), serverStack && ((0, jsx_runtime_1.jsx)("div", { className: ErrorHandlingContainer_styles_1.jsStyles.stackTraceContainer(), children: (0, jsx_runtime_1.jsx)("pre", { "data-tid": "ServerErrorStack", className: ErrorHandlingContainer_styles_1.jsStyles.stackTrace(this.theme), children: serverStack }) }))] }))] }) }), canClose && ((0, jsx_runtime_1.jsx)(react_ui_1.Modal.Footer, { panel: true, children: (0, jsx_runtime_1.jsx)(react_ui_1.Button, { onClick: onClose, "data-tid": "CloseButton", children: "\u0417\u0430\u043A\u0440\u044B\u0442\u044C" }) }))] }));
}
copyData(stack) {
if (stack != null) {
edi_ui_1.CopyToClipboardToast.copyText(stack);
}
}
}
exports.ErrorHandlingContainerModal = ErrorHandlingContainerModal;
//# sourceMappingURL=ErrorHandlingContainerModal.js.map
;