'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 Cloud (C) Copyright IBM Corp. 2017, 2020 * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ define(['./EventGroupActions', '../../../../app/nls/StringResources'], function (EventGroupActions, stringResources) { var LinkEventGroupAction = function (_EventGroupActions) { _inherits(LinkEventGroupAction, _EventGroupActions); function LinkEventGroupAction(_ref) { var features = _ref.features; _classCallCheck(this, LinkEventGroupAction); var _this = _possibleConstructorReturn(this, _EventGroupActions.call(this, { features: features })); if (features) { features.ContentActions.registerProvider('linkFilterGroup', _this.getAPI()); _this._icons = features.Icons; } return _this; } LinkEventGroupAction.prototype.getContentActionList = function getContentActionList(idList) { if (this._isAvailable(idList)) { return [{ name: 'linkFilterGroup', label: stringResources.get('toolbarActionLinkFilterGroup'), icon: this._icons.getIcon('link').id, type: 'NextView', order: 2, disabled: this.isDisabled.bind(this, idList), viewModule: 'dashboard-core/js/app/ui/dialogs/FilterGroupsDialog', viewOptions: { height: 140, width: 180, labels: false, idList: idList, controller: this }, update: true }]; } else { return []; } }; LinkEventGroupAction.prototype.isDisabled = function isDisabled(idList) { if (this._isStaticWidget(idList)) { return true; } if (this.getNumberOfGroups(idList) < 2) { return true; } return false; }; LinkEventGroupAction.prototype.getGroups = function getGroups(idList) { if (this._isStaticWidget(idList)) { return []; } var pageid = this._getPageId(idList); var groups = this.eventGroups.getGroupIdsOnPage(pageid); /* * return the array of group ids for the "add to group" function. If the selection contains only 1 distinct group, * then that group index should not be in the list of possible groups to be added to. */ var distinctGroupIdsInSelection = this._getDistinctGroupIdsInSelection(idList); //remove the group id from the list if the selection only contains 1 distinct group if (distinctGroupIdsInSelection.length === 1) { groups = groups.filter(function (value) { return value !== distinctGroupIdsInSelection[0]; }); return groups; } return groups; }; return LinkEventGroupAction; }(EventGroupActions); return LinkEventGroupAction; }); //# sourceMappingURL=LinkEventGroupAction.js.map