123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626 |
- '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 <tt>EDIT</tt>, <tt>VIEW</tt> and <tt>EDIT_GROUP</tt>.
- * @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 <tt>true</tt> 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 <strong>eventName</strong>.
- * 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.<br>
- * 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.<br>
- * 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<CanvasAPI>}
- */
- 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<object>} 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.<br>
- * 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: <localized name of datasource>,
- * assetId: <storeId of datasource>,
- * type: <datasource type e.g. uploadedFile>}],
- * active: <true if the datasource is used in selected widgets or selected in datasource panel>}],
- * @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<DataSourceAPI[]>} 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.<br>
- Allows user to author the current dashboard. */
- EDIT: 'authoring',
- /** View (consumption) mode.<br>
- Allows user to view and explore the current dashboard. */
- VIEW: 'consumption',
- /** Event group edit mode.<br>
- 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
|