ServiceabilityDataInfo.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. 'use strict';
  2. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3. /**
  4. * Licensed Materials - Property of IBM
  5. * IBM Business Analytics (C) Copyright IBM Corp. 2019
  6. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. */
  8. define(['./nls/StringResources', './ServiceabilityDataMapping', './ServiceabilityDataSource'], function (ServiceabilityStringResources, ServiceabilityDataMapping, ServiceabilityDataSource) {
  9. var ServiceabilityDataInfo = function () {
  10. function ServiceabilityDataInfo(visualizationAPI) {
  11. _classCallCheck(this, ServiceabilityDataInfo);
  12. this._visualizationAPI = visualizationAPI;
  13. this._serviceabilityDataMapping = new ServiceabilityDataMapping(this._visualizationAPI);
  14. this._serviceabilityDataSource = new ServiceabilityDataSource(this._visualizationAPI);
  15. }
  16. /**
  17. * @returns {object} The result of this result should be an object which will
  18. * be stringfied later.
  19. * @description this method will fetch the data info of a live widget
  20. * through the APIs.
  21. */
  22. ServiceabilityDataInfo.prototype.toJSON = function toJSON() {
  23. return {
  24. ServiceabilityDataInfo: {
  25. ServiceabilityDataMapping: this._serviceabilityDataMapping.toJSON(),
  26. ServiceabilityDataSource: this._serviceabilityDataSource.toJSON()
  27. }
  28. };
  29. };
  30. /**
  31. * @description this method will fetch the data mapping info and construct a UI spec which defined
  32. * how the Data Mapping section will be displayed
  33. * @returns {object} The UI spec which will be consumed by ContentInfoAPI
  34. */
  35. ServiceabilityDataInfo.prototype.toUIJSON = function toUIJSON() {
  36. return [{
  37. sectionName: ServiceabilityStringResources.get('dataSource'),
  38. sectionValues: [].concat(this._serviceabilityDataSource.toUIJSON(), this._serviceabilityDataMapping.toUIJSON()),
  39. properties: {
  40. open: false
  41. }
  42. }];
  43. };
  44. return ServiceabilityDataInfo;
  45. }();
  46. return ServiceabilityDataInfo;
  47. });
  48. //# sourceMappingURL=ServiceabilityDataInfo.js.map