1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- "use strict";
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: Cognos Analytics
- * Copyright IBM Corp. 2015, 2017
- * US Government Users Restricted Rights - Use, duplication or disclosure
- * restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define(['underscore', 'bi/admin/nls/StringResource', 'bi/admin/common/ui/BaseCustomizationTab', 'bi/admin/multitenancy/services/TenantsCustomizationService'], function (_, StringResource, BaseCustomizationTab, TenantsCustomizationService) {
- 'use strict'; //NOSONAR
- var CustomizationTab = BaseCustomizationTab.extend({
- init: function init(options) {
- CustomizationTab.inherited('init', this, arguments);
- _.extend(this, options);
- this._customizationService = this._getNewTenantsCustomizationService({
- glassContext: this.glassContext
- });
- this.tenant = this.objectInfo;
- this.objectInfo.id = this.tenant.tenantID;
- },
- _getNewTenantsCustomizationService: function _getNewTenantsCustomizationService(spec) {
- return new TenantsCustomizationService(spec);
- },
- _showThemesPanel: function _showThemesPanel() {
- this._themesSlideout = this.glassContext.appController.showSlideOut({
- parent: this.slideout,
- width: '400px',
- content: {
- module: 'bi/admin/system/ThemesTab',
- glassContext: this.glassContext,
- showTitle: true,
- toastMessageLabel: 'tenantThemeSet',
- toastMessageParam: this.tenant.defaultName,
- getDefaultThemeCallback: function () {
- return Promise.resolve(this._getTheme());
- }.bind(this),
- setDefaultThemeCallback: this.setTheme.bind(this),
- global: false
- }
- });
- },
- _getAdvancedPropertyControlItem: function _getAdvancedPropertyControlItem() {
- return;
- },
- _showGlobalParametersPanel: function _showGlobalParametersPanel() {
- this._parametersSlideout = this.glassContext.appController.showSlideOut({
- 'parent': this.slideout,
- 'width': '400px',
- 'label': StringResource.get('globalParameters'),
- 'content': {
- 'module': 'bi/admin/common/GlobalParametersTab',
- 'parentView': this,
- 'glassContext': this.glassContext,
- 'getParameters': this._getParameters.bind(this),
- 'updateParameters': this._setParameters.bind(this),
- 'title': StringResource.get('globalParameters')
- }
- });
- this._parametersSlideout.onHide = function () {
- if (this.contentView.modified) {
- this.contentView.save();
- }
- };
- },
- _getParameters: function _getParameters() {
- return Promise.try(function () {
- var parameters = [];
- _.each(this._customizations.parameters, function (parameter) {
- parameters.push(parameter);
- });
- return parameters;
- }.bind(this));
- },
- _refresh: function _refresh() {},
- _setParameters: function _setParameters(tenantParameters) {
- var parameters = {};
- for (var i = 0; i < tenantParameters.length; ++i) {
- parameters[tenantParameters[i].name] = tenantParameters[i];
- }
- return this._customizationService.setParameters(this.tenant.tenantID, parameters).then(function (result) {
- this._customizations = result;
- });
- }
- });
- return CustomizationTab;
- });
|