ExtensionBaseController.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. 'use strict';
  2. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3. /**
  4. * Licensed Materials - Property of IBM
  5. * IBM Cognos Products: Dashboard
  6. * (C) Copyright IBM Corp. 2019
  7. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  8. */
  9. define([], function () {
  10. 'use strict';
  11. var ExtensionBaseController = function () {
  12. function ExtensionBaseController(dashboard, appSettings, eventRouter) {
  13. _classCallCheck(this, ExtensionBaseController);
  14. this.dashboard = dashboard;
  15. this.appSettings = appSettings;
  16. this.eventRouter = eventRouter;
  17. }
  18. /**
  19. * Return last selected widget
  20. */
  21. ExtensionBaseController.prototype._getSelectedContent = function _getSelectedContent() {
  22. var contents = this.dashboard.getCanvas().getSelectedContentList();
  23. // Use the last widget.
  24. return contents && contents.length > 0 ? contents[contents.length - 1] : null;
  25. };
  26. /**
  27. * Gets a tab contribution based on causal event and current active tab
  28. * in the data grid
  29. *
  30. * @param {object} event - Event payload
  31. * @param {string} eventName - Event name
  32. * @param {string} currentTabId - Current tab identifier
  33. *
  34. */
  35. ExtensionBaseController.prototype.getTabContrib = function getTabContrib() /* event, eventName, currentTabId */{
  36. return Promise.resolve();
  37. };
  38. /**
  39. * Selects the current extension as active
  40. *
  41. * @param {object} context - context for which the current extension should render.
  42. * @param {string} currentTabId - current active tab identifier
  43. * @param {HTMLElement} container container the extension should render its view
  44. */
  45. ExtensionBaseController.prototype.select = function select() /* context, currentTabId, container */{
  46. return Promise.resolve();
  47. };
  48. return ExtensionBaseController;
  49. }();
  50. return ExtensionBaseController;
  51. });
  52. //# sourceMappingURL=ExtensionBaseController.js.map