'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * Licensed Materials - Property of IBM * IBM Business Analytics (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([], function () { /** * @interface DashboardAPI * @hideconstructor * @classdesc API class that is used to control a dashboard instance behaviour. */ var DashboardAPI = function () { function DashboardAPI() { _classCallCheck(this, DashboardAPI); } /** * @description Change the dashboard mode between EDIT, VIEW and EDIT_GROUP. * @param {DashboardApi.MODES} mode Dashboard {@link DashboardApi#MODES mode} enumeration value * @example * DashboardApi.setMode(DashboardApi.MODES.VIEW); */ DashboardAPI.prototype.setMode = function setMode() {}; /** * @function DashboardAPI#setDirty * @description set a dashboard as dirty or not * @param {boolean} dirty true if set a dashboard to dirty, false otherwise */ DashboardAPI.prototype.setDirty = function setDirty() {}; /** * @function DashboardAPI#getMode * @description Get the current dashboard mode. * @return {DashboardApi.MODES} Dashboard {@link DashboardApi#MODES mode} enumeration value * @example * DashboardApi.getMode().then(function(mode) { * console.log(mode); * }); */ DashboardAPI.prototype.getMode = function getMode() {}; /** * @description Get the dashboard instance specification * @return {Object} dashboard spec * @example * DashboardApi.getSpec().then(function(spec) { * console.log(spec); * }); */ DashboardAPI.prototype.getSpec = function getSpec() {}; /** * @function DashboardAPI#undo * @description Undo the last action performed on the dashboard * @example * // edit the dashboard * ... * DashboardApi.undo(); */ DashboardAPI.prototype.undo = function undo() {}; /** * @function DashboardAPI#redo * @description Redo the last {@link DashboardApi#undo DashboardApi.undo} action performed on the dashboard * @example * // edit the dashboard * ... * DashboardApi.undo(); * DashboardApi.redo(); */ DashboardAPI.prototype.redo = function redo() {}; /** * @function DashboardAPI#toggleProperties * @description Toggle the properties pane * @param {boolean} [toggle] if true display the properties pane, * otherwise hide the properties pane. The state is toggled from the current state when omitted. */ DashboardAPI.prototype.toggleProperties = function toggleProperties() {}; /** * @function DashboardAPI#on * @description Register an event handler for dashboard events * @param {string} eventName Name of the dashboard event * @param {function} handler Event handler to be called when the event occurrs. * Multiple handlers can be registered with the same eventName. * Each handlers needs to be registered and unregistered individually. * @example * // handle the event when the dashboard is modified * function onModified(event) { * console.log('dashboard has been modified'); * } * * // Register the event handler * DashboardApi.on(DashboardApi.EVENTS.DIRTY, onModified); */ DashboardAPI.prototype.on = function on() {}; /** * @function DashboardAPI#off * @description Unregister an event handler that was registered with {@link DashboardApi#on DashboardApi.on} * @param {string} eventName Name of the dashboard event * @param {function} handler Event handler to be called when the event occurrs * @example * // handle the event when the dashboard is modified * function onModified(event) { * console.log('dashboard has been modified'); * } * * // Register the event handler * DashboardApi.on(DashboardApi.EVENTS.DIRTY, onModified); * ... * // Unregister the event handler * DashboardApi.off(DashboardApi.EVENTS.DIRTY, onModified); */ DashboardAPI.prototype.off = function off() {}; /** * @function DashboardAPI#addSources * @description Add sources that can used as data sources in the dashboard.
* Once the source is successfully added, it will appear on the datasource list pane with the given name. * @param {String} sourceInfo.id Identifier for the source. Will be passed back for actions such as relink * @param {String} sourceInfo.name Name of the source * @param {String} sourceInfo.module The module definition * @example * DashboardApi.addSources([{ * id: 'myUniqueId', * name: 'Sample datasource', * module: {...} * }, { * id: 'myUniqueId2', * name: 'Sample datasource 2', * module: {...} * }]); * @deprecated Use {@link DataSourcesAPI#addDataSource} */ DashboardAPI.prototype.addSources = function addSources() {}; /** * @function DashboardAPI#relink * @description Relink an existing source to a new module.
* Widgets that reference this source will reload after the relink is finished. * @param {String} sourceInfo.id Id of the source to relink. This id is passed to the caller in the relink:clicked event * @param {String} sourceInfo.name Name of the source, only needed if you wish to change the name. * @param {String} sourceInfo.module The module definition * @example * DashboardApi.relink({ * id: '123456', * name: 'Sample datasource', * module: {...} * }); * @deprecated Use {@link DataSourceAPI#relink} */ DashboardAPI.prototype.relink = function relink() {}; /** * @function DashboardAPI#getCanvas * @description Get the {@link CanvasAPI Canvas} API * @return {CanvasAPI} */ DashboardAPI.prototype.getCanvas = function getCanvas() {}; /** * @async * @function DashboardAPI#getCanvasWhenReady * @description Asynchronously get the {@link CanvasAPI Canvas} API * @return {Promoise} */ DashboardAPI.prototype.getCanvasWhenReady = function getCanvasWhenReady() {}; /** * @function DashboardAPI#getType * @description Get the dashboard type * @return {string} dashboard type ['dashboard' | 'story' | 'explore'] */ DashboardAPI.prototype.getType = function getType() {}; /** * @function DashboardAPI#getName * @description Get the dashboard name * @return {string} dashboard name */ DashboardAPI.prototype.getName = function getName() {}; /** * @function DashboardAPI#canAuthor * @description Determine whether user has permission to author the dashboard * @return {boolean} true if the dashboard can be authored, otherwise false */ DashboardAPI.prototype.canAuthor = function canAuthor() {}; /** * @function DashboardAPI#getService * @description Get a global service * @param {DashboardAPI.GLOBAL_SERVICES} service global service enum * @return {object} service object */ DashboardAPI.prototype.getService = function getService() /* service */{}; /** * @async * @function DashboardAPI#getServiceWhenReady * @description Asynchronously get the global service * @param {DashboardAPI.GLOBAL_SERVICES} service global service enum * @return {Promise} Promise which resolves a service object */ DashboardAPI.prototype.getServiceWhenReady = function getServiceWhenReady() /* service */{}; /** * @function DashboardAPI#getFeature * @description Get the feature with the given feature name * @param {string} name unique name of the feature * @return {object} the feature API object */ DashboardAPI.prototype.getFeature = function getFeature() /* name */{}; /** * @function DashboardAPI#triggerDashboardEvent * @description Trigger a dashboard event * @param {string} name Event name * @param {object} payload Event payload */ DashboardAPI.prototype.triggerDashboardEvent = function triggerDashboardEvent() /* name, payload */{}; /** * @function DashboardAPI#showToast * @description Display a toast message * @param {string} message the message string * @param {object} options toast message options * @param {string} options.type message type ('info', 'error') * @param {boolean} options.preventDuplicates prevent from duplicate toast messages being displayed */ DashboardAPI.prototype.showToast = function showToast() /* message, options */{}; /** * @function DashboardAPI#showMessage * @description Display a message box with the given message * @param {string} message the message string * @param {string} [type] message type ('info', 'error') */ DashboardAPI.prototype.showMessage = function showMessage() /* message, type = 'info' */{}; /** * @function DashboardAPI#showSlideOut * @description Display a slideout on the dashboard * @param {object} option slideout options */ DashboardAPI.prototype.showSlideOut = function showSlideOut() /* options */{}; /** * @function DashboardAPI#showContextMenu * @description Display a context menu on the dashboard * @param {object} option Context menu options */ DashboardAPI.prototype.showContextMenu = function showContextMenu() /* options */{}; /** * @function DashboardAPI#getPluginExtension * @description get the plugin extension object * @param {string} id unique plugin identifier */ DashboardAPI.prototype.getPluginExtension = function getPluginExtension() /* id */{}; /** * @function DashboardAPI#getCollectionExtension * @description get the collection extension object * @param {string} id unique collection identifier */ DashboardAPI.prototype.getCollectionExtension = function getCollectionExtension() {}; /** * @function DashboardAPI#getConfiguration */ DashboardAPI.prototype.getConfiguration = function getConfiguration() {}; /** * @function DashboardAPI#getAppConfig * @deprecated replaced by DashboardAPI#getConfiguration */ DashboardAPI.prototype.getAppConfig = function getAppConfig() {}; /** * @function DashboardAPI#openApplication * @param {string} name application name * @param {object} options application options */ DashboardAPI.prototype.openApplication = function openApplication() /* name, options */{}; /** * @function DashboardAPI#closeApplication * @param {string} name application name * @param {string} id application unique identifier * @param {object} options application options */ DashboardAPI.prototype.closeApplication = function closeApplication() /* name, id, options */{}; /** * @function DashboardAPI#showErrorMessage * @deprecated replaced by DashboardAPI#showMessage */ DashboardAPI.prototype.showErrorMessage = function showErrorMessage() {}; /** * @function DashboardAPI#getApplicationName * @deprecated replaced by DashboardAPI#getType */ DashboardAPI.prototype.getApplicationName = function getApplicationName() {}; /** * @function DashboardAPI#getApplicationLabel * @deprecated replaced by DashboardAPI#getName */ DashboardAPI.prototype.getApplicationLabel = function getApplicationLabel() {}; /** * @function DashboardAPI#getGlassSvc * @deprecated replaced by DashboardAPI#getServiceWhenReady */ DashboardAPI.prototype.getGlassSvc = function getGlassSvc() {}; /** * @function DashboardAPI#getGlassCoreSvc * @deprecated replaced by DashboardAPI#getService */ DashboardAPI.prototype.getGlassCoreSvc = function getGlassCoreSvc() {}; /** * @function DashboardAPI#getDashboardSvc * @deprecated replaced by {@link DashboardAPI#getFeature} */ DashboardAPI.prototype.getDashboardSvc = function getDashboardSvc() {}; /** * @function DashboardAPI#getDashboardSvc * @deprecated replaced by {@link DashboardAPI#getFeature} */ DashboardAPI.prototype.getDashboardCoreSvc = function getDashboardCoreSvc() {}; /** * @function DashboardAPI#findGlassPlugin * @deprecated replaced by {@link DashboardAPI#getPluginExtension} */ DashboardAPI.prototype.findGlassPlugin = function findGlassPlugin() {}; /** * @function DashboardAPI#findGlassCollection * @deprecated replaced by {@link DashboardAPI#getCollectionExtension} */ DashboardAPI.prototype.findGlassCollection = function findGlassCollection() {}; /** * @function DashboardAPI#getLayout * @deprecated already exists in {@link CanvasAPI} * @todo confirm this is not being used by explore */ DashboardAPI.prototype.getLayout = function getLayout() {}; /** * @function DashboardAPI#deselectAllWidgets * @deprecated moved to {@link CanvasAPI} * Delect all currently select widgets */ DashboardAPI.prototype.deselectAllWidgets = function deselectAllWidgets() {}; /** * @function DashboardAPI#getToolbarActions * @deprecated */ DashboardAPI.prototype.getToolbarActions = function getToolbarActions() {}; /** * @function DashboardAPI#openAppView * @deprecated Replaced by {@link DashboardAPI#openGlassApplication} */ DashboardAPI.prototype.openAppView = function openAppView() {}; /** * @function DashboardAPI#addContentToCanvas * @description Add a content to the current dashboard canvas * @deprecated Replaced by {@link CanvasAPI#addContent} */ DashboardAPI.prototype.addContentToCanvas = function addContentToCanvas() {}; /** * @function DashboardAPI#waitTillWidgetsRendered * @deprecated Replaced by {@link CanvasAPI#getWidgetsWhenRendered} */ DashboardAPI.prototype.waitTillWidgetsRendered = function waitTillWidgetsRendered() {}; /** * @function DashboardAPI#getCollectionConfig * @deprecated needs to be integrated as part of {@link DashboardAPI#getCollectionExtension} */ DashboardAPI.prototype.getCollectionConfig = function getCollectionConfig() {}; /** * @todo DO NOT document. Needs to be removed. * @deprecated this should not be exposed as an API * @ignore */ DashboardAPI.prototype.getCurrentContentView = function getCurrentContentView() {}; /** * @function DashboardAPI#getSources * @description Gets the data sources that are in use in the dashboard.
* Once the source is successfully added, it will appear on the datasource list pane with the given name. * Returns a promise that resolves to an array of datasource info: * [{ name: , * assetId: , * type: }], * active: }], * @example * DashboardApi.getSources(); * @deprecated Use{@link DataSourcesAPI#getSourcesInfo} instead */ DashboardAPI.prototype.getSources = function getSources() {}; /** * @function DashboardAPI#getDataSourceList * @description Gets the data sources that are being used by the dashboard. * @return {Promise} Returns a promise that will be resolved with an array of {@link DataSourceAPI} objects. * @deprecated Use {@link DashboardAPI#getFeature} to get the dataSource feature and call {@link DataSourcesAPI#getDataSourceList} */ DashboardAPI.prototype.getDataSourceList = function getDataSourceList() {}; /** * @function DashboardAPI#setActiveDataSourceId * @description Keep track of the current active datasource with the given datasource id * @param {string} sourceId current active datasource identifier * @deprecated Use {@link DataSourcesAPI#setActiveDataSourceId} instead */ DashboardAPI.prototype.setActiveDataSourceId = function setActiveDataSourceId() {}; /** * @function DashboardAPI#getActiveDataSourceId * @description Get the current active datasource id * @return {string} current active datasource identifier * @deprecated Use {@link DataSourcesAPI#getActiveDataSourceId} instead */ DashboardAPI.prototype.getActiveDataSourceId = function getActiveDataSourceId() {}; /** * @deprecated Moved to {@link CanvasAPI Canvas} API * @function DashboardAPI#copy * @description Copy the currently selected widget(s) on the dashboard */ DashboardAPI.prototype.copy = function copy() {}; /** * @deprecated Moved to {@link CanvasAPI Canvas} API * @function DashboardAPI#paste * @description Paste the copied widget(s) to the dashboard * @return {Promise} promise which is resolved once the widget(s) are successfully pasted */ DashboardAPI.prototype.paste = function paste() {}; DashboardAPI.prototype.destroy = function destroy() {}; return DashboardAPI; }(); /** * @public * @readonly * @enum {string} * @memberof DashboardAPI */ DashboardAPI.MODES = { /** Edit (authoring) mode.
Allows user to author the current dashboard. */ EDIT: 'authoring', /** View (consumption) mode.
Allows user to view and explore the current dashboard. */ VIEW: 'consumption', /** Event group edit mode.
Allows user to edit the widget connections in the current dashboard. */ EDIT_GROUP: 'eventGroups' }; /** * @public * @readonly * @enum {string} * @memberof DashboardAPI */ DashboardAPI.GLOBAL_SERVICES = { /** AJAX service */ AJAX: '.Ajax', /** Logger service */ LOGGER: '.Logger', /** LiveWidget service */ LIVEWIDGET: '.LiveWidgetService' }; /** * @public * @readonly * @enum {string} * @memberof DashboardAPI */ DashboardAPI.GLOBAL_INTERNAL_SERVICES = { CONTENT: '.Content', USER_PROFILE: '.UserProfile', PINNING: '.DashboardPinning', THEME: '.DashboardTheme', CONVERSION: '.ConversionService', DRILL_INFO: '.DrillInfoService', CONTENT_DIALOG: '.ContentDialogFactory', DATA_CONNECTION: '.DataConnectionServiceFactory' }; return DashboardAPI; }); //# sourceMappingURL=DashboardAPI.js.map