AdminConsolePane.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. "use strict";
  2. /**
  3. * Licensed Materials - Property of IBM
  4. * IBM Cognos Products: admin
  5. * Copyright IBM Corp. 2015, 2017
  6. * US Government Users Restricted Rights -
  7. * Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  8. */
  9. define(['react', 'react-dom', 'ba-react-admin/ba-react-admin.min', 'bi/admin/common/slideout/BasePane', 'jquery', 'bi/admin/datasource/App', 'bi/admin/nls/StringResource', 'bi/commons/utils/Utils', 'bi/admin/common/utils/CapabilityHelper'], function (React, ReactDOM, AdminReact, BasePane, $, App, StringResource, Utils, CapabilityHelper) {
  10. /**
  11. * Sample content view that extends the glass AdminPane class
  12. *
  13. */
  14. var AdminConsolePane = BasePane.extend({
  15. init: function init(options) {
  16. AdminConsolePane.inherited('init', this, arguments);
  17. $.extend(this, options);
  18. App.glassContext = this.glassContext;
  19. CapabilityHelper.glassContext = this.glassContext;
  20. },
  21. _getViewWidth: function _getViewWidth(wide) {
  22. var width = 450;
  23. if (wide) {
  24. width = $(window).width() < 1370 ? 576 : 900;
  25. }
  26. return width;
  27. },
  28. setFocus: function setFocus() {
  29. this.$el.find('.list-item').filter(':visible:first').focus();
  30. },
  31. _createReactChild: function _createReactChild(rEl, props, children) {
  32. return React.createElement(rEl, props, children);
  33. },
  34. _renderReact: function _renderReact(element, root) {
  35. ReactDOM.render(element, root);
  36. },
  37. renderBody: function renderBody($body) {
  38. //NOSONAR
  39. $body.addClass("bi-admin-entrance-pane");
  40. var adminConPane = React.createElement(AdminReact.AdminConsolePanel, {
  41. glassContext: this.glassContext,
  42. StringResource: StringResource,
  43. parent: this
  44. });
  45. ReactDOM.render(adminConPane, $body[0]);
  46. return Promise.resolve();
  47. }
  48. });
  49. return AdminConsolePane;
  50. });