123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- "use strict";
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: Cognos Analytics
- * Copyright IBM Corp. 2016, 2017
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define(['bi/glass/app/ContentView', 'underscore', 'bi/admin/nls/StringResource', 'q', 'require', 'bi/commons/ui/properties/PropertyUIControl'], function (View, _, StringResource, Q, require, PropertyUIControl) {
- 'use strict'; //NOSONAR
- var UserGroupSelectorPane = View.extend({
- init: function init(options) {
- UserGroupSelectorPane.inherited('init', this, arguments);
- _.extend(this, options);
- },
- render: function render() {
- var deferred = Q.defer();
- this._renderFacets().then(function () {
- deferred.resolve();
- });
- return deferred.promise;
- },
- _onClear: function _onClear() {
- this._oPropertyUIControl.getProperty('users').uncheck(false);
- this._oPropertyUIControl.getProperty('groups').uncheck(false);
- this._oPropertyUIControl.getProperty('roles').uncheck(false);
- this.callback.filterStringValue.account = false;
- this.callback.filterStringValue.group = false;
- this.callback.filterStringValue.role = false;
- this.callback._filter(this.callback.filterStringValue);
- },
- _renderPropertyControl: function _renderPropertyControl(checkBoxItems) {
- var deferred = Q.defer();
- this._oPropertyUIControl = new PropertyUIControl({
- 'el': this.$el,
- 'glassContext': this.glassContext,
- 'slideout': this.slideout,
- 'items': checkBoxItems
- });
- this._oPropertyUIControl.render().then(function () {
- deferred.resolve(this);
- }.bind(this));
- return deferred.promise;
- },
- _initCheckBoxItems: function _initCheckBoxItems() {
- //NOSONAR
- var checkBoxItems = [{
- type: 'SingleLineLinks',
- name: 'clearAll',
- items: [{
- align: 'right',
- items: [{
- type: 'text',
- value: StringResource.get('clearAll'),
- clickCallback: function () {
- this._onClear();
- }.bind(this)
- }]
- }]
- }, {
- 'type': 'CheckBox',
- 'name': 'users',
- 'icon': 'wft_checkmark',
- 'disabled': this.callback.listAdaptor.allowedSelectionTypes && !_.include(this.callback.listAdaptor.allowedSelectionTypes, "account") ? true : false,
- 'label': StringResource.get('account'),
- 'checked': this.callback.filterStringValue.account ? true : false,
- 'onChange': function (name, value) {
- if (value === true) {
- this.callback.filterStringValue.account = true;
- } else {
- this.callback.filterStringValue.account = false;
- }
- this.callback._filter(this.callback.filterStringValue);
- }.bind(this)
- }, {
- 'type': 'CheckBox',
- 'name': 'groups',
- 'icon': 'wft_checkmark',
- 'disabled': this.callback.listAdaptor.allowedSelectionTypes && !_.include(this.callback.listAdaptor.allowedSelectionTypes, "group") ? true : false,
- 'label': StringResource.get('group'),
- 'checked': this.callback.filterStringValue.group ? true : false,
- 'onChange': function (name, value) {
- if (value === true) {
- this.callback.filterStringValue.group = true;
- } else {
- this.callback.filterStringValue.group = false;
- }
- this.callback._filter(this.callback.filterStringValue);
- }.bind(this)
- }, {
- 'type': 'CheckBox',
- 'name': 'roles',
- 'icon': 'wft_checkmark',
- 'disabled': false,
- 'label': StringResource.get('role'),
- 'checked': this.callback.filterStringValue.role ? true : false,
- 'onChange': function (name, value) {
- if (value === true) {
- this.callback.filterStringValue.role = true;
- } else {
- this.callback.filterStringValue.role = false;
- }
- this.callback._filter(this.callback.filterStringValue);
- }.bind(this)
- }];
- return checkBoxItems;
- },
- _renderFacets: function _renderFacets() {
- //NOSONAR
- var deferred = Q.defer();
- var checkBoxItems = this._initCheckBoxItems();
- this._renderPropertyControl(checkBoxItems).then(function () {
- deferred.resolve();
- });
- return deferred.promise;
- }
- });
- return UserGroupSelectorPane;
- });
|