1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- 'use strict';
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: CA
- *| (C) Copyright IBM Corp. 2016, 2019
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define(['../../lib/@waca/core-client/js/core-client/ui/core/Class'], function (Class) {
- 'use strict';
- var RemoveDataSourceAction = null;
- RemoveDataSourceAction = Class.extend({
- /**
- * Determine when we show/hide the menu item
- */
- isItemVisible: function isItemVisible(options) {
- try {
- var dataSourceId = options.target.activeObject.dataSource.getId();
- var dashboardApi = options.glassContext.appController.getCurrentContentView().getDashboardApi();
- var dataSourcesApi = dashboardApi.getFeature('DataSources');
- var dataSourceApi = dataSourcesApi.getDataSource(dataSourceId);
- return !dataSourceApi.isDataSourceUsed();
- } catch (error) {
- options.glassContext.getCoreSvc('.Logger').error('could not decide to show/hide the menu items', error);
- return false;
- }
- },
- /**
- * Default action handler
- */
- onSelectItem: function onSelectItem(options) {
- try {
- var dataSourceId = options.target.activeObject.dataSource.getId();
- var dashboardApi = options.glassContext.appController.getCurrentContentView().getDashboardApi();
- var dataSourcesApi = dashboardApi.getFeature('DataSources');
- dataSourcesApi.removeDataSource(dataSourceId);
- } catch (error) {
- options.glassContext.getCoreSvc('.Logger').error('could not remove the datasource', error);
- }
- }
- });
- return RemoveDataSourceAction;
- });
- //# sourceMappingURL=RemoveDataSourceAction.js.map
|