'use strict'; /* * Licensed Materials - Property of IBM * IBM Cognos Products: Dashboard (C) Copyright IBM Corp. 2014, 2021 * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ define(['../AnalyticsBaseWidget', 'underscore', 'jquery', '../../prompts/PromptManager', '../../DynamicFileLoader', '../../lib/@waca/core-client/js/core-client/utils/Deferred'], function (WidgetBase, _, $, PromptManager, DynamicFileLoader, Deferred) { 'use strict'; /** * INTENT: DeprecateWidgetBase currently includes implementation for the DataWidget class.... * TODO: Its role should be formalized or this class should be deprecated and divided among more focused objects. */ var DeprecateWidgetBase = WidgetBase.extend({ isMaximizeSupported: true, customPalettePrefix: '__CM__', // constructor init: function init(params) { DeprecateWidgetBase.inherited('init', this, arguments); //Deferred object used indicate that all the VisDefinition specs are fetched and Widget is ready for rendering this.readyDfd = new Deferred(); this.visualizationDfd = new Deferred(); //dashboard is active on init this._isDashboardActive = true; this.logger = this.dashboardApi.getGlassCoreSvc('.Logger'); this._useNewQueryApi = params.useNewQueryApi; this.visModelManager = null; // The model for this visualization this.dataSet = null; // The dataSet (datasource object) for this visualization mappings (columns) this.transactionApi = this.dashboardApi.getFeature('Transaction'); this.visualizationFeature = this.content.getFeature('Visualization'); this.colorsService.on('palette:deleted', this.onPaletteDeleted, this); this.colorsService.on('palette:updated', this.onPaletteUpdated, this); }, destroy: function destroy() { DeprecateWidgetBase.inherited('destroy', this, arguments); this.clearRefreshTimer(); this.dataSet = null; if (this.model) { this.model.off('change:queryRefresh', this.registerRefreshTimer, this); this.model = null; } this._removeShapingModelEvents(); this.readyDfd = null; this.visualizationDfd = null; this.logger = null; this.boardModel = null; }, reRender: function reRender(extraInfo) { return this.visAPI.reRender(extraInfo); }, registerEvents: function registerEvents() { DeprecateWidgetBase.inherited('registerEvents', this, arguments); this.dashboardApi.on('widget:toolbar:show:before', this.onToolbarShowBefore, this); this.dashboardApi.on('widget:toolbar:hide:after', this.onToolbarHideAfter, this); this.dashboardApi.on('dashboard:show', this.onDashboardShow, this); this.dashboardApi.on('dashboard:deactivate', this.onDashboardDeactivate, this); }, unregisterEvents: function unregisterEvents() { DeprecateWidgetBase.inherited('unregisterEvents', this, arguments); this.dashboardApi.off('widget:toolbar:show:before', this.onToolbarShowBefore, this); this.dashboardApi.off('widget:toolbar:show:after', this.onToolbarShowAfter, this); this.dashboardApi.off('widget:toolbar:show:after', this.onToolbarShowAfter, this); this.dashboardApi.off('widget:toolbar:hide:after', this.onToolbarHideAfter, this); this.dashboardApi.off('dashboard:show', this.onDashboardShow, this); this.dashboardApi.off('dashboard:deactivate', this.onDashboardDeactivate, this); this.colorsService.off('palette:deleted', this.onPaletteDeleted, this); this.colorsService.off('palette:updated', this.onPaletteUpdated, this); }, getCurrentVis: function getCurrentVis() { return this._currVis; }, onStartMove: function onStartMove() /*payload*/{ if (this._currVis && this._currVis.onStartMove) { this._currVis.onStartMove(); } }, onStopMove: function onStopMove() /*payload*/{ if (this._currVis && this._currVis.onStopMove) { this._currVis.onStopMove(); } }, onToolbarHideAfter: function onToolbarHideAfter(payload) { if (this._currVis) { var selector = this._currVis.getCurrentViewSelector(); if (selector && selector.setPopoverClosed) { selector.setPopoverClosed(payload); } } }, onToolbarShowBefore: function onToolbarShowBefore(payload) { if (this._currVis) { var selector = this._currVis.getCurrentViewSelector(); if (selector && selector.setPopoverOpened) { selector.setPopoverOpened(payload); } } }, /** * Called when the parent dashboard fires the dashboard:show event. */ onDashboardShow: function onDashboardShow() { //start our refresh timer if needed. this._isTimerActive = true; this._isDashboardActive = true; }, /** * Called when the parent dashboard fires the dashboard:deactivate event. */ onDashboardDeactivate: function onDashboardDeactivate() { //clear the refresh timer so it doesn't fire when the dashboard is not activated (aka shown) this._isTimerActive = false; this._isDashboardActive = false; }, /** * When a theme mapping is updated (a new vis type definition is provided) we need to update * the theme mapping. * @param themeMapping - json description of which properties map to which super property * For example: * { * "id": "axisLineColor", * "mapping": [ * "valAxisLineColor", * "catAxisLineColor" * ] * } */ updateThemeMapping: function updateThemeMapping(themeMapping) { this.colorsService.updateThemeMapping(themeMapping); }, /** * Widget Life cycle handler - gets called when container is ready and the widget model is initialized. * This override is used to initialize the white list since the whitelist is attached to the widget model. */ onContainerReady: function onContainerReady(containerContext) { var _this = this; console.debug('onContainerReady'); DeprecateWidgetBase.inherited('onContainerReady', this, arguments); this.model = containerContext.model; if (this.model) { this.model.on('change:queryRefresh', this.registerRefreshTimer, this); } // TODO: we should build this automatically from the viz definition // TODO: livewidget_cleanup -- most of these properties are not part of the live widget root , so they are not needed here this.addWhiteListAttrs('titleHtml', 'name', 'type', 'localFilters', 'visId', 'showTitle', 'properties', 'maintainAxisScales', 'colorPalette', 'showItemLabel', 'titleType', 'titleMode', 'truncateTitle', 'hideLegend', 'hideAxisTitleLabels', 'legendPosition', 'lineColor', 'interpolation', 'elementColor', 'symbolShape', 'symbolFill', 'heatScalePalette', 'heatScaleColorOrder', 'hideRadialTitle', 'hideRadialValue', 'archetype', 'expandOnRender', 'hideLabel', 'hideValue', 'hideTreeMapLeafLabels', 'pieAsDonut', 'hideGridLines', 'hideSymbols', 'hideDataLines', 'conditions', 'queryRefresh', 'transpose', 'labelLocation', 'interpolate', 'condColorPalette', 'condColorOrder', 'hideSummaries', 'legend.position', 'donutRadius', 'labelLocation', 'lineWithPoints.symbol', 'itemLabel.display', 'tiledmap.style', 'fillDirection', 'savedPrompts', 'labels.visible', 'label.format', 'defaultPaletteIndex', 'actions', 'showInsights', 'lineWithPoints.symbol'); var getContentRef = function getContentRef(propName) { var value = _this.visAPI.getPropertyValue(propName); // We only want palettes that start with __CM__ to be added to the content references if (value && value.indexOf(_this.customPalettePrefix) === 0) { return value.split(_this.customPalettePrefix)[1]; } return null; }; var contentReferences = []; ['colorPalette', 'contColorPalette', 'condColorPalette'].forEach(function (propName) { contentReferences.push({ type: 'palette', get: function get() { return getContentRef(propName); } }); }); this.addContentReferences(contentReferences); this.registerRefreshTimer(); }, /** * Reset the widget size to the visualization preferred size. * */ resizeToPreferredSize: function resizeToPreferredSize() { this.setPreferredSize(this.visAPI.getPreferredSize()); }, /** * place the visualization into the dom at the specified point (replace the previous dataview if any) * By default, the visualization will be placed at this.el. * @param visualization the visualization (Rave Chart, Grid etc.) * @param domElement the dom parent node. */ placeAt: function placeAt(visualization, domElement) { if (!domElement) { domElement = this.el; } if (this._currVis) { this._currVis.remove( /*finalRemove*/false); } this._currVis = visualization; this._currVis.predictData = this.predictData; this.visualizationDfd.resolve(visualization); this.setLayoutProperties({ pannable: this._currVis.isPannable, mobilePannable: this._currVis.isMobilePannable, noRotate: this._currVis.noRotate, maximizable: this._currVis.isMaximizable }); $(domElement).children('.dataview').detach(); if (visualization.placeAt) { visualization.placeAt(domElement, /*index (when theres no canvas, index is always 0*/0); } else { $(visualization.el).appendTo(domElement); } }, /** * @returns the current dataset (also known as a dataSource object). */ getDataSet: function getDataSet() { return this.dataSet; }, _refreshWidgets: function _refreshWidgets(event) { /** * Check the sender with the following conditions to avoid unnecessary refresh or infinite refresh. * 1. Check the event is NOT triggered by the current widget itself. * 2. Check if the refresh is already done by checking if the current widget is included in refreshedWidgets. */ if (event.sender.widget !== this && this.visAPI && (!event.sender.refreshedWidgets || event.sender.refreshedWidgets.indexOf(this) === -1)) { //only check if item is in used if it is specified if (event.dataItemId && !this.visAPI.isDataItemMapped(event.dataItemId)) { return; } var sender = event.sender; if (!sender) { sender = {}; } if (!sender.refreshedWidgets) { sender.refreshedWidgets = []; } sender.refreshedWidgets.push(this); this.reRender({ sender: sender }); if (this.visExpandMode) { this.visExpandMode.renderSlotsView(); } } }, // perform the menu action onMenuAction: function onMenuAction() {}, _applyingExternalFilter: {}, _createEventTransactionToken: function _createEventTransactionToken(event) { var transactionToken = void 0; if (event && event.data) { if (event.data.transactionToken && this.transactionApi.isValidTransaction(event.data.transactionToken)) { // create a sub transaction token transactionToken = this.transactionApi.startTransaction(event.data.transactionToken); } else { if (event.data.undoRedoTransactionId) { // create a new transaction with the legacy undoRedoTransactionId transactionToken = this.transactionApi.startTransactionById(event.data.undoRedoTransactionId); } else { // create a new transaction from scratch transactionToken = this.transactionApi.startTransaction(); } event.data.transactionToken = transactionToken; } } else { transactionToken = this.transactionApi.startTransaction(); event.data = { transactionToken: transactionToken }; } return transactionToken; }, /** * Widget Life cycle handler - gets called when board spec gets changed e.g. when undo/redo happens. * * For all events, notify the appropriate support object(s) that it changed (so it can notify the views) * For external events, trigger a 'dw:' (to be caught and processed by other widgets) * * @param options The updated model */ _onModelChange: function _onModelChange(event) { var _this2 = this, _arguments = arguments; if (event.data && event.data.saveOnly) { return; } // TODO - temporary until the events cleanup is complete // we no longer need to send intermediate events for properties and localFiters and searchFlter if (['properties', 'localFilters', 'searchFilters', 'visId'].indexOf(event.name) !== -1) { return; } var transactionToken = this._createEventTransactionToken(event); // Reset error state on change of page context. if (this.visAPI) { this.visAPI.clearModelInvalid(); } this.readyDfd.promise.then(function () { // execute super class DeprecateWidgetBase.inherited('_onModelChange', _this2, _arguments); }).finally(function () { _this2.trigger('dwChange:' + event.name, event, _this2); _this2.transactionApi.endTransaction(transactionToken); }); /* * If the model has changed and we are being told about it from the UndoRedoController then we should probably * update our properties spec. Of course, we only really need to if we are in focus. If we aren't then the * properties are refreshed anyway when we gain focus. Lucky for us, this is actually all taken care of in the * WidgetBase object we inherit from. Yeah us! */ DeprecateWidgetBase.inherited('_onModelChange', this, arguments); }, getUnavailableLocalFilter: function getUnavailableLocalFilter() { return this.visModelManager.filterSupport.getUnavailableLocalFilter(); }, updateMissingFilters: function updateMissingFilters() { this.visModelManager.filterSupport.updateMissingFilters(); }, resize: function resize(options) { if (!this.visAPI || !this.el) { return; } this.visAPI.resize(this.$el.innerWidth(), this.$el.innerHeight(), options); }, /** * This method checks if the property specified is one of the * vis properties that we can override. * @param property - property of interest * @returns true if its one of the overridable properties. */ isAnOverridableVisProperty: function isAnOverridableVisProperty(property) { // TODO: we should build this automatically fro the viz definitions var asOverride = ['fillDirection', 'legendPosition', 'lineColor', 'maintainAxisScales', 'showItemLabel', 'colorPalette', 'symbolShape', 'symbolFill', 'hideLegend', 'elementColor', 'interpolation', 'shortNumbers', 'hideAxisTitleLabels', 'heatScalePalette', 'contColorPalette', 'hideRadialTitle', 'hideRadialValue', 'valueColor', 'hideLabel', 'hideValue', 'hideTreeMapLeafLabels', 'pieAsDonut', 'hideGridLines', 'hideSymbols', 'hideDataLines', 'transpose', 'rangeSlider', 'labelLocation', 'condColorPalette', 'condColorOrder', 'hideSummaries', 'legend.position', 'donutRadius', 'labelLocation', 'lineWithPoints.symbol', 'itemLabel.display', 'tiledmap.style', 'labels.visible', 'label.format']; return asOverride.indexOf(property) !== -1; }, /** * Returns the conditional color palette with the given name * @param paletteName - conditional color palette name * @returns the conditional color palette */ getConditionalPalette: function getConditionalPalette(paletteName) { return this.colorsService.getPalette({ paletteId: paletteName, type: 'ConditionalPalette', defaultIfNotFound: true }); }, /** * return new array of colors with 'at' property replaced with value in reverse order. * example: * input palette: [ * {"at":"0.0%","color":"#000033"}, * {"at":"50.0%","color":"#319bd4"}, * {"at":"100%", "color": "#EEEEFF"} * ] * output palette: [ * {"at":"100.0%","color":"#000033"}, * {"at":"50.0%","color":"#319bd4"}, * {"at":"0%", "color": "#EEEEFF"} * ] */ _reverseColorPointAt: function _reverseColorPointAt(palette) { //Reverse 'at' value var newPalette = _.map(palette, _.clone); var count = newPalette.length; _.each(newPalette, function (item, idx) { var reverseIdx = count - idx - 1; var newAt = palette[reverseIdx].at; item.at = newAt; }); return newPalette; }, /** * The following method is called when the heat scale palette property is changed by the * user in the properties panel. * @param info - information needed to change the heat scale palette property to the * state the user specified. */ onHeatScalePaletteChanged: function onHeatScalePaletteChanged(info) { // For heat scale palette order we just need to handle it like any other property // change in the data widget base. this.onPropertyUpdate(info); }, onPaletteDeleted: function onPaletteDeleted(_ref) { var paletteId = _ref.paletteId; this.onCustomPaletteChanged(paletteId, 'delete'); }, onPaletteUpdated: function onPaletteUpdated(_ref2) { var paletteId = _ref2.paletteId; this.onCustomPaletteChanged(paletteId, 'update'); }, onCustomPaletteChanged: function onCustomPaletteChanged() { // Sub widgets that have palette properties should override this }, onColorPaletteChanged: function onColorPaletteChanged(info) { this.onPropertyUpdate(info); }, _reMapBundle: function _reMapBundle(bundleDefinition, visDefinitions) { var def = visDefinitions.find(function (visDefinition) { return visDefinition.id === bundleDefinition.id; }); if (!def) { //TODO: Remove this condition def = visDefinitions.find(function (visDefinition) { return visDefinition.id === bundleDefinition.minimalVisId; }); } return def; }, /** * UI update support function: Update the vis properties with the given properties * * This function is called to update the widget model in response to a user change to the UI for an * overridable property (one that is persisted to the widgetModel). * * It is done by silently synching the properties collection to the UI updates, then serializing * that colletion into the widget model. Views update themselves via the onModelChange event when * the widgetModel set is processed. (This is important because undo/redo does NOT call this function). * * @param updatedProperties New set of properties to update the widget with * @param options Update options: */ updateVisProperties: function updateVisProperties(updatedProperties) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var extendedOptions = _.extend({}, options, this.boardModel.getLanguageModelOptions(true)); // Update the properties on the vismodel this.model.properties.set(updatedProperties, _.extend({ merge: true, remove: false }, extendedOptions)); }, _getInteractionConfig: function _getInteractionConfig() { return this.dashboardApi.getAppConfig('interactions') || {}; }, /** * Check whether a particular interaction is enabled. * Perspective drives this config. * * @param {string} name - interaction name * * @return {boolean} TRUE if interaction is enabled and FALSE if not */ _isInteractionEnabled: function _isInteractionEnabled(name) { var config = this._getInteractionConfig(); if (config.hasOwnProperty(name) && [false, 'false'].indexOf(config[name]) !== -1) { return false; } return true; }, doesWidgetSupportContextualGrid: function doesWidgetSupportContextualGrid() { var visualization = this._currVis; if (!visualization) { return false; } else if (visualization.doesVisPropertyMatchExpected('isMultilayersWidget', true)) { return false; } else if (visualization.doesVisPropertyMatchExpected('noDataQuery', true)) { return false; } return true; }, suppressAnimations: function suppressAnimations(suppress) { if (this.visModelManager) { this.visModelManager.setSuppressViewAnimations(suppress); } }, _getRefreshValueInUnits: function _getRefreshValueInUnits(value, timeUnit) { var maxIntervalForUnits = this._getMaxRefreshValuesForUnits(timeUnit); return Math.min(maxIntervalForUnits, value); }, onPropertyUpdate: function onPropertyUpdate(info) { DeprecateWidgetBase.inherited('onPropertyUpdate', this, arguments); if (info.category === 'queryRefresh' && info.item) { var value = info.item.value ? this._getRefreshValueInUnits(info.item.value, info.item.unit) : null; this.model.set({ 'queryRefresh': $.extend(info.item, { value: value }) }); } }, validateInput: function validateInput(options) { var interval = options.value; var isValid = interval && $.isNumeric(interval); if (isValid) { interval = Math.ceil(interval); isValid = this._getTimeIntervalInSeconds(interval, options.unit) >= 5; } return isValid; }, /** * @param timeUnit - 'seconds', 'minutes', 'hours' * @returns max seconds for the specified timeUnit * */ _getMaxRefreshValuesForUnits: function _getMaxRefreshValuesForUnits(timeUnit) { /* * The browser method used to provide a timed delay between refresh calls has * a max size of a signed integer. We must ensure we stay below this number * depending on the time unit */ var maxIntervalInSeconds = (Math.pow(2, 31) - 1) / 1000; var maxForTimeUnit; var maxTime; switch (timeUnit) { case 'minutes': maxForTimeUnit = maxIntervalInSeconds / 60; maxTime = Math.ceil(maxForTimeUnit - 1); break; case 'hours': maxForTimeUnit = maxIntervalInSeconds / 3600; maxTime = Math.ceil(maxForTimeUnit - 1); break; default: // includes seconds maxTime = Math.ceil(maxIntervalInSeconds - 1); } return maxTime; }, _getTimeIntervalInSeconds: function _getTimeIntervalInSeconds(timeIntervalInSeconds, timeUnit) { var result = null; if ($.isNumeric(timeIntervalInSeconds)) { // Need to guard against setting out of bound values for different units. var maxIntervalInSeconds = this._getMaxRefreshValuesForUnits(timeUnit); switch (timeUnit) { case 'minutes': result = Math.min(maxIntervalInSeconds, timeIntervalInSeconds *= 60); break; case 'hours': result = Math.min(maxIntervalInSeconds, timeIntervalInSeconds *= 3600); break; default: // includes seconds result = Math.min(maxIntervalInSeconds, timeIntervalInSeconds); } } return result; }, registerRefreshTimer: function registerRefreshTimer() { this.clearRefreshTimer(); var queryRefreshInfo = this.get('queryRefresh'); if (queryRefreshInfo) { this._startRefreshTimer(queryRefreshInfo); this.trigger('dwChange:refreshTimerIndicator', { autoRefresh: queryRefreshInfo.autoRefresh }); } }, _startRefreshTimer: function _startRefreshTimer(queryRefreshInfo) { if (!queryRefreshInfo || !queryRefreshInfo.autoRefresh || !queryRefreshInfo.value) { return; } this.visibilityHandler = function () { if (this._isDashboardActive === true) { if (document.hidden || !document.visibilityState) { this._isTimerActive = false; } else { this._isTimerActive = true; } } }.bind(this); this._isTimerActive = true; this._queryRefreshFinished = true; this._setLastRefreshedTime(); this._refreshTimer = setInterval(function () { if (this._isTimerActive && this._queryRefreshFinished) { $(document).on('visibilitychange', this.visibilityHandler); this._autoRefresh(); } }.bind(this), this._getTimeIntervalInSeconds(queryRefreshInfo.value, queryRefreshInfo.unit) * 1000); }, _autoRefresh: function _autoRefresh() { if (!this.visAPI) { return; } this._queryRefreshFinished = false; if (this._currVis) { this._currVis.animationType = this._currVis.ANIMATION_TYPES.TRANSITION; } return this.reRender( /*extraInfo*/{ sender: 'realtimeRefresh', queryRefresh: this.model.queryRefresh }).then(function () { this._queryRefreshFinished = true; this._setLastRefreshedTime(); }.bind(this), function (e) { // If error details is turned on, then don't let the timer continue. This is so for long running // load tests the first error to occure will stay on the widget if (!window.dashboardErrorDetailsEnabled) { this._queryRefreshFinished = true; } throw e; }.bind(this)); }, _setLastRefreshedTime: function _setLastRefreshedTime() { this.model.set({ 'queryRefresh': $.extend(this.get('queryRefresh'), { lastRefreshed: new Date().getTime() }) }, { silent: true }); }, clearRefreshTimer: function clearRefreshTimer() { if (this._refreshTimer) { clearInterval(this._refreshTimer); this._refreshTimer = null; if (this.visibilityHandler) { $(document).off('visibilitychange', this.visibilityHandler); this.visibilityHandler = null; } } }, /** * Abstract function. The implementation should be in subclasses. */ _rebuildVis: function _rebuildVis() /* widget, undoRedo, forceRerender */{}, /** * @deprecated should be removed once we no longer use old query api * Save the prompt spec with picked values to widget. */ savePromptSpec: function savePromptSpec(promptSpec) { var oSavedPrompts = this.get('savedPrompts') || {}; oSavedPrompts[promptSpec.name] = promptSpec; this.model.set({ 'savedPrompts': oSavedPrompts }); this._updateFilterIndicator(); }, /** * @deprecated should be removed once we no longer use old query api */ getSavedPrompts: function getSavedPrompts() { return this.get('savedPrompts') || {}; }, /** * @deprecated should be removed once we no longer use old query api */ setPromptSpecs: function setPromptSpecs(promptSpecs) { this.model.set({ 'savedPrompts': promptSpecs }); this._updateFilterIndicator(); }, /** * @deprecated should be removed once we no longer use old query api */ _updateFilterIndicator: function _updateFilterIndicator() { if (this._currVis && this._currVis.filterIndicator) { this._currVis.filterIndicator.update(); } }, /** * @deprecated should be removed once we no longer use old query api */ getPromptSpec: function getPromptSpec(promptName) { var oSavedPrompts = this.get('savedPrompts'); if (!promptName) { return oSavedPrompts; } return oSavedPrompts ? oSavedPrompts[promptName] : null; }, /** * TODO remove method and all calls to is once new queryApi goes live */ useNewQueryApi: function useNewQueryApi() { if (this._useNewQueryApi !== undefined) { return this._useNewQueryApi; } if (['kpi', 'summary', 'crosstab', 'JQGrid'].indexOf(this.visAPI.getDefinition().id) !== -1) { return true; } return !this.dashboardApi.getGlassCoreSvc('.FeatureChecker').checkValue('dashboard', 'queryApi', 'disabled'); }, rePrompt: function rePrompt(sPromptName) { var _this3 = this; if (!sPromptName) { this.logger.error('Could not find prompt info to rePrompt', sPromptName, this); return Promise.resolve(); } var savedPromptSpec = this.getPromptSpec(sPromptName); if (!savedPromptSpec) { this.logger.error('Could not find prompt info for ' + sPromptName, this); return Promise.resolve(); } // TODO remove _useAPI logic once licve if (this.useNewQueryApi()) { var openSpec = _.extend({}, savedPromptSpec); openSpec.rePrompt = true; var prompts = this.dashboardApi.getFeature('Prompts'); var visualization = this.dashboardApi.getCanvas().getContent(this.getId()).getFeature('Visualization.internal'); var savedPrompts = visualization.getSavedPrompts(); return prompts.openPromptView([openSpec], visualization).then(function (oNewPromptSpec) { savedPrompts.save(oNewPromptSpec[0]); }); } else { var oOptions = { promptSpec: [savedPromptSpec], id: this.visModelManager.getModuleId(), 'preferences': this.dashboardApi.getGlassCoreSvc('.UserProfile').preferences }; _.extend(oOptions, this.visAPI.getQueryExecution().getPromptQueries()); return PromptManager.openPromptView(oOptions).then(function (oNewPromptSpec) { _this3.savePromptSpec(oNewPromptSpec[0]); _this3.reRender(); }); } }, /** * @public * Handle the event when a prompt dialog is canceled, i.e. the prompt parameter is not resolved. * The intend is to: * 1. remove the widget if the metadata item referencing a prompt is the one dropped to the widget. * 2. remove the slot with the metadata item referencing a prompt. */ onCancelPromptDialog: function onCancelPromptDialog() { if (this.isAuthoringMode) { this.dashboardApi.undo(); } }, onUnSupportedPrompt: function onUnSupportedPrompt(message) { DynamicFileLoader.load(['dashboard-analytics/lib/@waca/core-client/js/core-client/ui/dialogs/ConfirmationDialog']).then(function (modules) { var dlg = new modules[0]('warning', '', message); dlg.confirm(function () { this.onCancelPromptDialog(); }.bind(this)); dlg._cancelCallback = function () { this.onCancelPromptDialog(); }.bind(this); }.bind(this)); } }); return DeprecateWidgetBase; }); //# sourceMappingURL=DeprecateWidgetBase.js.map