BaseTask.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. 'use strict';
  2. /*
  3. *+------------------------------------------------------------------------+
  4. *| Licensed Materials - Property of IBM
  5. *| IBM Cognos Products: Dashboard
  6. *| (C) Copyright IBM Corp. 2018
  7. *|
  8. *| US Government Users Restricted Rights - Use, duplication or disclosure
  9. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  10. *+------------------------------------------------------------------------+
  11. */
  12. define(['../../../lib/@waca/core-client/js/core-client/ui/core/Class'], function (Class) {
  13. 'use strict';
  14. var BaseTask = Class.extend({
  15. init: function init(options) {
  16. BaseTask.inherited('init', this, arguments);
  17. this.id = options.id;
  18. this.owner = options.owner;
  19. this.ownerWidget = options.ownerWidget;
  20. this.logger = options.logger;
  21. this.visAPI = options.visAPI;
  22. this.dashboardApi = options.dashboardApi;
  23. this.content = options.content;
  24. this._initializeStep = this.owner._initializeStep.bind(this.owner);
  25. this._isStepComplete = this.owner._isStepComplete.bind(this.owner);
  26. this._completeStep = this.owner._completeStep.bind(this.owner);
  27. this._logRenderContext = this.owner._logRenderContext.bind(this.owner);
  28. if (this.id) {
  29. this._initializeStep(this.id);
  30. }
  31. },
  32. getId: function getId() {
  33. return this.id;
  34. },
  35. getRenderState: function getRenderState() {
  36. return this.owner._renderState;
  37. },
  38. clearError: function clearError() {
  39. var state = this.content.getFeature('state.internal');
  40. if (state) {
  41. state.clearError();
  42. }
  43. },
  44. /**
  45. * does nothing: the error is shown in VisRenderSequence
  46. */
  47. showError: function showError() {},
  48. /**
  49. * Process the task
  50. * @param renderContext - the render context
  51. * @returns a promise
  52. */
  53. process: function process() /*renderContext*/{
  54. return Promise.reject(new Error('BaseTask.process needs to be overridden!'));
  55. }
  56. });
  57. return BaseTask;
  58. });
  59. //# sourceMappingURL=BaseTask.js.map