DrillthroughDefinitionScopeUpgrade.js 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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: BI Dashboard
  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/upgrades/UpgradeBase'], function (UpgradeBase) {
  16. var DrillthroughDefinitionScopeUpgrade = function (_UpgradeBase) {
  17. _inherits(DrillthroughDefinitionScopeUpgrade, _UpgradeBase);
  18. function DrillthroughDefinitionScopeUpgrade() {
  19. _classCallCheck(this, DrillthroughDefinitionScopeUpgrade);
  20. var _this = _possibleConstructorReturn(this, _UpgradeBase.call(this));
  21. _this.VERSION = 1404;
  22. return _this;
  23. }
  24. /**
  25. * Perform upgrades for drillthrough definitions. The old property needs
  26. * to be deleted and mapped to the appropriate scope since we now support 3
  27. * rather than 2.
  28. * @param {object} spec - spec to perform upgrade on
  29. *
  30. * @return {Promise} Promise to be resolved when upgrade performed
  31. */
  32. DrillthroughDefinitionScopeUpgrade.prototype.up = function up(spec) {
  33. if (spec && spec.drillThrough && spec.drillThrough.length) {
  34. spec.drillThrough.forEach(function (definition) {
  35. definition.scope = definition.reusable ? 'connection' : 'visualization';
  36. delete definition.reusable;
  37. });
  38. }
  39. return Promise.resolve(spec);
  40. };
  41. return DrillthroughDefinitionScopeUpgrade;
  42. }(UpgradeBase);
  43. return new DrillthroughDefinitionScopeUpgrade();
  44. });
  45. //# sourceMappingURL=DrillthroughDefinitionScopeUpgrade.js.map