1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- 'use strict';
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2019
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define(['../../../lib/@waca/dashboard-common/dist/core/APIFactory', '../../../widgets/livewidget/nls/StringResources', '../../../lib/@waca/dashboard-common/dist/api/ContentActionsProviderAPI'], function (APIFactory, stringResources, ContentActionsProviderAPI) {
- var visDefsHaveSearchButton = {
- list: true,
- hierarchy2: true,
- hierarchy3: true
- };
- var SearchAction = function () {
- function SearchAction(_ref) {
- var features = _ref.features;
- _classCallCheck(this, SearchAction);
- this._dashboard = features.API;
- this._dashboardState = features.DashboardState;
- this._icons = features.Icons;
- this._api = APIFactory.createAPI(this, [ContentActionsProviderAPI]);
- features.ContentActions.registerProvider('searchAction', this._api);
- }
- SearchAction.prototype.getAPI = function getAPI() {
- return this._api;
- };
- SearchAction.prototype.getContentActionList = function getContentActionList(idList) {
- var contribution = [];
- if (this._getSelectedContent(idList)) {
- var contentId = idList[0];
- var content = this._dashboard.getCanvas().getContent(contentId);
- var searchIcon = this._icons.getIcon('searchIcon');
- if (this._supportAction(idList, content)) {
- contribution = [{
- name: 'searchAction',
- label: stringResources.get('search'),
- icon: searchIcon.id,
- type: 'NextView',
- viewModule: 'dashboard-analytics/visualizations/search/DataWidgetSearchView',
- viewOptions: {
- height: 50,
- width: 242,
- content: content
- }
- }];
- }
- }
- return contribution;
- };
- SearchAction.prototype._supportAction = function _supportAction(idList, content) {
- var isAllowed = false;
- var uiState = this._dashboardState.getUiState();
- var visualization = content.getFeature('Visualization');
- if (visualization && !uiState.eventGroups) {
- var visId = visualization.getDefinition().getId();
- var mappingComplete = visualization.getSlots().isMappingComplete();
- isAllowed = mappingComplete && visDefsHaveSearchButton[visId];
- }
- return isAllowed;
- };
- SearchAction.prototype._getSelectedContent = function _getSelectedContent(idList) {
- return idList.length === 1;
- };
- return SearchAction;
- }();
- return SearchAction;
- });
- //# sourceMappingURL=SearchAction.js.map
|