1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- 'use strict';
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2014, 2020
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define(['../lib/@waca/core-client/js/core-client/ui/core/View', './PinsPanel', 'text!./templates/PinPanel.html', '../app/nls/StringResources', 'doT'], function (View, PinsPanel, ViewTemplate, StringResources, dot) {
- var PinView = View.extend({
- init: function init() {
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- PinView.inherited('init', this, arguments);
- var params = options.params ? options.params : window.location.search;
- this.viewMode = this.isViewMode(params);
- this.glassContext = options.glassContext;
- this.canvasController = options.canvasController;
- this.dashboardApi = this.canvasController.dashboardApi;
- this.slideout = options.slideout;
- this.template = dot.template(ViewTemplate);
- },
- isViewMode: function isViewMode(params) {
- var viewMode = false;
- var getParam = function getParam(param) {
- return decodeURIComponent((new RegExp('[?|&]' + param + '=' + '([^&;]+?)(&|#|;|$)').exec(params) || ['', ''])[1].replace(/\+/g, '%20')) || null;
- };
- var key = getParam('mode');
- if (key && key === 'view') {
- viewMode = true;
- }
- return viewMode;
- },
- getUrl: function getUrl() {
- return '/pins';
- },
- render: function render() {
- var _this = this;
- this.$el.html(this.template({
- lbl_alternateTitle: StringResources.get('pinsOld')
- }));
- var $listEl = this.$el.find('.pinListView');
- return Promise.all([this.dashboardApi.getGlassSvc('.DashboardPinning'), this._getDndManager()]).then(function (results) {
- var dashboardPinningService = results[0];
- var PinsPanelClass = _this._getPinsPanelClass();
- _this._pinListView = new PinsPanelClass({
- el: $listEl,
- appController: _this.appController,
- viewMode: _this.viewMode,
- glassContext: _this.glassContext,
- canvasController: _this.canvasController,
- dndManager: _this.dndManager,
- dashboardPinningService: dashboardPinningService,
- smartNamingSvc: _this.dashboardApi.getDashboardCoreSvc('.SmartNamingSvc')
- });
- _this._pinListView.render();
- });
- },
- _getPinsPanelClass: function _getPinsPanelClass() {
- return PinsPanel;
- },
- remove: function remove() {
- this._pinListView.remove();
- return PinView.inherited('remove', this, arguments);
- },
- shouldUpdateGlass: function shouldUpdateGlass() {
- return false;
- },
- _getDndManager: function _getDndManager() {
- if (this.dndManager) {
- return Promise.resolve();
- } else {
- return this.dndManager = this.dashboardApi.getFeature('DashboardDnd.internal');
- }
- }
- });
- return PinView;
- });
- //# sourceMappingURL=PinView.js.map
|