12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: CA Mobile
- *| (C) Copyright IBM Corp. 2019
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define([
- './nls/StringResource',
- 'bi/glass/app/plugins/MenuActionInterface'
- ], function(StringResources, MenuActionInterface) {
- 'use strict';
- var ActionHandler = MenuActionInterface.extend({
- /**
- * action handlers for mobile app item(s) in the personal menu
- */
- actionHandlers: {
- 'mobileApp': function(context) {
- return Promise.resolve().then(function() {
- var mobileAppSlideout;
- var options = context.target.plugin.itemSpec.items[context.target.specItemIndex].options;
- options.launchPoint = context.target.plugin.getButtonElement();
- options.label = StringResources.get('mobileAppSlideoutLabel');
- options.onHide = function() {
- mobileAppSlideout.hide();
- }.bind(this);
- options.width = '400px';
- mobileAppSlideout = context.glassContext.appController.showSlideOut(options);
- }.bind(this));
- }
- },
- /**
- * Called when the mobile button is clicked
- */
- onSelectItem: function(context) {
- var key = this._getKey(context.target.itemId);
- var handler = this.actionHandlers[key];
- if(handler) {
- var handle = handler.bind(this, context);
- return handle();
- }
- },
- _getKey: function(itemId) {
- var idTokens = itemId.split('.');
- return idTokens[idTokens.length - 1];
- }
- });
- return ActionHandler;
- });
|