BulkMembershipPane.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. "use strict";
  2. /**
  3.  * Licensed Materials - Property of IBM
  4.  * IBM Cognos Products: Cognos Analytics
  5.  * Copyright IBM Corp. 2018
  6.  * US Government Users Restricted Rights -
  7. * Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  8.  */
  9. define(['underscore', 'bi/admin/common/slideout/BasePane', 'bi/admin/nls/StringResource', 'react-dom', 'react', 'ba-react-admin/ba-react-admin.min'], function (_, BasePane, StringResource, ReactDOM, React, AdminReact) {
  10. 'use strict'; //NOSONAR: meant to be strict
  11. var BulkMembershipPane = BasePane.extend({
  12. /**
  13. * @constructor
  14. * @param options.$el - JQuery node to append the table HTML
  15. * @param options.items {object} - An array of tab metadata. Must provide name,
  16. * module, and objectInfo (containing all the basic properties of the object)
  17. */
  18. init: function init(options) {
  19. BulkMembershipPane.inherited('init', this, arguments);
  20. _.extend(this, options);
  21. this.title = StringResource.get('bulkMembershipGroupsRolesAccounts');
  22. this.$el.addClass('bulkMembershipSlideout');
  23. },
  24. _getNewPropertyUIControl: function _getNewPropertyUIControl(options) {
  25. return new PropertyUIControl(options);
  26. },
  27. renderBody: function renderBody($body) {
  28. ReactDOM.unmountComponentAtNode(this.$el.find('.bi-admin-pane-body')[0]);
  29. this.reactBulkImportPane = React.createElement(AdminReact.BulkMembershipView, {
  30. 'StringResource': StringResource,
  31. 'glassContext': this.glassContext,
  32. 'close': this._closeSlideout.bind(this),
  33. 'objectInfo': this.objectInfo,
  34. 'refreshListCallback': this.refreshListCallback.bind(this.parentView)
  35. });
  36. ReactDOM.render(this.reactBulkImportPane, this.$el.find('.bi-admin-pane-body')[0]);
  37. return Promise.resolve();
  38. },
  39. _closeSlideout: function _closeSlideout() {
  40. this.slideout.hide();
  41. },
  42. remove: function remove() {
  43. BulkMembershipPane.inherited('remove', this, arguments);
  44. ReactDOM.unmountComponentAtNode(this.$el.find('.bi-admin-pane-body')[0]);
  45. this.reactBulkImportPane = null;
  46. }
  47. });
  48. return BulkMembershipPane;
  49. });