From 18173e397e568c701bcb3eaa804d234347eb4935 Mon Sep 17 00:00:00 2001 From: Viktor Fomin Date: Mon, 1 Aug 2022 00:29:17 +0300 Subject: [PATCH] Web: Client: SSO: refactoring --- .../integration/SingleSignOn/Certificates.js | 8 ++-- .../integration/SingleSignOn/FieldMapping.js | 30 ++++++++++----- .../integration/SingleSignOn/IdpSettings.js | 18 ++++----- .../sub-components/CheckboxSet.js | 31 ++++++++++++--- .../sub-components/MetadataUrlField.js | 4 +- .../sub-components/SimpleCheckbox.js | 38 ------------------- .../{SimpleComboBox.js => SsoComboBox.js} | 4 +- .../{SimpleFormField.js => SsoFormField.js} | 8 ++-- .../{SimpleTextInput.js => SsoTextInput.js} | 4 +- .../SingleSignOn/sub-components/UploadXML.js | 4 +- 10 files changed, 72 insertions(+), 77 deletions(-) delete mode 100644 web/ASC.Web.Client/src/components/pages/Settings/categories/integration/SingleSignOn/sub-components/SimpleCheckbox.js rename web/ASC.Web.Client/src/components/pages/Settings/categories/integration/SingleSignOn/sub-components/{SimpleComboBox.js => SsoComboBox.js} (94%) rename web/ASC.Web.Client/src/components/pages/Settings/categories/integration/SingleSignOn/sub-components/{SimpleFormField.js => SsoFormField.js} (84%) rename web/ASC.Web.Client/src/components/pages/Settings/categories/integration/SingleSignOn/sub-components/{SimpleTextInput.js => SsoTextInput.js} (94%) diff --git a/web/ASC.Web.Client/src/components/pages/Settings/categories/integration/SingleSignOn/Certificates.js b/web/ASC.Web.Client/src/components/pages/Settings/categories/integration/SingleSignOn/Certificates.js index 69832c8413..8f29d4a308 100644 --- a/web/ASC.Web.Client/src/components/pages/Settings/categories/integration/SingleSignOn/Certificates.js +++ b/web/ASC.Web.Client/src/components/pages/Settings/categories/integration/SingleSignOn/Certificates.js @@ -13,7 +13,7 @@ import CertificatesTable from "./sub-components/CertificatesTable"; import CheckboxSet from "./sub-components/CheckboxSet"; import HideButton from "./sub-components/HideButton"; import PropTypes from "prop-types"; -import SimpleComboBox from "./sub-components/SimpleComboBox"; +import SsoComboBox from "./sub-components/SsoComboBox"; import { decryptAlgorithmsOptions, verifyAlgorithmsOptions, @@ -121,7 +121,7 @@ const Certificates = (props) => { {provider === "IdentityProvider" && ( <> - { {provider === "ServiceProvider" && ( <> - { value={spEncryptAlgorithm} /> - { const { t } = useTranslation(["SingleSignOn", "Common"]); @@ -26,6 +26,9 @@ const FieldMapping = (props) => { locationErrorMessage, titleErrorMessage, phoneErrorMessage, + enableSso, + setCheckbox, + isLoadingXml, } = props; return ( @@ -47,7 +50,7 @@ const FieldMapping = (props) => { /> - { errorMessage={firstNameErrorMessage} /> - { errorMessage={lastNameErrorMessage} /> - { errorMessage={emailErrorMessage} /> - { errorMessage={locationErrorMessage} /> - { errorMessage={titleErrorMessage} /> - { place="top" tooltipContent={t("AdvancedSettingsTooltip")} > - @@ -134,6 +140,9 @@ export default inject(({ ssoStore }) => { locationErrorMessage, titleErrorMessage, phoneErrorMessage, + enableSso, + setCheckbox, + isLoadingXml, } = ssoStore; return { @@ -150,5 +159,8 @@ export default inject(({ ssoStore }) => { locationErrorMessage, titleErrorMessage, phoneErrorMessage, + enableSso, + setCheckbox, + isLoadingXml, }; })(observer(FieldMapping)); diff --git a/web/ASC.Web.Client/src/components/pages/Settings/categories/integration/SingleSignOn/IdpSettings.js b/web/ASC.Web.Client/src/components/pages/Settings/categories/integration/SingleSignOn/IdpSettings.js index cfc9e07e16..366cc40fd6 100644 --- a/web/ASC.Web.Client/src/components/pages/Settings/categories/integration/SingleSignOn/IdpSettings.js +++ b/web/ASC.Web.Client/src/components/pages/Settings/categories/integration/SingleSignOn/IdpSettings.js @@ -6,8 +6,8 @@ import Box from "@appserver/components/box"; import RadioButtonGroup from "@appserver/components/radio-button-group"; import Text from "@appserver/components/text"; -import SimpleComboBox from "./sub-components/SimpleComboBox"; -import SimpleFormField from "./sub-components/SimpleFormField"; +import SsoComboBox from "./sub-components/SsoComboBox"; +import SsoFormField from "./sub-components/SsoFormField"; import UploadXML from "./sub-components/UploadXML"; import { bindingOptions, nameIdOptions } from "./sub-components/constants"; @@ -37,7 +37,7 @@ const IdpSettings = (props) => { - { errorMessage={spLoginLabelErrorMessage} /> - { errorMessage={entityIdErrorMessage} /> - { tabIndex={6} /> - + - { tabIndex={8} /> - + - { spSignLogoutRequests, spSignLogoutResponses, spEncryptAssertions, + enableSso, + setCheckbox, + isLoadingXml, } = props; return ( - { prefix === "idp" ? idpVerifyAuthResponsesSign : spSignAuthRequests } /> - { prefix === "idp" ? idpVerifyLogoutRequestsSign : spSignLogoutRequests } /> - { /> {prefix === "sp" && ( - { spSignLogoutRequests, spSignLogoutResponses, spEncryptAssertions, + enableSso, + setCheckbox, + isLoadingXml, } = ssoStore; return { @@ -98,5 +116,8 @@ export default inject(({ ssoStore }) => { spSignLogoutRequests, spSignLogoutResponses, spEncryptAssertions, + enableSso, + setCheckbox, + isLoadingXml, }; })(observer(CheckboxSet)); diff --git a/web/ASC.Web.Client/src/components/pages/Settings/categories/integration/SingleSignOn/sub-components/MetadataUrlField.js b/web/ASC.Web.Client/src/components/pages/Settings/categories/integration/SingleSignOn/sub-components/MetadataUrlField.js index 43d0eea24c..f0ffb93689 100644 --- a/web/ASC.Web.Client/src/components/pages/Settings/categories/integration/SingleSignOn/sub-components/MetadataUrlField.js +++ b/web/ASC.Web.Client/src/components/pages/Settings/categories/integration/SingleSignOn/sub-components/MetadataUrlField.js @@ -3,7 +3,7 @@ import { observer } from "mobx-react"; import FieldContainer from "@appserver/components/field-container"; -import SimpleTextInput from "./SimpleTextInput"; +import SsoTextInput from "./SsoTextInput"; const MetadataUrlField = ({ labelText, name, placeholder, tooltipContent }) => { return ( @@ -14,7 +14,7 @@ const MetadataUrlField = ({ labelText, name, placeholder, tooltipContent }) => { place="top" tooltipContent={tooltipContent} > - + ); }; diff --git a/web/ASC.Web.Client/src/components/pages/Settings/categories/integration/SingleSignOn/sub-components/SimpleCheckbox.js b/web/ASC.Web.Client/src/components/pages/Settings/categories/integration/SingleSignOn/sub-components/SimpleCheckbox.js deleted file mode 100644 index 3ddf79497f..0000000000 --- a/web/ASC.Web.Client/src/components/pages/Settings/categories/integration/SingleSignOn/sub-components/SimpleCheckbox.js +++ /dev/null @@ -1,38 +0,0 @@ -import React from "react"; -import { inject, observer } from "mobx-react"; - -import Checkbox from "@appserver/components/checkbox"; - -const SimpleCheckbox = (props) => { - const { - label, - name, - tabIndex, - isChecked, - enableSso, - setCheckbox, - isLoadingXml, - } = props; - - return ( - - ); -}; - -export default inject(({ ssoStore }) => { - const { enableSso, setCheckbox, isLoadingXml } = ssoStore; - - return { - enableSso, - setCheckbox, - isLoadingXml, - }; -})(observer(SimpleCheckbox)); diff --git a/web/ASC.Web.Client/src/components/pages/Settings/categories/integration/SingleSignOn/sub-components/SimpleComboBox.js b/web/ASC.Web.Client/src/components/pages/Settings/categories/integration/SingleSignOn/sub-components/SsoComboBox.js similarity index 94% rename from web/ASC.Web.Client/src/components/pages/Settings/categories/integration/SingleSignOn/sub-components/SimpleComboBox.js rename to web/ASC.Web.Client/src/components/pages/Settings/categories/integration/SingleSignOn/sub-components/SsoComboBox.js index d459057905..ce08aba674 100644 --- a/web/ASC.Web.Client/src/components/pages/Settings/categories/integration/SingleSignOn/sub-components/SimpleComboBox.js +++ b/web/ASC.Web.Client/src/components/pages/Settings/categories/integration/SingleSignOn/sub-components/SsoComboBox.js @@ -6,7 +6,7 @@ import FieldContainer from "@appserver/components/field-container"; import StyledInputWrapper from "../styled-containers/StyledInputWrapper"; -const SimpleComboBox = (props) => { +const SsoComboBox = (props) => { const { labelText, name, @@ -51,4 +51,4 @@ export default inject(({ ssoStore }) => { enableSso, isLoadingXml, }; -})(observer(SimpleComboBox)); +})(observer(SsoComboBox)); diff --git a/web/ASC.Web.Client/src/components/pages/Settings/categories/integration/SingleSignOn/sub-components/SimpleFormField.js b/web/ASC.Web.Client/src/components/pages/Settings/categories/integration/SingleSignOn/sub-components/SsoFormField.js similarity index 84% rename from web/ASC.Web.Client/src/components/pages/Settings/categories/integration/SingleSignOn/sub-components/SimpleFormField.js rename to web/ASC.Web.Client/src/components/pages/Settings/categories/integration/SingleSignOn/sub-components/SsoFormField.js index c7a92fe386..b54e1cb556 100644 --- a/web/ASC.Web.Client/src/components/pages/Settings/categories/integration/SingleSignOn/sub-components/SimpleFormField.js +++ b/web/ASC.Web.Client/src/components/pages/Settings/categories/integration/SingleSignOn/sub-components/SsoFormField.js @@ -4,9 +4,9 @@ import { useTranslation } from "react-i18next"; import FieldContainer from "@appserver/components/field-container"; -import SimpleTextInput from "./SimpleTextInput"; +import SsoTextInput from "./SsoTextInput"; -const SimpleFormField = ({ +const SsoFormField = ({ children, labelText, name, @@ -29,7 +29,7 @@ const SimpleFormField = ({ tooltipContent={tooltipContent} > {children} - { +const SsoTextInput = (props) => { const { hasError, isDisabled, @@ -61,4 +61,4 @@ export default inject(({ ssoStore }) => { setError, hideError, }; -})(observer(SimpleTextInput)); +})(observer(SsoTextInput)); diff --git a/web/ASC.Web.Client/src/components/pages/Settings/categories/integration/SingleSignOn/sub-components/UploadXML.js b/web/ASC.Web.Client/src/components/pages/Settings/categories/integration/SingleSignOn/sub-components/UploadXML.js index e52fc0602f..3a1447bb39 100644 --- a/web/ASC.Web.Client/src/components/pages/Settings/categories/integration/SingleSignOn/sub-components/UploadXML.js +++ b/web/ASC.Web.Client/src/components/pages/Settings/categories/integration/SingleSignOn/sub-components/UploadXML.js @@ -8,7 +8,7 @@ import Button from "@appserver/components/button"; import FieldContainer from "@appserver/components/field-container"; import Text from "@appserver/components/text"; -import SimpleTextInput from "./SimpleTextInput"; +import SsoTextInput from "./SsoTextInput"; import FileInput from "@appserver/components/file-input"; import UploadIcon from "../../../../../../../../public/images/actions.upload.react.svg"; import { Base } from "@appserver/components/themes"; @@ -42,7 +42,7 @@ const UploadXML = (props) => { labelText={t("UploadXML")} > -