AppInitiatedActionPage.js 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 2019 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 { withRouter } from "../../../../common/keycloak/web_modules/react-router-dom.js";
  19. import { AIACommand } from "../../util/AIACommand.js";
  20. import { Msg } from "../../widgets/Msg.js";
  21. import { Title, TitleLevel, Button, EmptyState, EmptyStateVariant, EmptyStateIcon, EmptyStateBody } from "../../../../common/keycloak/web_modules/@patternfly/react-core.js";
  22. import { PassportIcon } from "../../../../common/keycloak/web_modules/@patternfly/react-icons.js";
  23. import { KeycloakContext } from "../../keycloak-service/KeycloakContext.js"; // Note: This class demonstrates two features of the ContentPages framework:
  24. // 1) The PageDef is available as a React property.
  25. // 2) You can add additional custom properties to the PageDef. In this case,
  26. // we add a value called kcAction in content.js and access it by extending the
  27. // PageDef interface.
  28. /**
  29. * @author Stan Silvert
  30. */
  31. class ApplicationInitiatedActionPage extends React.Component {
  32. constructor(props) {
  33. super(props);
  34. _defineProperty(this, "handleClick", keycloak => {
  35. new AIACommand(keycloak, this.props.pageDef.kcAction).execute();
  36. });
  37. }
  38. render() {
  39. return React.createElement(EmptyState, {
  40. variant: EmptyStateVariant.full
  41. }, React.createElement(EmptyStateIcon, {
  42. icon: PassportIcon
  43. }), React.createElement(Title, {
  44. headingLevel: TitleLevel.h5,
  45. size: "lg"
  46. }, React.createElement(Msg, {
  47. msgKey: this.props.pageDef.label,
  48. params: this.props.pageDef.labelParams
  49. })), React.createElement(EmptyStateBody, null, React.createElement(Msg, {
  50. msgKey: "actionRequiresIDP"
  51. })), React.createElement(KeycloakContext.Consumer, null, keycloak => React.createElement(Button, {
  52. variant: "primary",
  53. onClick: () => this.handleClick(keycloak),
  54. target: "_blank"
  55. }, React.createElement(Msg, {
  56. msgKey: "continue"
  57. }))));
  58. }
  59. }
  60. ; // Note that the class name is not exported above. To get access to the router,
  61. // we use withRouter() and export a different name.
  62. export const AppInitiatedActionPage = withRouter(ApplicationInitiatedActionPage);
  63. //# sourceMappingURL=AppInitiatedActionPage.js.map