EditDataSourceActionHandler.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. 'use strict';
  2. /*
  3. *+------------------------------------------------------------------------+
  4. *| Licensed Materials - Property of IBM
  5. *| IBM Cognos Products: Content Explorer
  6. *| (C) Copyright IBM Corp. 2016, 2018
  7. *|
  8. *| US Government Users Restricted Rights - Use, duplication or disclosure
  9. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  10. *+------------------------------------------------------------------------+
  11. */
  12. define(['../../lib/@waca/core-client/js/core-client/ui/core/Class', '../../lib/@waca/core-client/js/core-client/utils/Utils'], function (Class, Utils) {
  13. 'use strict';
  14. var EditDataSourceActionHandler = Class.extend({
  15. _activeObject: null,
  16. isItemVisible: function isItemVisible(options) {
  17. this._activeObject = options.target.activeObject;
  18. var _selectedContext = options.target.activeObject.aSelectedContext[0];
  19. if (!_selectedContext) {
  20. return false;
  21. }
  22. if (_selectedContext.type !== 'dataSet2') {
  23. return false;
  24. }
  25. this.glassContext = options.glassContext;
  26. return options.glassContext.getCoreSvc('.UserProfile').capabilities.indexOf('canUseMyDataSets') !== -1 && _selectedContext.permissions.indexOf('read') !== -1 && _selectedContext.permissions.indexOf('write') !== -1 && !Utils.isIpad();
  27. },
  28. onSelectItem: function onSelectItem() {
  29. var context = {
  30. isDataset: true,
  31. startingTemplate: 'DatasetList',
  32. isTemplate: true,
  33. UIProfile: 'TitanDataset',
  34. id: this._activeObject.aSelectedContext[0].id,
  35. cmProperties: this._activeObject.aSelectedContext[0]
  36. };
  37. this.glassContext.appController.openAppView('datasets', {
  38. id: 'editDataset',
  39. content: context
  40. });
  41. }
  42. });
  43. return EditDataSourceActionHandler;
  44. });
  45. //# sourceMappingURL=EditDataSourceActionHandler.js.map