ServiceabilityView.js 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. 'use strict';
  2. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3. 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; }
  4. 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; }
  5. /*
  6. *+------------------------------------------------------------------------+
  7. *| Licensed Materials - Property of IBM
  8. *| IBM Cognos Products: Content Explorer
  9. *| (C) Copyright IBM Corp. 2019
  10. *|
  11. *| US Government Users Restricted Rights - Use, duplication or disclosure
  12. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  13. *+------------------------------------------------------------------------+
  14. */
  15. define(['../../../../lib/@waca/core-client/js/core-client/ui/core/View', 'react', 'react-dom', './ServiceabilityContent', 'jquery'], function (View, React, ReactDOM, Content) {
  16. /**
  17. * This is a wrapper class of the react components inside the glass slideout.
  18. */
  19. var ServiceabilityView = function (_View) {
  20. _inherits(ServiceabilityView, _View);
  21. function ServiceabilityView(option) {
  22. _classCallCheck(this, ServiceabilityView);
  23. var _this = _possibleConstructorReturn(this, _View.call(this, option));
  24. _this._widgetInfo = option.widgetInfo;
  25. _this._dashboardApi = option.dashboardApi;
  26. return _this;
  27. }
  28. ServiceabilityView.prototype.render = function render() {
  29. var _this2 = this;
  30. return new Promise(function (resolve) {
  31. ReactDOM.render(React.createElement(Content, {
  32. widgetInfo: _this2._widgetInfo,
  33. dashboardApi: _this2._dashboardApi,
  34. UISpec: _this2._widgetInfo.toUIJSON(),
  35. showButtons: true
  36. }), _this2.el, function () {
  37. resolve();
  38. });
  39. });
  40. };
  41. ServiceabilityView.prototype.remove = function remove() {
  42. ReactDOM.unmountComponentAtNode(this.el);
  43. };
  44. ServiceabilityView.prototype.getDOMInfo = function getDOMInfo() {
  45. var DOMInfo = {};
  46. var $widgetIDValue = this.$el.find('.widgetID_valueArea');
  47. if ($widgetIDValue.length >= 1) {
  48. DOMInfo.id = $widgetIDValue[0].innerText;
  49. }
  50. return DOMInfo;
  51. };
  52. return ServiceabilityView;
  53. }(View);
  54. return ServiceabilityView;
  55. });
  56. //# sourceMappingURL=ServiceabilityView.js.map