'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /** * Licensed Materials - Property of IBM * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2019, 2021 * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ define(['jquery', 'react', 'react-dom', 'ca-ui-toolkit', 'prop-types', 'jquery', '../../lib/@waca/dashboard-common/dist/lib/@ba-ui-toolkit/ba-graphics/dist/illustrations-js/disconnect_64', '../../lib/@waca/dashboard-common/dist/lib/@ba-ui-toolkit/ba-graphics/dist/illustrations-js/unknown-warning_128'], function (_, React, ReactDOM, UI_Toolkit, PropTypes, $, disconnect, permission) { var Container = UI_Toolkit.Container, FlexLayout = UI_Toolkit.FlexLayout, FlexItem = UI_Toolkit.FlexItem, VSpacer = UI_Toolkit.VSpacer, SVGIcon = UI_Toolkit.SVGIcon, Label = UI_Toolkit.Label; var Component = React.Component; var ExtensibleErrorComponent = function (_Component) { _inherits(ExtensibleErrorComponent, _Component); function ExtensibleErrorComponent() { _classCallCheck(this, ExtensibleErrorComponent); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))); } ExtensibleErrorComponent.prototype.render = function render() { return React.createElement( Container, { className: 'vis-sdk-error-container' }, React.createElement( FlexLayout, { fullHeight: true, direction: 'column', 'flex-wrap': 'wrap', justifyContent: 'center', alignItems: 'center' }, React.createElement( FlexItem, null, React.createElement(SVGIcon, { iconId: this.props.context.default.id, height: 128, width: 128 }) ), React.createElement(VSpacer, { size: 3 }), React.createElement( FlexLayout, { fullHeight: true, direction: 'column', 'flex-wrap': 'wrap', justifyContent: 'center' }, React.createElement( FlexItem, null, React.createElement(Label, { className: 'vis-sdk-error-header', label: this.props.title }) ) ), React.createElement(VSpacer, null), React.createElement( FlexLayout, { fullHeight: true, direction: 'column', 'flex-wrap': 'wrap', justifyContent: 'center' }, React.createElement( FlexItem, null, React.createElement(Label, { className: 'vis-sdk-error-msgContent', label: this.props.msgContent }) ) ), React.createElement(VSpacer, null) ) ); }; return ExtensibleErrorComponent; }(Component); ExtensibleErrorComponent.propTypes = { title: PropTypes.object.isRequired, msgContent: PropTypes.object.isRequired, context: PropTypes.object.isRequired }; return function () { function SdkShowError(el, title, msgContent, context) { _classCallCheck(this, SdkShowError); this.title = title; this.msgContent = msgContent; this.el = el; this.context = context === 'disconnect' ? disconnect : permission; } SdkShowError.prototype.showError = function showError() { this.$errorContainerWrapper = $('
'); this.el.append(this.$errorContainerWrapper[0]); ReactDOM.render(React.createElement(ExtensibleErrorComponent, { title: this.title, msgContent: this.msgContent, context: this.context }), this.$errorContainerWrapper[0]); }; SdkShowError.prototype.destroy = function destroy() { if (this.$errorContainerWrapper) { ReactDOM.unmountComponentAtNode(this.$errorContainerWrapper[0]); } }; return SdkShowError; }(); }); //# sourceMappingURL=SdkShowError.js.map