"use strict";
/**
* Licensed Materials - Property of IBM
* IBM Cognos Products: Cognos Analytics
* Copyright IBM Corp. 2018, 2018
* US Government Users Restricted Rights - Use, duplication or disclosure
* restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define(['doT', 'react', 'react-dom', 'ba-react-admin/ba-react-admin.min', 'underscore', 'bi/admin/common/slideout/BasePane', 'bi/content_apps/PropertiesTab', 'bi/admin/nls/StringResource'], function (dot, React, ReactDOM, AdminReact, _, BasePane, PropertiesTab, StringResource) {
'use strict'; //NOSONAR: meant to be strict
var CapabilitiesListPane = BasePane.extend({
init: function init(options) {
CapabilitiesListPane.inherited('init', this, arguments);
$.extend(this, options);
this.title = StringResource.get('capabilities');
},
setFocus: function setFocus() {
this.$el.find('.bi-admin-base-pane').focus();
var elem = this.$el.find('.bi-admin-base-pane')[0];
if (elem) {
elem.focus();
}
},
refresh: function refresh() {
this.renderBody(this.$body);
},
renderBody: function renderBody($body) {
var sHtml = '
';
$body.html(sHtml);
this.bodyEl = $body;
ReactDOM.unmountComponentAtNode(this.bodyEl.find('#capabilitiesListReactElement')[0]);
var capabilitiesListPane = React.createElement(AdminReact.CapabilitiesListPanel, {
glassContext: this.glassContext,
StringResource: StringResource,
parent: this,
objectInfo: this.objectInfo
});
ReactDOM.render(capabilitiesListPane, $body.find('#capabilitiesListReactElement')[0]);
return Promise.resolve();
},
reactPropSelectCallback: function reactPropSelectCallback(index, selectedItem) {
var capabilityItem = {
defaultName: selectedItem.label,
type: selectedItem.type,
id: selectedItem.id,
children: selectedItem.children && selectedItem.children.length > 0 ? true : false,
isParent: selectedItem.depth === 0 ? true : false,
hasParent: selectedItem.depth === 1 ? true : false
};
var selectedTab = "bi/admin/account/ui/CapabilitiesTab";
if (index === 0) {
selectedTab = "bi/admin/common/GeneralPropertiesTab";
}
var slideout = this.glassContext.appController.showSlideOut({
'parent': this.slideout,
'launchPoint': this.slideout.$el.find('span.goback-icon'),
'width': "400px",
'content': {
'module': 'bi/admin/common/PropertiesPageView',
'parentView': this,
'listPane': this,
'objectInfo': capabilityItem,
'type': capabilityItem.type,
'glassContext': this.glassContext,
'selectedTabModule': selectedTab
},
'onHide': function () {
if (slideout && slideout.contentView && slideout.contentView.onHide) {
slideout.contentView.onHide().then(function () {
slideout.hide();
});
}
}.bind(this)
});
},
remove: function remove() {
CapabilitiesListPane.inherited('remove', this, arguments);
ReactDOM.unmountComponentAtNode(this.bodyEl.find('#capabilitiesListReactElement')[0]);
}
});
return CapabilitiesListPane;
});