// Licensed Materials - Property of IBM // IBM Cognos Products: rs // (C) Copyright IBM Corp. 2015, 2021 // US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. define(['bi/glass/app/plugins/ButtonActionInterface'], function(ButtonActionInterface) { 'use strict'; var ClassicViewerButtonActionInterface = ButtonActionInterface.extend({ onPress: function(context) { console.log("cvAppButtonActions pressed"); console.log('context.target.plugin.itemSpec.id: %s', context.target.plugin.itemSpec.id); var v_sId = context.target.plugin.itemSpec.id; switch(v_sId) { case "com.ibm.bi.classicviewer.editBtn": this.runAuthoring(context); break; case "com.ibm.bi.classicviewer.previousReportBtn": var v_oCognosViewer = context.glassContext.currentAppView.currentContentView.getCognosViewer(); v_oCognosViewer.rvMainWnd.executePreviousReport(-1); break; default: console.log("Unhandled label: " + v_sId); } }, runAuthoring: function(context) { var v_sStoreId = context.glassContext.currentAppView.currentContentView.getReportStoreId(); var v_oOpenAppViewContent = { action: 'edit', cmProperties: { id: v_sStoreId } }; var v_aParameters = context.glassContext.currentAppView.currentContentView.getParameterValues(); if (v_aParameters && v_aParameters.length > 0) { v_oOpenAppViewContent.promptParameters = JSON.stringify( v_aParameters ); } // When drilling, target is opened with closeWindowOnLastView=true // As a result, if the perspective is closed, the glass actually closes the window. // Therefore, open the authoring perspective for edit first. context.glassContext.openAppView("authoring", {content: v_oOpenAppViewContent } ) .then(function() { context.glassContext.closeAppView("classicviewer", v_sStoreId); }); } }); return ClassicViewerButtonActionInterface; });