RoutingRulesPane.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. "use strict";
  2. /**
  3. * Licensed Materials - Property of IBM
  4. *
  5. * IBM Cognos Products: ADMIN
  6. *
  7. * Copyright IBM Corp. 2018
  8. *
  9. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  10. */
  11. define(['react', 'react-dom', 'jquery', 'underscore', 'bi/glass/app/ContentView', 'bi/admin/status/slideout/ActivitiesPane', 'bi/admin/nls/StringResource', 'ba-react-admin/ba-react-admin.min', 'bi/admin/routingrules/services/RoutingRulesService', 'bi/admin/common/utils/AJAXUtils', 'require-css!bi/content_apps/lib/@waca/bacontentnav/public/css/bacontentnav/bacontentnav'], function (React, ReactDOM, $, _, ContentView, ActivitiesPane, StringResource, AdminReact, RoutingRulesService, AJAXUtils) {
  12. var view = ContentView.extend({
  13. init: function init(options) {
  14. view.inherited('init', this, arguments);
  15. _.extend(this, options);
  16. this.routingRulesService = new RoutingRulesService(options);
  17. },
  18. getTitle: function getTitle() {
  19. return StringResource.get("routingRulesTitle");
  20. },
  21. getIcon: function getIcon() {
  22. return 'child-relationship_32';
  23. },
  24. /* Add this this temporarily
  25. * Current API is to return the routing rules table and the routing hints in the same server call.
  26. * We may need to make to server calls to get the routing table separately from the routing hints
  27. * to better manage client load time if it becomes a problem.
  28. * delete this code if this does not turn out to be needed.
  29. */
  30. setFocus: function setFocus() {},
  31. render: function render() {
  32. return this.routingRulesService.getRouting('routingRules').then(function (response) {
  33. this.routingRulesTable = response.data[0].routingTable;
  34. this.routingHints = response.data[1].routingHints;
  35. ReactDOM.unmountComponentAtNode(this.$el[0]);
  36. ReactDOM.render(React.createElement(AdminReact.RoutingRulesView, {
  37. StringResource: StringResource,
  38. routingRules: this.routingRulesTable,
  39. routingHints: this.routingHints,
  40. glassContext: this.glassContext,
  41. AJAXUtils: AJAXUtils //routingRulesService: this.routingRulesService
  42. }), this.$el[0]);
  43. return Promise.resolve();
  44. }.bind(this));
  45. },
  46. remove: function remove() {
  47. view.inherited('remove', this, arguments);
  48. ReactDOM.unmountComponentAtNode(this.$el[0]);
  49. }
  50. });
  51. return view;
  52. });