DataPointActions.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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: BI Cloud (C) Copyright IBM Corp. 2019
  6. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. */
  8. define(['../../../lib/@waca/dashboard-common/dist/core/APIFactory', './api/DataPointActionsAPI', 'underscore'], function (APIFactory, DataPointActionsAPI, _) {
  9. var DataPointActions = function () {
  10. function DataPointActions() {
  11. _classCallCheck(this, DataPointActions);
  12. this.api = APIFactory.createAPI(this, [DataPointActionsAPI]);
  13. this.providers = {};
  14. }
  15. DataPointActions.prototype.registerProvider = function registerProvider(name, provider) {
  16. this.providers[name] = provider;
  17. };
  18. DataPointActions.prototype.getDataPointActionList = function getDataPointActionList(selections, options) {
  19. var actions = [];
  20. for (var actionName in this.providers) {
  21. var provider = this.providers[actionName];
  22. if (provider.getDataPointActionList) {
  23. var dataPointAction = null;
  24. try {
  25. dataPointAction = provider.getDataPointActionList(selections, options);
  26. } catch (e) {
  27. console.log(e);
  28. }
  29. if (!_.isEmpty(dataPointAction)) {
  30. actions.push.apply(actions, dataPointAction);
  31. }
  32. }
  33. }
  34. return actions;
  35. };
  36. DataPointActions.prototype.getAPI = function getAPI() {
  37. return this.api;
  38. };
  39. return DataPointActions;
  40. }();
  41. return DataPointActions;
  42. });
  43. //# sourceMappingURL=DataPointActions.js.map