FredIsRedUpgrade.js 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. 2018
  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(['underscore', '../../../lib/@waca/upgrades/UpgradeBase'], function (_, UpgradeBase) {
  16. /**
  17. * Upgrade fredIsRed prop, set the value to false for upgraded prop.
  18. **/
  19. var FredIsRedUpgrade = function (_UpgradeBase) {
  20. _inherits(FredIsRedUpgrade, _UpgradeBase);
  21. function FredIsRedUpgrade() {
  22. _classCallCheck(this, FredIsRedUpgrade);
  23. var _this = _possibleConstructorReturn(this, _UpgradeBase.call(this));
  24. _this.VERSION = 1017;
  25. return _this;
  26. }
  27. /**
  28. * Perform upgrade
  29. *
  30. * @param {object} spec - spec to perform upgrade on
  31. *
  32. * @return {Promise} Promise to be resolved when upgrade performed
  33. */
  34. FredIsRedUpgrade.prototype.up = function up(spec) {
  35. if (!spec) {
  36. return Promise.resolve(spec);
  37. }
  38. this._fredIsRedUpgrade(spec);
  39. return Promise.resolve(spec);
  40. };
  41. // Downgrades are not available in CA
  42. FredIsRedUpgrade.prototype.down = function down(spec) {
  43. return Promise.resolve(spec);
  44. };
  45. FredIsRedUpgrade.prototype._fredIsRedUpgrade = function _fredIsRedUpgrade(spec) {
  46. // some old spec does not have properties
  47. if (!spec.properties) {
  48. spec.properties = {};
  49. }
  50. spec.properties['fredIsRed'] = false;
  51. };
  52. return FredIsRedUpgrade;
  53. }(UpgradeBase);
  54. return new FredIsRedUpgrade();
  55. });
  56. //# sourceMappingURL=FredIsRedUpgrade.js.map