App.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  2. /*
  3. * Copyright 2018 Red Hat, Inc. and/or its affiliates.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. import * as React from "../../common/keycloak/web_modules/react.js";
  18. import { PageNav } from "./PageNav.js";
  19. import { PageToolbar } from "./PageToolbar.js";
  20. import { makeRoutes } from "./ContentPages.js";
  21. import { Brand, Page, PageHeader, PageSection, PageSidebar } from "../../common/keycloak/web_modules/@patternfly/react-core.js";
  22. import { KeycloakContext } from "./keycloak-service/KeycloakContext.js";
  23. ;
  24. export class App extends React.Component {
  25. constructor(props, context) {
  26. super(props);
  27. _defineProperty(this, "context", void 0);
  28. this.context = context;
  29. toggleReact();
  30. }
  31. render() {
  32. toggleReact(); // check login
  33. if (!this.context.authenticated() && !isWelcomePage()) {
  34. this.context.login();
  35. }
  36. const username = React.createElement("span", {
  37. style: {
  38. marginLeft: '10px'
  39. },
  40. id: "loggedInUser"
  41. }, loggedInUserName());
  42. const Header = React.createElement(PageHeader, {
  43. logo: React.createElement("a", {
  44. id: "brandLink",
  45. href: brandUrl
  46. }, React.createElement(Brand, {
  47. src: brandImg,
  48. alt: "Logo",
  49. className: "brand"
  50. })),
  51. toolbar: React.createElement(PageToolbar, null),
  52. avatar: username,
  53. showNavToggle: true
  54. });
  55. const Sidebar = React.createElement(PageSidebar, {
  56. nav: React.createElement(PageNav, null)
  57. });
  58. return React.createElement("span", {
  59. style: {
  60. height: '100%'
  61. }
  62. }, React.createElement(Page, {
  63. header: Header,
  64. sidebar: Sidebar,
  65. isManagedSidebar: true
  66. }, React.createElement(PageSection, null, makeRoutes())));
  67. }
  68. }
  69. _defineProperty(App, "contextType", KeycloakContext);
  70. ;
  71. //# sourceMappingURL=App.js.map