ConfigPane.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. "use strict";
  2. /**
  3. * Licensed Materials - Property of IBM
  4. * IBM Cognos Products: admin
  5. * Copyright IBM Corp. 2015, 2018
  6. * US Government Users Restricted Rights -
  7. * Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  8. */
  9. define(['bi/admin/common/slideout/BasePane', 'doT', 'bi/admin/nls/StringResource', 'bi/admin/common/utils/CapabilityHelper', 'text!bi/admin/common/templates/ManagePaneTemplate.html', '../../ba-graphics/dist/icons-js/child-relationship_32'], function (BasePane, dot, StringResource, CapabilityHelper, template, childRel32) {
  10. /**
  11. * Sample content view that extends the glass AdminPane class
  12. *
  13. */
  14. var ConfigPane = BasePane.extend({
  15. init: function init(options) {
  16. ConfigPane.inherited('init', this, arguments);
  17. $.extend(this, options);
  18. CapabilityHelper.glassContext = this.glassContext;
  19. },
  20. _getMenuItems: function _getMenuItems(isSysAdmin) {
  21. var items = [{
  22. 'id': 'system_settings',
  23. 'title': StringResource.get('systemTitle'),
  24. 'description': StringResource.get('configurationDetail'),
  25. 'icon': 'common-configure-manage'
  26. }, {
  27. 'id': 'system_diagnostic_logging',
  28. 'title': StringResource.get('systemLoggingTitle'),
  29. 'description': StringResource.get('loggingDetail'),
  30. 'icon': 'common-log'
  31. }];
  32. if (isSysAdmin) {
  33. items.push({
  34. 'id': 'system_routingrules',
  35. 'title': StringResource.get('routingRulesTitle'),
  36. 'description': StringResource.get('routingRulesDetail'),
  37. 'icon': childRel32.default.id
  38. });
  39. }
  40. return items;
  41. },
  42. renderBody: function renderBody($body) {
  43. return this.isSysAdmin().then(function (isSysAdmin) {
  44. var $html = $(dot.template(template)({
  45. 'items': this._getMenuItems(isSysAdmin)
  46. }));
  47. if (!CapabilityHelper.checkCapabilities('canUseServerAdministrationTool')) {
  48. $html.find('#system_settings').hide();
  49. }
  50. $body.html($html);
  51. $body.addClass('bi-admin-entrance-pane');
  52. $body.find('.manage-sub-menu .adminentry').on('primaryaction', function (e) {
  53. if (this.slideout.child) {
  54. this.slideout.child.hide();
  55. }
  56. var childTitle = $(e.currentTarget).attr('title');
  57. switch (e.currentTarget.id) {
  58. case 'system_settings':
  59. this.glassContext.appController.showSlideOut({
  60. parent: this.slideout,
  61. overlay: true,
  62. width: '450px',
  63. label: childTitle,
  64. content: {
  65. module: 'bi/admin/system/slideout/SystemPane',
  66. title: childTitle,
  67. showGobackButton: true
  68. }
  69. });
  70. break;
  71. case 'system_mail':
  72. this.glassContext.appController.showSlideOut({
  73. parent: this.slideout,
  74. overlay: true,
  75. width: '450px',
  76. label: childTitle,
  77. content: {
  78. module: 'bi/admin/system/slideout/MailSettingsPane',
  79. title: childTitle,
  80. showGobackButton: true
  81. }
  82. });
  83. break;
  84. case 'system_diagnostic_logging':
  85. this.glassContext.appController.showSlideOut({
  86. parent: this.slideout,
  87. overlay: true,
  88. width: '450px',
  89. label: childTitle,
  90. content: {
  91. module: 'bi/admin/system/slideout/LoggingConfigurationPane',
  92. title: childTitle,
  93. showGobackButton: true
  94. }
  95. });
  96. break;
  97. case 'system_routingrules':
  98. var context = {
  99. id: 'routingrules',
  100. content: {}
  101. };
  102. this.glassContext.appController.openAppView('routingrules', context);
  103. break;
  104. default:
  105. }
  106. }.bind(this));
  107. }.bind(this));
  108. }
  109. });
  110. return ConfigPane;
  111. });