UserFederationLdapWizard.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. import {
  2. Button,
  3. Wizard,
  4. WizardContextConsumer,
  5. WizardFooter
  6. } from "../_snowpack/pkg/@patternfly/react-core.js";
  7. import React from "../_snowpack/pkg/react.js";
  8. import {LdapSettingsGeneral} from "./ldap/LdapSettingsGeneral.js";
  9. import {LdapSettingsConnection} from "./ldap/LdapSettingsConnection.js";
  10. import {LdapSettingsSearching} from "./ldap/LdapSettingsSearching.js";
  11. import {LdapSettingsSynchronization} from "./ldap/LdapSettingsSynchronization.js";
  12. import {LdapSettingsKerberosIntegration} from "./ldap/LdapSettingsKerberosIntegration.js";
  13. import {SettingsCache} from "./shared/SettingsCache.js";
  14. import {LdapSettingsAdvanced} from "./ldap/LdapSettingsAdvanced.js";
  15. import {useTranslation} from "../_snowpack/pkg/react-i18next.js";
  16. import {useForm} from "../_snowpack/pkg/react-hook-form.js";
  17. export const UserFederationLdapWizard = () => {
  18. const form = useForm();
  19. const {t} = useTranslation("user-federation");
  20. const steps = [
  21. {
  22. name: t("requiredSettings"),
  23. id: "ldapRequiredSettingsStep",
  24. component: /* @__PURE__ */ React.createElement(LdapSettingsGeneral, {
  25. form,
  26. showSectionHeading: true,
  27. showSectionDescription: true
  28. })
  29. },
  30. {
  31. name: t("connectionAndAuthenticationSettings"),
  32. id: "ldapConnectionSettingsStep",
  33. component: /* @__PURE__ */ React.createElement(LdapSettingsConnection, {
  34. form,
  35. showSectionHeading: true,
  36. showSectionDescription: true
  37. })
  38. },
  39. {
  40. name: t("ldapSearchingAndUpdatingSettings"),
  41. id: "ldapSearchingSettingsStep",
  42. component: /* @__PURE__ */ React.createElement(LdapSettingsSearching, {
  43. form,
  44. showSectionHeading: true,
  45. showSectionDescription: true
  46. })
  47. },
  48. {
  49. name: t("synchronizationSettings"),
  50. id: "ldapSynchronizationSettingsStep",
  51. component: /* @__PURE__ */ React.createElement(LdapSettingsSynchronization, {
  52. form,
  53. showSectionHeading: true,
  54. showSectionDescription: true
  55. })
  56. },
  57. {
  58. name: t("kerberosIntegration"),
  59. id: "ldapKerberosIntegrationSettingsStep",
  60. component: /* @__PURE__ */ React.createElement(LdapSettingsKerberosIntegration, {
  61. form,
  62. showSectionHeading: true,
  63. showSectionDescription: true
  64. })
  65. },
  66. {
  67. name: t("cacheSettings"),
  68. id: "ldapCacheSettingsStep",
  69. component: /* @__PURE__ */ React.createElement(SettingsCache, {
  70. form,
  71. showSectionHeading: true,
  72. showSectionDescription: true
  73. })
  74. },
  75. {
  76. name: t("advancedSettings"),
  77. id: "ldapAdvancedSettingsStep",
  78. component: /* @__PURE__ */ React.createElement(LdapSettingsAdvanced, {
  79. form,
  80. showSectionHeading: true,
  81. showSectionDescription: true
  82. })
  83. }
  84. ];
  85. const footer = /* @__PURE__ */ React.createElement(WizardFooter, null, /* @__PURE__ */ React.createElement(WizardContextConsumer, null, ({activeStep, onNext, onBack, onClose}) => {
  86. if (activeStep.id === "ldapRequiredSettingsStep") {
  87. return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Button, {
  88. variant: "primary",
  89. type: "submit",
  90. onClick: onNext
  91. }, t("common:next")), /* @__PURE__ */ React.createElement(Button, {
  92. variant: "secondary",
  93. onClick: onBack,
  94. className: "pf-m-disabled"
  95. }, t("common:back")), /* @__PURE__ */ React.createElement(Button, {
  96. variant: "link",
  97. onClick: onClose
  98. }, t("common:cancel")));
  99. } else if (activeStep.id === "ldapConnectionSettingsStep" || activeStep.id === "ldapSearchingSettingsStep") {
  100. return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Button, {
  101. variant: "primary",
  102. type: "submit",
  103. onClick: onNext
  104. }, t("common:next")), /* @__PURE__ */ React.createElement(Button, {
  105. variant: "secondary",
  106. onClick: onBack
  107. }, t("common:back")), /* @__PURE__ */ React.createElement(Button, {
  108. variant: "link",
  109. onClick: onClose
  110. }, t("common:cancel")));
  111. } else if (activeStep.id === "ldapAdvancedSettingsStep") {
  112. return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Button, null, t("common:finish")), /* @__PURE__ */ React.createElement(Button, {
  113. variant: "secondary",
  114. onClick: onBack
  115. }, t("common:back")), /* @__PURE__ */ React.createElement(Button, {
  116. variant: "link",
  117. onClick: onClose
  118. }, t("common:cancel")));
  119. }
  120. return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Button, {
  121. onClick: onNext
  122. }, "Next"), /* @__PURE__ */ React.createElement(Button, {
  123. variant: "secondary",
  124. onClick: onBack
  125. }, "Back"), /* @__PURE__ */ React.createElement(Button, {
  126. variant: "link"
  127. }, t("common:skipCustomizationAndFinish")), /* @__PURE__ */ React.createElement(Button, {
  128. variant: "link",
  129. onClick: onClose
  130. }, t("common:cancel")));
  131. }));
  132. return /* @__PURE__ */ React.createElement(Wizard, {
  133. height: "100%",
  134. steps,
  135. footer
  136. });
  137. };