123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- '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. 2020
- *|
- *| 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) {
- var icon_map = {
- 'announcement_16_v4': 'bullhorn',
- 'api_16_v4': 'api',
- 'archive_16_v4': 'archive',
- 'asset_16_v4': 'microphone',
- 'attachment_16_v4': 'attachment',
- 'audio_16_v4': 'audio',
- 'bee_16_v4': 'bee',
- 'blog_16_v4': 'blog',
- 'bookmark_16_v4': 'bookmark',
- 'calendar_16_v4': 'calendar',
- 'camera_16_v4': 'camera',
- 'capability_16_v4': 'capability',
- 'catalog_16_v4': 'catalog',
- 'chat-message_16_v4': 'message',
- 'checkout-cart_16_v4': 'checkout',
- 'client_16_v4': 'client',
- 'clock_24_v4': 'clock',
- 'cloud_16_v4': 'cloud',
- 'code_16_v4': 'code',
- 'data-quality_16_v4': 'data-quality',
- 'folder_16_v5': 'folder',
- 'forum_16_v4': 'forum',
- 'glasses_16_v4': 'glasses',
- 'group_16_v5': 'group',
- 'hat_16_v4': 'hat',
- 'headphones_16_v4': 'headphones',
- 'hills_24_v4': 'hills',
- 'home_16_v4': 'home',
- 'idea_16_v4': 'idea',
- 'image-file_32_v4': 'image',
- 'inventory_24_v4': 'inventory',
- 'like_16_v4': 'like',
- 'link_16_v5': 'link',
- 'location_16_v5': 'location',
- 'manage_16_v4': 'settings',
- 'markup-pen_16_v4': 'pen',
- 'mobile-phone_16_v4': 'mobile',
- 'music_16_v4': 'music',
- 'notifications_16_v4': 'notifications',
- 'paint_24_v4': 'paint',
- 'payment-card_16_v4': 'payment',
- 'password-key_32_v4': 'password-key',
- 'people_16_v4': 'people',
- 'person_16_v4': 'person',
- 'phone-call_16_v4': 'phone',
- 'pin_16_v4': 'pin',
- 'print_16_v4': 'print',
- 'recording_16_v4': 'recording',
- 'repository_16_v5': 'repository',
- 'role_16_v4': 'role',
- 'search_16_v5': 'search',
- 'settings_16_v4': 'settings',
- 'speaker_16_v4': 'speaker',
- 'star-rating_16_v4': 'star',
- 'tag_16_v4': 'tag',
- 'thumbs-up_16_v4': 'thumbs-up',
- 'thumbs-down_16_v4': 'thumbs-down',
- 'tools_16_v4': 'tools',
- 'traffic_16_v4': 'traffic',
- 'trash_16_v4': 'trash',
- 'twitter_16_v4': 'twitter',
- 'unknown_16_v4': 'unknown',
- 'user_16_v4': 'user',
- 'venn-diagram_16_v4': 'venn-diagram',
- 'video_16_v4': 'video',
- 'view_16_v4': 'view',
- 'warn_16_v5': 'warning',
- 'watch_24_v4': 'watch',
- 'watson_24_v4': 'watson',
- 'wikis_16_v4': 'wikis',
- 'workspace_16_v4': 'workspace',
- 'world_16_v4': 'world'
- };
- var TabIconUpgrade = function (_UpgradeBase) {
- _inherits(TabIconUpgrade, _UpgradeBase);
- function TabIconUpgrade() {
- _classCallCheck(this, TabIconUpgrade);
- var _this = _possibleConstructorReturn(this, _UpgradeBase.call(this));
- _this.VERSION = 1600;
- return _this;
- }
- /**
- * Perform upgrade to the tabIcon portion of the spec to replace what is
- * there with an alias that is mapped to the correct icon.
- *
- *
- * @param {object} spec - The widget spec that the upgrade is performed on
- *
- * @return {Promise} Promise to be resolved with upgrade performed.
- */
- TabIconUpgrade.prototype.up = function up(spec) {
- if (!spec) {
- return Promise.resolve(spec);
- }
- return this._upgradeWidgets(spec);
- };
- TabIconUpgrade.prototype._upgradeWidgets = function _upgradeWidgets(spec) {
- var _this2 = this;
- if (spec.layout.type === 'tab') {
- spec.layout.items.forEach(function (tab) {
- if (tab.tabIcon) {
- var newIcon = icon_map[tab.tabIcon.value];
- if (newIcon !== undefined) {
- tab.tabIcon = newIcon;
- } else {
- if (_this2.data && _this2.data.logger) {
- _this2.data.logger.warn('Unable to upgrade tab icon ' + tab.tabIcon.value + ' - replacing with default value');
- }
- delete tab.tabIcon;
- }
- }
- });
- }
- return Promise.resolve(spec);
- };
- return TabIconUpgrade;
- }(UpgradeBase);
- return new TabIconUpgrade();
- });
- //# sourceMappingURL=TabIconUpgrade.js.map
|