123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273 |
- "use strict";
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: admin
- * Copyright IBM Corp. 2015, 2018
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define(['underscore', 'q', 'bi/admin/nls/StringResource', 'bi/content_apps/PropertiesGeneralTab'], function (_, Q, StringResource, BaseGeneralTab) {
- 'use strict'; //NOSONAR: meant to be strict
- var GeneralPropertiesTab = BaseGeneralTab.extend({
- /**
- @paran options.el {node} - container dom node
- **/
- init: function init(options) {
- GeneralPropertiesTab.inherited('init', this, arguments);
- _.extend(this, options);
- if (this.objectInfo.searchPath !== undefined) {
- this.isEditable = !(this.objectInfo.searchPath.indexOf('CAMID(":') === -1 && this.objectInfo.searchPath.indexOf('CAMID("CognosEx:') === -1);
- } else {
- this.isEditable = false;
- }
- this.writable = this.objectInfo.permissions && this.objectInfo.permissions.indexOf('write') > -1 ? true : false;
- },
- _getLocation: function _getLocation() {
- var ancestors = [];
- if (!this.objectInfo.ancestors) {
- return null;
- }
- this.objectInfo.ancestors.forEach(function (ancestor) {
- ancestors.push(ancestor.defaultName);
- });
- return ancestors.join(' > ');
- },
- _checkForCapability: function _checkForCapability() {
- if (!this.objectInfo.ancestors || this.objectInfo.ancestors.length === 0) {
- return false;
- }
- if (this.objectInfo.ancestors[0].type === 'capability') {
- this._advancedProperties.splice(2, 0, {
- 'name': 'hidden',
- 'label': StringResource.get('hideThisEntry'),
- 'checked': this.objectInfo.hidden,
- 'type': 'CheckBox',
- 'disabled': !this.writable
- }, {
- 'type': 'Separator'
- });
- }
- return true;
- },
- _getAdvancedPropertyItems: function _getAdvancedPropertyItems() {
- //NOSONAR
- this._advancedProperties = [{
- 'name': 'disabled',
- 'label': StringResource.get('disableThisEntry'),
- 'checked': this.objectInfo.disabled,
- 'type': 'CheckBox',
- 'disabled': !this.writable
- }, {
- 'type': 'Separator'
- }, {
- 'name': 'location',
- 'label': StringResource.get('location'),
- 'value': this._getLocation(),
- 'type': 'SingleLineValue'
- }, {
- 'type': 'Separator'
- }, {
- 'name': 'searchPath',
- 'label': StringResource.get('searchPath'),
- 'newLook': true,
- 'value': this.objectInfo.searchPath,
- 'type': 'InputLabel',
- 'inputStyles': 'width: 210px',
- 'readOnly': true
- }, {
- 'type': 'Separator'
- }, {
- 'name': 'ID',
- 'label': StringResource.get('id'),
- 'newLook': true,
- 'value': this.objectInfo.id,
- 'type': 'InputLabel',
- 'inputStyles': 'width: 210px',
- 'readOnly': true
- }];
- if (this._canSeeTenant()) {
- this.currentTenantID = this.objectInfo.tenantID;
- this._advancedProperties.splice(0, 0, {
- 'type': 'SingleLineValue',
- 'name': 'changeTenant',
- 'label': StringResource.get('type_tenant'),
- 'value': this._getTenantNameByID(this.objectInfo.tenantID),
- 'disabled': !this._canSetTenant,
- 'editCallback': function () {
- this.changeTenantSlideout = this.glassContext.appController.showSlideOut({
- 'parent': this.slideout,
- 'position': 'left',
- 'width': '400px',
- 'overlay': true,
- 'label': StringResource.get('tenantSettings'),
- 'content': {
- 'module': 'bi/content_apps/TenantSlideoutView',
- 'glassContext': this.glassContext,
- 'title': StringResource.get('Tenants'),
- 'objectInfo': this.objectInfo,
- 'currentTenantID': this.currentTenantID,
- 'onChangeCallback': this.updateTenant.bind(this)
- }
- });
- }.bind(this)
- }, {
- 'type': 'Separator'
- });
- }
- switch (this.objectInfo.type) {
- case 'role':
- case 'group':
- break;
- case 'contact':
- this._advancedProperties.splice(2, 0, {
- 'name': 'hidden',
- 'label': StringResource.get('hideThisEntry'),
- 'checked': this.objectInfo.hidden,
- 'type': 'CheckBox',
- 'disabled': !this.writable
- }, {
- 'type': 'Separator'
- });
- this._advancedProperties = this._advancedProperties.concat([{
- 'type': 'Separator'
- }, {
- 'name': 'givenName',
- 'label': StringResource.get('givenName'),
- 'value': this.objectInfo.givenName,
- 'type': 'TextArea',
- 'multiline': false,
- 'editable': this.isEditable && this.writable
- }, {
- 'type': 'Separator'
- }, {
- 'name': 'surname',
- 'label': StringResource.get('surname'),
- 'value': this.objectInfo.surname,
- 'type': 'TextArea',
- 'multiline': false,
- 'editable': this.isEditable && this.writable
- }, {
- 'type': 'Separator'
- }, {
- 'name': 'email',
- 'label': StringResource.get('email'),
- 'value': this.objectInfo.email,
- 'type': 'TextArea',
- 'multiline': false,
- 'editable': this.isEditable && this.writable
- }]);
- break;
- // Defect 294283, visualization
- case 'visualization':
- case 'namespaceFolder':
- case 'namespace':
- case 'dataSource':
- case 'dataSourceSignon':
- case 'dataSourceConnection':
- case 'distributionList':
- case 'capability':
- case 'productCapability':
- this._advancedProperties.splice(2, 0, {
- 'name': 'hidden',
- 'label': StringResource.get('hideThisEntry'),
- 'checked': this.objectInfo.hidden,
- 'type': 'CheckBox',
- 'disabled': !this.writable
- }, {
- 'type': 'Separator'
- });
- break;
- case 'account':
- var isAnonymous = this.objectInfo.searchPath.indexOf('CAMID("::Anonymous') >= 0;
- if (!isAnonymous) {
- this._advancedProperties = this._advancedProperties.concat([{
- 'type': 'Separator'
- }, {
- 'name': 'userName',
- 'label': StringResource.get('userId'),
- 'value': this.objectInfo.userName,
- 'type': 'SingleLineValue',
- 'editable': false
- }, {
- 'type': 'Separator'
- }, {
- 'name': 'givenName',
- 'label': StringResource.get('givenName'),
- 'value': this.objectInfo.givenName,
- 'type': 'TextArea',
- 'multiline': false,
- 'editable': this.isEditable && this.writable
- }, {
- 'type': 'Separator'
- }, {
- 'name': 'surname',
- 'label': StringResource.get('surname'),
- 'value': this.objectInfo.surname,
- 'type': 'TextArea',
- 'multiline': false,
- 'editable': this.isEditable && this.writable
- }, {
- 'type': 'Separator'
- }, {
- 'name': 'email',
- 'label': StringResource.get('email'),
- 'value': this.objectInfo.email,
- 'type': 'TextArea',
- 'multiline': false,
- 'editable': this.isEditable && this.writable
- }, {
- 'type': 'Separator'
- }, {
- 'name': 'password',
- 'label': StringResource.get('password'),
- 'value': 'secret',
- 'type': 'SingleLineValue',
- 'multiline': false,
- 'editable': this.isEditable && this.writable,
- 'inputType': 'password'
- }]);
- }
- break;
- case 'tenant':
- this._advancedProperties.splice(2, 0, {
- 'name': 'tenantID',
- 'label': StringResource.get('tenantId'),
- 'value': this.objectInfo.tenantID,
- 'type': 'SingleLineValue',
- 'editable': false
- });
- break;
- default:
- if (this._checkForCapability()) {
- break;
- }
- this.logger.error('get advanced properies of unknown type: ' + this.objectInfo.type);
- }
- return this._advancedProperties;
- }
- });
- return GeneralPropertiesTab;
- });
|