"use strict"; /** * Licensed Materials - Property of IBM * IBM Cognos Products: Cognos Analytics * Copyright IBM Corp. 2018 * US Government Users Restricted Rights - Use, duplication or disclosure * restricted by GSA ADP Schedule Contract with IBM Corp. */ define(['underscore', 'bi/glass/app/ContentView', 'bi/admin/nls/StringResource', 'react-dom', 'react', 'ba-react-admin/ba-react-admin.min', 'collaboration/messaging/connectors/slack/SlackClient'], function (_, ContentView, StringResource, ReactDOM, React, AdminReact, SlackClient) { 'use strict'; //NOSONAR: meant to be strict var CollaborationDetailsPane = ContentView.extend({ /** * @constructs CollaborationDetailsPane * * @param options - View options * @param options.$el - JQuery container node for React view * @param options.reactViewProps - React props for CollaborationDetailsView */ init: function init(options) { CollaborationDetailsPane.inherited('init', this, arguments); _.extend(this, options); this.$el.addClass("collaboration-details-view"); }, /** * Render the view. * @instance */ render: function render() { // FIXME: consume SlackClient in ba-react-admin this.reactViewProps.SlackClient = SlackClient; this.reactViewProps.parent = this; this.reactViewProps.openAddMembersSlideout = this.openAddMembersSlideout.bind(this); this.reactViewProps.closeAddMembersSlideout = this.closeAddMembersSlideout.bind(this); ReactDOM.unmountComponentAtNode(this.$el[0]); var reactElement = React.createElement(AdminReact.CollaborationDetailsView, this.reactViewProps); this.reactView = ReactDOM.render(reactElement, this.$el[0]); }, /** * @override canHide in the parent ContentView. */ canHide: function canHide(options) { return !this.reactView || this.reactView.canHide(options); }, openAddMembersSlideout: function openAddMembersSlideout(options) { if (!this.slideout.child) { this.glassContext.appController.showSlideOut({ 'parent': this.slideout, 'width': '450', // temporary adjustment for R10 until panel size is unified, onHide: options.onHideAddMembers, 'content': { 'module': 'bi/admin/account/slideout/SecurityObjectSelectorPane', 'parentView': this, 'title': StringResource.get('selectAccountGroupOrRole'), 'allowedSelectionTypes': ['group', 'role', 'account'], 'multiSelectCallback': options.multiSelectCallback } }); } }, closeAddMembersSlideout: function closeAddMembersSlideout(options) { if (this.slideout.child) { this.slideout.child.hide(); } }, remove: function remove() { if (this.$el) { ReactDOM.unmountComponentAtNode(this.$el[0]); } return CollaborationDetailsPane.inherited('remove', this, arguments); } }); return CollaborationDetailsPane; });