VisFPDExecution.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. 'use strict';
  2. /**
  3. * Licensed Materials - Property of IBM
  4. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2018, 2019
  5. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  6. *
  7. * VisFPDExecution
  8. * The VisFPDExecution object manages a set of queries that are needed to provide the data for a predict visualization.
  9. */
  10. define(['./VisQueryExecution', '../../../widgets/livewidget/nls/StringResources'], function (VisQueryExecution, StringResources) {
  11. 'use strict';
  12. var VisFPDExecution = VisQueryExecution.extend({
  13. init: function init(options) {
  14. VisFPDExecution.inherited('init', this, arguments);
  15. this._keyDriverManager = options.keyDriverManager;
  16. },
  17. /**
  18. * Ensure that the slots are up-to-date and prepare the data (if necessary).
  19. * @param localFiltersOnly (optional) if set, only local filters will be passed to the queryDefinition. If not set, both local and cross-widget filters are passed.
  20. * @returns a promise.
  21. */
  22. execute: function execute(queryContext) {
  23. var promptControlFunctions = void 0;
  24. if (queryContext && queryContext.promptControlFunctions) {
  25. promptControlFunctions = queryContext.promptControlFunctions;
  26. } else {
  27. var sourceId = this.ownerWidget.content.getFeature('Visualization').getDataSource().getId();
  28. promptControlFunctions = {
  29. 'preparePromptSpec': this.preparePromptSpec.bind(this),
  30. 'whenSingleItemQueryReady': this._commonQueryHelper.whenSingleItemQueryReady.bind(this._commonQueryHelper, sourceId),
  31. 'whenColumnsMinMaxQueryReady': this._commonQueryHelper.whenColumnsMinMaxQueryReady.bind(this._commonQueryHelper, sourceId),
  32. 'getPromptSpec': this.getPromptSpec.bind(this),
  33. 'savePromptSpec': this.savePromptSpec.bind(this),
  34. 'updatePromptSpecCache': this.updatePromptSpecCache.bind(this),
  35. 'onCancelPromptDialog': this.onCancelPromptDialog.bind(this),
  36. 'onUnSupportedPromptType': this.ownerWidget.onUnSupportedPrompt.bind(this, StringResources.get('unSupportedPromptType'))
  37. };
  38. }
  39. return this._keyDriverManager.executeFastPatternDetectionRequest(queryContext.targetId, queryContext.possibleKeyDrivers, queryContext.methods, promptControlFunctions, this.ownerWidget.isPreview);
  40. }
  41. });
  42. return VisFPDExecution;
  43. });
  44. //# sourceMappingURL=VisFPDExecution.js.map