From faac704316d50726ee563be3ac12d931d276c202 Mon Sep 17 00:00:00 2001
From: iso9000t <119494473+iso9000t@users.noreply.github.com>
Date: Wed, 20 Nov 2024 15:27:25 +0400
Subject: [PATCH] EPMRPP-96981 || address PR comments and update component
styles
---
.../forms/githubAuthForm/githubAuthForm.scss | 2 +-
.../forms/ssoUsersForm/ssoUsersForm.jsx | 85 ++++++++-----------
.../forms/ssoUsersForm/ssoUsersForm.scss | 73 ++++++++++++----
3 files changed, 92 insertions(+), 68 deletions(-)
diff --git a/app/src/pages/admin/serverSettingsPage/serverSettingsTabs/authConfigurationTab/forms/githubAuthForm/githubAuthForm.scss b/app/src/pages/admin/serverSettingsPage/serverSettingsTabs/authConfigurationTab/forms/githubAuthForm/githubAuthForm.scss
index 5da8212417..61cbacd31f 100644
--- a/app/src/pages/admin/serverSettingsPage/serverSettingsTabs/authConfigurationTab/forms/githubAuthForm/githubAuthForm.scss
+++ b/app/src/pages/admin/serverSettingsPage/serverSettingsTabs/authConfigurationTab/forms/githubAuthForm/githubAuthForm.scss
@@ -16,5 +16,5 @@
.github-auth-form {
position: relative;
- margin-bottom: 33px;
+ margin-bottom: 30px;
}
diff --git a/app/src/pages/admin/serverSettingsPage/serverSettingsTabs/authConfigurationTab/forms/ssoUsersForm/ssoUsersForm.jsx b/app/src/pages/admin/serverSettingsPage/serverSettingsTabs/authConfigurationTab/forms/ssoUsersForm/ssoUsersForm.jsx
index 9315649665..562c4dd873 100644
--- a/app/src/pages/admin/serverSettingsPage/serverSettingsTabs/authConfigurationTab/forms/ssoUsersForm/ssoUsersForm.jsx
+++ b/app/src/pages/admin/serverSettingsPage/serverSettingsTabs/authConfigurationTab/forms/ssoUsersForm/ssoUsersForm.jsx
@@ -14,24 +14,22 @@
* limitations under the License.
*/
-import React, { useEffect } from 'react';
+import React, { useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import { defineMessages, useIntl } from 'react-intl';
import classNames from 'classnames/bind';
import { connect } from 'react-redux';
-import { reduxForm, Field } from 'redux-form';
import { InputBigSwitcher } from 'components/inputs/inputBigSwitcher';
import { SectionHeader } from 'components/main/sectionHeader';
import { ADMIN_SERVER_SETTINGS_PAGE_EVENTS } from 'components/main/analytics/events';
-import { FormField } from 'components/fields/formField';
-import { ENABLED_KEY } from 'pages/admin/serverSettingsPage/common/constants';
import { ssoUsersOnlySelector, fetchAppInfoAction } from 'controllers/appInfo';
import formStyles from 'pages/admin/serverSettingsPage/common/formController/formController.scss';
-import './ssoUsersForm.scss';
+import styles from './ssoUsersForm.scss';
const formCx = classNames.bind(formStyles);
+const cx = classNames.bind(styles);
-const localMessages = defineMessages({
+const messages = defineMessages({
switcherLabel: {
id: 'SsoUsersForm.switcherLabel',
defaultMessage: 'SSO users only',
@@ -42,67 +40,61 @@ const localMessages = defineMessages({
},
});
-function SsoUsersFormComponent({ initialize, enabled, fetchAppInfo }) {
+const SsoUsersFormComponent = ({ enabled: enabledFromStore, fetchAppInfo }) => {
const { formatMessage } = useIntl();
+ const [enabled, setEnabled] = useState(enabledFromStore);
+ const inputId = 'ssoUsersToggle';
useEffect(() => {
fetchAppInfo();
}, [fetchAppInfo]);
useEffect(() => {
- initialize({ [ENABLED_KEY]: enabled });
- }, [initialize, enabled]);
+ setEnabled(enabledFromStore);
+ }, [enabledFromStore]);
- const renderToggle = ({ input }) => (
-