CustomVisualsComponentHeader.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. * Licensed Materials - Property of IBM
  7. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2019
  8. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  9. */
  10. define(['react', 'ca-ui-toolkit', 'prop-types'], function (React, UI_Toolkit, PropTypes) {
  11. var Component = React.Component;
  12. var SVGIcon = UI_Toolkit.SVGIcon;
  13. var CustomVisualsComponentHeader = function (_Component) {
  14. _inherits(CustomVisualsComponentHeader, _Component);
  15. function CustomVisualsComponentHeader() {
  16. _classCallCheck(this, CustomVisualsComponentHeader);
  17. return _possibleConstructorReturn(this, _Component.apply(this, arguments));
  18. }
  19. CustomVisualsComponentHeader.prototype.componentDidMount = function componentDidMount() {
  20. var customVisAction = this.props.customVisAction;
  21. var refreshCustomVisDefinitions = this.props.handlers.refreshCustomVisDefinitions;
  22. customVisAction.createUploadFileNode(refreshCustomVisDefinitions);
  23. };
  24. CustomVisualsComponentHeader.prototype.componentWillUnmount = function componentWillUnmount() {
  25. var customVisAction = this.props.customVisAction;
  26. customVisAction.removeUploadFileNode();
  27. };
  28. CustomVisualsComponentHeader.prototype.render = function render() {
  29. var customVisAction = this.props.customVisAction;
  30. var openSelectBundleFileDialog = customVisAction.openSelectBundleFileDialog.bind(customVisAction);
  31. var addNewIcon = customVisAction.dashboardApi.getFeature('Icons').getIcon('addNew');
  32. return React.createElement(SVGIcon, {
  33. size: 'small',
  34. className: 'svgIcon',
  35. verticalAlign: 'sub',
  36. iconId: addNewIcon.id,
  37. onClick: function onClick() {
  38. return openSelectBundleFileDialog();
  39. }
  40. });
  41. };
  42. return CustomVisualsComponentHeader;
  43. }(Component);
  44. CustomVisualsComponentHeader.propTypes = {
  45. handlers: PropTypes.shape({
  46. refreshCustomVisDefinitions: PropTypes.func.isRequired
  47. }).isRequired,
  48. customVisAction: PropTypes.object.isRequired
  49. };
  50. return CustomVisualsComponentHeader;
  51. });
  52. //# sourceMappingURL=CustomVisualsComponentHeader.js.map