RoutingRulesService.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. "use strict";
  2. /**
  3. * Licensed Materials - Property of IBM
  4. * IBM Cognos Products: Cognos Analytics
  5. * Copyright IBM Corp. 2018
  6. * US Government Users Restricted Rights - Use, duplication or disclosure
  7. * restricted by GSA ADP Schedule Contract with IBM Corp.
  8. */
  9. define(['underscore', 'bi/commons/ui/core/Class', 'bi/admin/common/utils/AJAXUtils'], function (_, Class, AJAXUtils) {
  10. var RoutingRulesService = Class.extend({
  11. init: function init(options) {
  12. RoutingRulesService.inherited('init', this, arguments);
  13. _.extend(this, options);
  14. },
  15. getRouting: function getRouting(routingType) {
  16. var ajaxURL = AJAXUtils.getPath(routingType);
  17. var options = {
  18. method: 'GET',
  19. url: ajaxURL
  20. };
  21. return this.glassContext.getCoreSvc('.Ajax').ajax(options).then(function (response) {
  22. return response;
  23. }.bind(this));
  24. },
  25. getAdminFolder: function getAdminFolder() {
  26. var ajaxURL = encodeURI('v1/search/cm?filter=type|directory&hide_internal=none');
  27. var options = {
  28. method: 'GET',
  29. url: ajaxURL
  30. };
  31. return this.glassContext.getCoreSvc('.Ajax').ajax(options);
  32. }
  33. });
  34. return RoutingRulesService;
  35. });