AddMembersToSlideout.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. "use strict";
  2. /**
  3. * Licensed Materials - Property of IBM
  4. * IBM Cognos Products: Cognos Analytics
  5. * Copyright IBM Corp. 2018, 2018
  6. * US Government Users Restricted Rights - Use, duplication or disclosure
  7. * restricted by GSA ADP Schedule Contract with IBM Corp.
  8. */
  9. define(['react', 'react-dom', 'ba-react-admin/ba-react-admin.min', 'underscore', 'bi/glass/app/ContentView', 'bi/admin/nls/StringResource'], function (React, ReactDOM, AdminReact, _, ContentView, StringResource, DateTimeUtils, GlassContextHelper) {
  10. 'use strict'; //NOSONAR: meant to be strict
  11. var AddMemberToSlideout = ContentView.extend({
  12. init: function init(options) {
  13. AddMemberToSlideout.inherited('init', this, arguments);
  14. _.extend(this, options);
  15. },
  16. openFilterlideout: function openFilterlideout(aStore) {
  17. var menuContentCheckbox = [{
  18. label: StringResource.get('contact'),
  19. value: 'contact'
  20. }, {
  21. label: StringResource.get('distributionList'),
  22. value: 'distributionList'
  23. }, {
  24. label: StringResource.get('account'),
  25. value: 'account'
  26. }, {
  27. label: StringResource.get('role'),
  28. value: 'role'
  29. }, {
  30. label: StringResource.get('group'),
  31. value: 'group'
  32. }];
  33. this.glassContext.appController.showSlideOut({
  34. parent: this.slideout,
  35. content: {
  36. module: 'bi/admin/common/slideout/FilterSlideout',
  37. id: 'FilterAddToContent',
  38. glassContext: this.glassContext,
  39. StringResource: StringResource,
  40. controllerStore: aStore,
  41. menuContentCheckbox: menuContentCheckbox
  42. }
  43. });
  44. },
  45. openSortSlideout: function openSortSlideout(aStore) {
  46. var sortCols = [{
  47. value: 'defaultName',
  48. label: StringResource.get('name')
  49. }, {
  50. value: 'modificationTime',
  51. label: StringResource.get('modified')
  52. }, {
  53. value: 'objectClass',
  54. label: StringResource.get('type')
  55. }];
  56. this.glassContext.appController.showSlideOut({
  57. parent: this.slideout,
  58. content: {
  59. module: 'bi/admin/common/slideout/SortSlideout',
  60. id: 'SortAddToContent',
  61. glassContext: this.glassContext,
  62. StringResource: StringResource,
  63. controllerStore: aStore,
  64. sortContent: sortCols
  65. }
  66. });
  67. },
  68. render: function render() {
  69. ReactDOM.unmountComponentAtNode(this.$el[0]);
  70. var addMembersPane = React.createElement(AdminReact.AddMembersToPanel, {
  71. glassContext: this.glassContext,
  72. StringResource: StringResource,
  73. dialog: this,
  74. title: this.title,
  75. selectableTypes: ['distributionList', 'contact', 'account', 'role', 'group'],
  76. hideSearchAtRoot: true,
  77. store: this.store,
  78. isActive: this.activeFunction,
  79. addMembersTo: this.addToFunction,
  80. closePanel: function () {
  81. this.slideout.hide();
  82. }.bind(this)
  83. });
  84. ReactDOM.render(addMembersPane, this.$el[0]);
  85. return Promise.resolve();
  86. },
  87. remove: function remove() {
  88. if (this.$el) {
  89. ReactDOM.unmountComponentAtNode(this.$el[0]);
  90. }
  91. this.viewState = null;
  92. return AddMemberToSlideout.inherited('remove', this, arguments);
  93. }
  94. });
  95. return AddMemberToSlideout;
  96. });