123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- '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) {
- /**
- * Turn off all Vida level truncation for existing content so upgraded content
- * renders similarily after upgrade.
- **/
- var VIDA_ClippingUpgrade = function (_UpgradeBase) {
- _inherits(VIDA_ClippingUpgrade, _UpgradeBase);
- function VIDA_ClippingUpgrade() {
- _classCallCheck(this, VIDA_ClippingUpgrade);
- var _this = _possibleConstructorReturn(this, _UpgradeBase.call(this));
- _this.VERSION = 1019;
- return _this;
- }
- /**
- * Perform upgrade
- *
- * @param {object} spec - spec to perform upgrade on
- *
- * @return {Promise} Promise to be resolved when upgrade performed
- */
- VIDA_ClippingUpgrade.prototype.up = function up(spec) {
- var _this2 = this;
- if (!spec) {
- return Promise.resolve(spec);
- }
- if (!WidgetUpgradeUtils.specHasWidgets(spec)) {
- return Promise.resolve(spec);
- }
- /*
- * Cycle through all widgets and, if they are live widgets, upgrade the clipping.
- */
- _.each(spec.widgets, function (model) {
- if (model && WidgetUpgradeUtils.isLiveWidgetModel(model)) {
- if (!model.properties) {
- model.properties = [];
- }
- _this2._vidaClippingUpgrade(model);
- }
- });
- return Promise.resolve(spec);
- };
- VIDA_ClippingUpgrade.prototype._isLive = function _isLive(model) {
- return model && model.type && model.type === 'live';
- };
- // Downgrades are not available in CA
- VIDA_ClippingUpgrade.prototype.down = function down(spec) {
- return Promise.resolve(spec);
- };
- VIDA_ClippingUpgrade.prototype._vidaClippingUpgrade = function _vidaClippingUpgrade(model) {
- // Turn off clipping/truncation for existing content.
- model.properties.push({
- id: 'widget.data.truncate',
- value: false
- });
- };
- return VIDA_ClippingUpgrade;
- }(UpgradeBase);
- return new VIDA_ClippingUpgrade();
- });
- //# sourceMappingURL=VIDA_ClippingUpgrade.js.map
|