12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- "use strict";
- /*
- * Licensed Materials - Property of IBM
- *
- * IBM Cognos Products: admin
- *
- * (C) Copyright IBM Corp. 2017
- *
- * US Government Users Restricted Rights - Use, duplication or disclosure
- * restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define(['underscore', 'bi/glass/app/plugins/MenuActionInterface', 'bi/admin/nls/StringResource'], function (_, MenuActionInterface, StringResource) {
- 'use strict';
- var SessionLoggingController = MenuActionInterface.extend({
- onSelectItem: function onSelectItem(context) {
- var id = context.target.itemId;
- var idTokens = id.split('.');
- var key = idTokens[idTokens.length - 1];
- if (key === "sessionLoggingButton") {
- var mySessionSlideOut;
- var options = context.target.plugin.itemSpec.items[context.target.specItemIndex].options;
- options.launchPoint = context.target.plugin.getButtonElement();
- options.label = StringResource.get('sessionLoggingTitle');
- options.onHide = function () {
- mySessionSlideOut.contentView.hide();
- }.bind(this);
- options.width = '400px';
- mySessionSlideOut = context.glassContext.appController.showSlideOut(options);
- }
- },
- onOpen: function onOpen(context) {
- var ajaxService = context.glassContext.services.ajax;
- var url = 'v1/configuration/keys/GlugService.enableSessionLogging';
- var promise = ajaxService.ajax({
- 'type': 'GET',
- 'url': url
- });
- return Promise.resolve().then(function () {
- return promise.then(function (data) {
- this.isVisible = _.values(data)[0];
- ;
- }.bind(this));
- }.bind(this));
- },
- isItemVisible: function isItemVisible(context) {
- if (!_.isUndefined(this.isVisible)) {
- if (this.isVisible === "true") {
- return true;
- } else {
- return false;
- }
- }
- }
- });
- return SessionLoggingController;
- });
|