123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- '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(['../../../lib/@waca/upgrades/UpgradeBase'], function (UpgradeBase) {
- /* adds template indicator to the tab/scene if it has no template or indicator*/
- var LayoutTemplateIndicatorUpgrade = function (_UpgradeBase) {
- _inherits(LayoutTemplateIndicatorUpgrade, _UpgradeBase);
- function LayoutTemplateIndicatorUpgrade() {
- _classCallCheck(this, LayoutTemplateIndicatorUpgrade);
- var _this = _possibleConstructorReturn(this, _UpgradeBase.call(this));
- _this.VERSION = 1023;
- return _this;
- }
- /**
- * Perform upgrade
- *
- * @param {object} spec - spec to perform upgrade on
- *
- * @return {Promise} Promise to be resolved when upgrade performed
- */
- LayoutTemplateIndicatorUpgrade.prototype.up = function up(spec) {
- var _this2 = this;
- if (!spec || !spec.layout) {
- return Promise.resolve(spec);
- }
- (spec.layout.items || []).forEach(function (pageContainers) {
- (pageContainers.items || []).forEach(function (page) {
- _this2._upgradePage(page);
- });
- });
- return Promise.resolve(spec);
- };
- LayoutTemplateIndicatorUpgrade.prototype._upgradePage = function _upgradePage(page) {
- if (!page || page.type !== 'genericPage') {
- return;
- }
- page.items = page.items || [];
- var hasIndicatorOrTemplate = !!page.items.find(function (item) {
- return item.type === 'templateDropZone' || item.type === 'templateIndicator';
- });
- if (!hasIndicatorOrTemplate) {
- page.items.unshift({
- 'style': {
- 'top': '0%',
- 'left': '0%',
- 'right': '0%',
- 'bottom': '0%'
- },
- 'type': 'templateIndicator'
- });
- }
- };
- return LayoutTemplateIndicatorUpgrade;
- }(UpgradeBase);
- return new LayoutTemplateIndicatorUpgrade();
- });
- //# sourceMappingURL=LayoutTemplateIndicatorUpgrade.js.map
|