PropertiesPane.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. 'use strict';
  2. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3. /**
  4. * Licensed Materials - Property of IBM
  5. * IBM Business Analytics (C) Copyright IBM Corp. 2019, 2020
  6. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. */
  8. /**
  9. * @class Properties
  10. * @hideconstructor
  11. * @classdesc API class that is used to manage Properties
  12. */
  13. define(['../../../lib/@waca/dashboard-common/dist/core/APIFactory', './PropertiesPaneAPI', '../../../app/nls/StringResources', '../../../app/util/ErrorUtils'], function (APIFactory, PropertiesPaneAPI, StringResources, ErrorUtils) {
  14. var PROVIDER_ID = 'PropertiesPane';
  15. var PropertiesPane = function () {
  16. function PropertiesPane(_ref) {
  17. var features = _ref.features;
  18. _classCallCheck(this, PropertiesPane);
  19. this._dashboardApi = features.API;
  20. this._slideout = features.InAppSlideoutState;
  21. this._dashboardState = features.DashboardState;
  22. this._icons = features.Icons;
  23. this._api = null;
  24. }
  25. PropertiesPane.prototype.getAPI = function getAPI() {
  26. return this._api;
  27. };
  28. PropertiesPane.prototype.getProviderId = function getProviderId() {
  29. return PROVIDER_ID;
  30. };
  31. PropertiesPane.prototype.initialize = function initialize() {
  32. var _this = this;
  33. this._api = APIFactory.createAPI(this, [PropertiesPaneAPI]);
  34. var uiState = this._dashboardState.getUiState();
  35. this._slideout.registerContribution(this.getProviderId(), {
  36. name: 'properties',
  37. label: StringResources.get('commonPropertiesLabel'),
  38. icon: this._icons.getIcon('configure').id,
  39. type: 'Button',
  40. order: 5,
  41. text: StringResources.get('commonPropertiesLabel'),
  42. className: 'buttonWithText',
  43. disabled: function disabled() {
  44. return uiState.eventGroups;
  45. },
  46. isEnabled: function isEnabled(idList) {
  47. // by design, PropertiesPane is a dashboard level action;
  48. // when the widget is selected this method is called with a non-empty idList and should not be enabled
  49. if (idList.length > 0) {
  50. return false;
  51. }
  52. var shouldPropertiesActionInToolbar = ErrorUtils.hasCapability(_this._dashboardApi, 'canAuthorDashboard') && uiState.authoring;
  53. return shouldPropertiesActionInToolbar;
  54. }
  55. });
  56. };
  57. PropertiesPane.prototype.destroy = function destroy() {
  58. this._dashboardApi = null;
  59. this._api = null;
  60. };
  61. return PropertiesPane;
  62. }();
  63. return PropertiesPane;
  64. });
  65. //# sourceMappingURL=PropertiesPane.js.map