1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2018, 2020
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define([
- 'bi/glass/app/ContentView',
- 'text!bi/content_apps/common/templates/PageletViewTemplate.html',
- 'bi/glass/api/Url',
- 'jquery',
- 'doT'
- ], function(ContentView, viewTemplate, Url, $, dot) {
- 'use strict'; //NOSONAR: Meant to be strict
- var PageletView = ContentView.extend({
- init: function(options, appView) {
- $.extend(this, options);
- if (appView) {
- var actionId = 'common.navBarAction.hideNavBarItemLabelsAction';
- var glassContext = appView.glassContext;
- glassContext.appController.canExecuteAction(actionId, { glassContext: glassContext }).then(function(canExecute) {
- if (canExecute) {
- return glassContext.appController.performAction(actionId, { glassContext: glassContext });
- }
- });
- }
- this._url = new Url();
- PageletView.inherited('init', this, arguments);
- },
- setFocus: function() {
- ContentView.inherited('setFocus', this, arguments);
- this.trigger('change:state');
- },
- render: function() {
- return this._url.getObjInfoFromContent(this.glassContext.services.ajax, { objRef: this.id }, ['defaultName']).then(function(objInfo) {
- this.defaultName = objInfo.defaultName;
- var storeId = encodeURIComponent('"' + this.id + '"');
- var url = 'v1/disp?b_action=dashboard&pathinfo=/pagelet&path=storeID(' + storeId + ')&frag-header=false';
- return this._injectiFrame({ genericIframe_url: url });
- }.bind(this));
- },
- getContent: function() {
- return {
- objRef: this.id,
- id: this.id
- };
- },
- getType: function() {
- return 'pagelet';
- },
- getTitle: function() {
- return this.defaultName;
- },
- execute: function(context) {
- return {
- perspective: 'pagelet',
- objRef: context.urlMap.objRef
- };
- },
- _injectiFrame: function(context) {
- $.extend(context,{ 'genericIframe_title': this.getTitle() });
- var sHtml = dot.template(viewTemplate)(context);
- this.$el.append(sHtml);
- return Promise.resolve();
- }
- });
- return PageletView;
- });
|