123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- 'use strict';
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- 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; }
- 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; }
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: BI Dashboard
- *| (C) Copyright IBM Corp. 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define(['underscore', '../../../lib/@waca/upgrades/UpgradeBase', './utils/WidgetUpgradeUtils'], function (_, UpgradeBase, WidgetUpgradeUtils) {
- /**
- * Upgrade 'lineColor' prop for composite chart, renaming it to 'compositeLineColor'.
- **/
- var CompositeChartUpgrade = function (_UpgradeBase) {
- _inherits(CompositeChartUpgrade, _UpgradeBase);
- function CompositeChartUpgrade() {
- _classCallCheck(this, CompositeChartUpgrade);
- var _this = _possibleConstructorReturn(this, _UpgradeBase.call(this));
- _this.VERSION = 1016;
- return _this;
- }
- /**
- * Perform upgrade
- *
- * @param {object} spec - spec to perform upgrade on
- *
- * @return {Promise} Promise to be resolved when upgrade performed
- */
- CompositeChartUpgrade.prototype.up = function up(spec) {
- if (!spec) {
- return Promise.resolve(spec);
- }
- if (!WidgetUpgradeUtils.specHasWidgets(spec)) {
- return Promise.resolve(spec);
- }
- this._lineColorPropUpgrade(spec);
- return Promise.resolve(spec);
- };
- // Downgrades are not available in CA
- CompositeChartUpgrade.prototype.down = function down(spec) {
- return Promise.resolve(spec);
- };
- CompositeChartUpgrade.prototype._lineColorPropUpgrade = function _lineColorPropUpgrade(spec) {
- var lineColorPropId = 'lineColor';
- var compositeLineColorPropId = 'compositeLineColor';
- var upgradeVisId = ['com.ibm.vis.rave2bundlecomposite'];
- _.each(spec.widgets, function (model) {
- // we do not want to ruin the prossible lineColor prop in other models, so add a visid check here
- if (model && model.properties && model.visId && _.contains(upgradeVisId, model.visId)) {
- var deprecatedLineColorProp = WidgetUpgradeUtils.findProperty(lineColorPropId, model.properties);
- model.properties = _.filter(model.properties, function (prop) {
- return lineColorPropId !== prop.id;
- });
- if (deprecatedLineColorProp) {
- model.properties.push({
- id: compositeLineColorPropId,
- value: deprecatedLineColorProp.value
- });
- }
- }
- });
- };
- return CompositeChartUpgrade;
- }(UpgradeBase);
- return new CompositeChartUpgrade();
- });
- //# sourceMappingURL=CompositeChartUpgrade.js.map
|