'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