1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- 'use strict';
- define(['../../lib/@waca/core-client/js/core-client/ui/core/Class'], function (Class) {
- 'use strict';
- var RemoveDataSourceAction = null;
- RemoveDataSourceAction = Class.extend({
-
- 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;
- }
- },
-
- 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;
- });
|