123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- "use strict";
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: Cognos Analytics
- * Copyright IBM Corp. 2015, 2019
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define(['q', 'underscore', 'bi/admin/nls/StringResource', 'bacontentnav/common/ContentListPageView', 'bi/commons/ui/properties/PropertyUIControl'], function (Q, _, StringResource, ContentView, PropertyUIControl) {
- 'use strict'; //NOSONAR
- var GlobalParameterPropertiesView = ContentView.extend({
- init: function init(options) {
- GlobalParameterPropertiesView.inherited('init', this, arguments);
- _.extend(this, options);
- this.modified = false;
- },
- render: function render() {
- this.$el.empty();
- this._propertyControlItems = this._getNewPropertyUIControl({
- 'el': this.$el,
- 'glassContext': this.glassContext,
- 'slideout': this.slideout,
- 'items': this._getPropertyControlItems()
- });
- return this._propertyControlItems.render();
- },
- _getNewPropertyUIControl: function _getNewPropertyUIControl(spec) {
- return new PropertyUIControl(spec);
- },
- _getPropertyControlItems: function _getPropertyControlItems() {
- var items = [{
- 'name': 'parameterName',
- 'label': '',
- 'value': this.parameter.name,
- 'type': 'Banner',
- 'editable': this.parameter.source === 'user' ? true : false,
- 'onChange': function (name, value) {
- this.parameter.name = value;
- this.modified = true;
- }.bind(this)
- }, {
- 'type': 'Separator'
- }, {
- 'name': 'parameterDescription',
- 'label': StringResource.get('description'),
- 'value': this.parameter.description,
- 'type': 'TextArea',
- 'multiline': true,
- 'editable': true,
- 'onChange': function (name, value) {
- this.parameter.description = value;
- this.modified = true;
- }.bind(this)
- }, {
- 'type': 'Separator'
- }, {
- 'name': 'accessibleAtSystemOrTenantLevelParameter',
- 'label': StringResource.get('accessibleAtSystemOrTenantLevel'),
- 'checked': this.parameter.accessibleAtSystemOrTenantLevel,
- 'type': 'CheckBox',
- 'disabled': false,
- 'onChange': function (name, value) {
- this.parameter.accessibleAtSystemOrTenantLevel = value;
- this.modified = true;
- }.bind(this)
- }, {
- 'type': 'Separator'
- }, {
- 'name': 'disableParameter',
- 'label': StringResource.get('disabled'),
- 'checked': this.parameter.disabled,
- 'type': 'CheckBox',
- 'disabled': false,
- 'onChange': function (name, value) {
- this.parameter.disabled = value;
- this.modified = true;
- }.bind(this)
- }, {
- 'type': 'Separator'
- }, {
- 'name': 'parameterSource',
- 'label': StringResource.get('source'),
- 'value': this.parameter.source === 'report' ? StringResource.get('report') : StringResource.get('userParameter'),
- 'type': 'SingleLineValue',
- 'disabled': false,
- 'readyOnly': true,
- 'ellipses': false
- }, {
- 'type': 'Separator'
- }];
- if (this.parameter.name === '_as_of_date') {
- // Remove extra separator
- items.pop();
- } else if (this.parameter.source === 'report') {
- items.push({
- 'name': 'parameterReport',
- 'label': StringResource.get('report'),
- 'value': this.parameter.report,
- 'type': 'SingleLineValue',
- 'disabled': false,
- 'readyOnly': true,
- 'ellipses': false
- });
- } else {
- items.push({
- 'name': 'defineValues',
- 'label': StringResource.get('customValues'),
- 'value': this.parameter.values && this.parameter.values.length !== 0 ? StringResource.get('customized') : StringResource.get('setValues'),
- 'type': 'SingleLineValue',
- 'disabled': false,
- 'ellipses': true,
- 'editCallback': function () {
- this._openSetValuesPanel();
- }.bind(this)
- });
- }
- items.push({
- 'type': 'Separator'
- });
- items.push({
- 'name': 'setLanguages',
- 'label': StringResource.get('languages'),
- 'value': StringResource.get('set'),
- 'type': 'SingleLineValue',
- 'disabled': false,
- 'ellipses': true,
- 'editCallback': function () {
- this._openSetLanguagesPanel();
- }.bind(this)
- });
- return items;
- },
- _openSetLanguagesPanel: function _openSetLanguagesPanel() {
- this._propertyPropertiesSlideout = this.glassContext.appController.showSlideOut({
- parent: this.slideout,
- width: '525px',
- label: StringResource.get('setLanguages'),
- content: {
- 'module': 'bi/admin/common/slideout/SetLanguages',
- 'glassContext': this.glassContext,
- 'values': this.parameter.multilingualDisplay,
- 'saveCallback': function (values) {
- this.parameter.multilingualDisplay = values;
- this.save();
- }.bind(this)
- }
- });
- },
- _openSetValuesPanel: function _openSetValuesPanel() {
- this.glassContext.appController.showSlideOut({
- parent: this.slideout,
- width: '400px',
- label: StringResource.get('setLanguages'),
- content: {
- 'module': 'bi/admin/common/slideout/SetCustomParameterValues',
- 'glassContext': this.glassContext,
- 'values': this.parameter.values ? this.parameter.values : [],
- 'updateCallback': function (values) {
- this.parameter.values = values;
- this.modified = true;
- this._propertyControlItems.getProperty('defineValues').setValue(this.parameter.values && this.parameter.values.length !== 0 ? StringResource.get('customized') : StringResource.get('setValues'));
- }.bind(this)
- }
- });
- }
- });
- return GlobalParameterPropertiesView;
- });
|