DSContextMenuActionHandler.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. 'use strict';
  2. /*
  3. *+------------------------------------------------------------------------+
  4. *| Licensed Materials - Property of IBM
  5. *| IBM Cognos Products: Content Explorer
  6. *| (C) Copyright IBM Corp. 2016, 2019
  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/ClassFactory'], function (Class, ClassFactory) {
  13. var Action = Class.extend({
  14. /**
  15. * if necessary set visibility on condition,
  16. * extra options parameter can be passed in
  17. */
  18. isItemVisible: function isItemVisible() {
  19. return true;
  20. },
  21. /**
  22. * Callback when select a context menu item
  23. *
  24. * @param context {object}
  25. **/
  26. onSelectItem: function onSelectItem(context) {
  27. var promise;
  28. var oTarget = context.target;
  29. switch (oTarget.itemId) {
  30. case 'com.ibm.bi.dashboard.relinkDataset':
  31. var oActiveObject = oTarget.activeObject;
  32. if (oActiveObject) {
  33. promise = ClassFactory.loadModule(oActiveObject.dialogModule).then(function (OpenDialog) {
  34. var openDialog = new OpenDialog({
  35. 'glassContext': context.glassContext,
  36. 'dataset': oActiveObject.dataset
  37. });
  38. openDialog.open();
  39. return openDialog;
  40. });
  41. } else {
  42. promise = Promise.resolve();
  43. }
  44. break;
  45. default:
  46. promise = Promise.resolve();
  47. break;
  48. }
  49. return promise;
  50. }
  51. });
  52. return Action;
  53. });
  54. //# sourceMappingURL=DSContextMenuActionHandler.js.map