rsAppButtonActions.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. IBM Confidential
  3. OCO Source Materials
  4. IBM Cognos Products: rs
  5. (C) Copyright IBM Corp. 2015, 2020
  6. The source code for this program is not published or otherwise divested of its trade secrets, irrespective of what has been deposited with the U.S. Copyright Office.
  7. */
  8. define(['bi/glass/app/plugins/ButtonActionInterface'], function(ButtonActionInterface) {
  9. 'use strict';
  10. var AuthoringButtonActionInterface = ButtonActionInterface.extend({
  11. onPress: function(context) {
  12. var v_sObserverId = 'rsAppButtonActions';
  13. console.log("rsAppButtonActions pressed");
  14. console.log('context.target.plugin.itemSpec.id: %s', context.target.plugin.itemSpec.id);
  15. var v_sId = context.target.plugin.itemSpec.id;
  16. var v_oContentView = context.glassContext.currentAppView.currentContentView;
  17. var v_Application = v_oContentView.getAuthoringApplication();
  18. if (!v_Application)
  19. {
  20. return;
  21. }
  22. // un-push / deselect any sibling buttons (temporary workaround till Glass will fix RTC 93965)
  23. // this doesn't work as expected, commenting out and waiting for Glass to implement API
  24. //context.target.plugin.$el.siblings('[type="button"]').removeClass('pushed');
  25. switch(v_sId)
  26. {
  27. case "com.ibm.bi.authoring.undoBtn":
  28. v_Application.SharedState.Call(v_sObserverId, "undo");
  29. break;
  30. case "com.ibm.bi.authoring.redoBtn":
  31. v_Application.SharedState.Call(v_sObserverId, "redo");
  32. break;
  33. case "com.ibm.bi.authoring.insertableObjectsBtn":
  34. v_Application.SharedState.Toggle(v_sObserverId, "showInsertableObjects");
  35. break;
  36. case "com.ibm.bi.authoring.toggleEditViewer":
  37. v_Application.ToggleBetweenEditViewModes(v_sObserverId);
  38. break;
  39. case "com.ibm.bi.authoring.refreshBtn":
  40. var v_oParameters = { Prompt : false };
  41. v_Application.SharedState.Call(null, "refresh", v_oParameters);
  42. break;
  43. case "com.ibm.bi.authoring.consumptionFilter":
  44. v_Application.SharedState.Toggle(v_sObserverId, "showFilters");
  45. break;
  46. default:
  47. console.log("Unhandled label: " + v_sId);
  48. return;
  49. }
  50. v_Application.GlassButton_onPress(v_sId);
  51. }
  52. });
  53. return AuthoringButtonActionInterface;
  54. });