123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- 'use strict';
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Dashboard
- *| (C) Copyright IBM Corp. 2017, 2019
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define(['../lib/@waca/dashboard-common/dist/glass/controllers/WidgetBaseActionHandler', '../widgets/livewidget/nls/StringResources', '../DynamicFileLoader'], function (BaseClass, stringResources, DynamicFileLoader) {
- 'use strict';
- /**
- * Glass Action controller which loads visualizations
- * based on the LiveWidget using the LiveWidgetUIHelper
- */
- var ActionHandler = BaseClass.extend({
- getOptions: function getOptions(context) {
- var view = this._getDashboardView(context);
- var dashboardApi = view.getDashboardApi();
- var options = {
- className: 'visualizationSlideout',
- dashboardApi: dashboardApi,
- services: view.services, // TODO: remove once core is using the dashboardApi
- title: stringResources.get('visualizationSlideoutTitle'),
- module: 'dashboard-analytics/visualizationPanel/VisualizationPanelView',
- getEntries: this.getEntries.bind(this, context)
- };
- return Promise.resolve(options);
- },
- getEntries: function getEntries(context) {
- return this.createWidgetAddUIHelper(context).then(function (helper) {
- return helper.getEntries();
- }).then(this.getSpecs.bind(this, context));
- },
- getSpecs: function getSpecs(context, entries) {
- return this.createWidgetAddUIHelper(context).then(function (helper) {
- var spec = {};
- var options = {
- onItemClick: function onItemClick(widget, event) {
- return helper.addWidgetBySelection(widget, event, {
- selectOptions: {
- flyout: false
- }
- });
- },
- onItemStartDrag: helper.addWidgetByDrag.bind(helper)
- };
- spec.options = options;
- spec.items = entries;
- return spec;
- });
- },
- // Private
- _getDashboardView: function _getDashboardView(context) {
- return context.glassContext.appController.currentAppView.currentContentView;
- },
- _getUiHelperClass: function _getUiHelperClass() {
- return DynamicFileLoader.load(['dashboard-analytics/widgets/livewidget/LiveWidgetUIHelper']).then(function (modules) {
- return modules[0];
- }.bind(this));
- },
- createWidgetAddUIHelper: function createWidgetAddUIHelper(context) {
- var view = this._getDashboardView(context);
- return this._getUiHelperClass().then(function (HelperClass) {
- var helper = new HelperClass({
- dashboardApi: view.getDashboardApi(),
- services: view.services // TODO : remove once the common add ui helper is not using the services.
- });
- helper.panelAttributes = {
- dashboardApi: view.dashboardApi,
- cdnUrl: view.getCDNUrl(),
- ajaxSvc: view.ajaxSvc
- };
- return helper;
- });
- }
- });
- return ActionHandler;
- });
- //# sourceMappingURL=LiveVisualizationActionHandler.js.map
|