Dashboard.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. 'use strict';
  2. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5. /**
  6. * Licensed Materials - Property of IBM
  7. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2018, 2020
  8. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  9. */
  10. define(['../../lib/@waca/dashboard-common/dist/core/APIFactory', '../../dashboard/api/controllers/DashboardController', '../DashboardAPI', '../../features/dashboard/internalAPI/api/InternalAPI', '../../features/dashboard/internalAPI/api/impl/Internal', '../../features/dashboard/internalAPI/api/deprecated/InternalAPI'], function (APIFactory, Controller, DashboardAPI, InternalAPI, InternalImpl, InternalDeprecatedAPI) {
  11. var DashboardAPIImpl = function (_Controller) {
  12. _inherits(DashboardAPIImpl, _Controller);
  13. function DashboardAPIImpl(options) {
  14. _classCallCheck(this, DashboardAPIImpl);
  15. var _this = _possibleConstructorReturn(this, _Controller.call(this, options));
  16. _this.getType = _this.getApplicationName.bind(_this);
  17. _this.getName = _this.getApplicationLabel.bind(_this);
  18. _this.getService = _this.getGlassCoreSvc.bind(_this);
  19. _this.getServiceWhenReady = _this.getGlassSvc.bind(_this);
  20. _this.getPluginExtension = _this.findGlassPlugin.bind(_this);
  21. _this.getCollectionExtension = _this.findGlassCollection.bind(_this);
  22. _this.getConfiguration = _this.getAppConfig.bind(_this);
  23. _this.openApplication = _this.openGlassApplication.bind(_this);
  24. _this.closeApplication = _this.closeGlassApplication.bind(_this);
  25. _this.internalImpl = new InternalImpl(options);
  26. return _this;
  27. }
  28. DashboardAPIImpl.prototype.destroy = function destroy() {
  29. _Controller.prototype.destroy.call(this);
  30. this.internalImpl.destroy();
  31. };
  32. DashboardAPIImpl.prototype.getAPI = function getAPI() {
  33. return APIFactory.createAPI(this, [DashboardAPI, InternalAPI]);
  34. };
  35. DashboardAPIImpl.prototype.getInternalAPI = function getInternalAPI() {
  36. return APIFactory.createAPIFromSpec([{
  37. implementation: this,
  38. interface: InternalAPI
  39. }, {
  40. implementation: this.internalImpl,
  41. interface: InternalDeprecatedAPI
  42. }]);
  43. };
  44. DashboardAPIImpl.prototype.getCanvas = function getCanvas() {
  45. if (this.view) {
  46. return this.view.getDeprecatedCanvas();
  47. }
  48. };
  49. DashboardAPIImpl.prototype.getCanvasWhenReady = function getCanvasWhenReady() {
  50. return this.view.getDeprecatedCanvasWhenReady();
  51. };
  52. DashboardAPIImpl.prototype.getDataSourceList = function getDataSourceList() {
  53. return Promise.resolve(this.getFeature('DataSources').getDataSourceList());
  54. };
  55. DashboardAPIImpl.prototype.getSources = function getSources() {
  56. return this.getFeature('DataSources').getSourcesInfo();
  57. };
  58. DashboardAPIImpl.prototype.addSources = function addSources(sources, options) {
  59. return this.getFeature('DataSources').addDataSources(sources, options);
  60. };
  61. DashboardAPIImpl.prototype.getActiveDataSourceId = function getActiveDataSourceId() {
  62. return this.getFeature('DataSources').getActiveDataSourceId();
  63. };
  64. DashboardAPIImpl.prototype.setActiveDataSourceId = function setActiveDataSourceId(activeDataSourceId) {
  65. this.getFeature('DataSources').setActiveDataSourceId(activeDataSourceId);
  66. };
  67. return DashboardAPIImpl;
  68. }(Controller);
  69. return DashboardAPIImpl;
  70. });
  71. //# sourceMappingURL=Dashboard.js.map