-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EPMRPP-96981 || Server Settings page layout (#4100)
* EPMRPP-96981 || Server Settings page layout * EPMRPP-96981 || adjusted styles to match the Figma mockup * EPMRPP-96981 || fetch app info on mount * EPMRPP-96981 || refactor the hooks syntax * EPMRPP-96981 || address PR comments and update component styles * EPMRPP-96981 || Server Settings page layout * EPMRPP-96981 || adjusted styles to match the Figma mockup * EPMRPP-96981 || fetch app info on mount * EPMRPP-96981 || refactor the hooks syntax * EPMRPP-96981 || address PR comments and update component styles * EPMRPP-96981 || remove an unused file and add a constant * EPMRPP-96981 || refactor and update translations * EPMRPP-96981 || refactor the code
- Loading branch information
Showing
14 changed files
with
256 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,5 +16,5 @@ | |
|
||
.github-auth-form { | ||
position: relative; | ||
margin-bottom: 20px; | ||
margin-bottom: 30px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,4 @@ | |
*/ | ||
|
||
export { GithubAuthForm } from './githubAuthForm'; | ||
export { SsoUsersForm } from './ssoUsersForm'; |
17 changes: 17 additions & 0 deletions
17
...in/serverSettingsPage/serverSettingsTabs/authConfigurationTab/forms/ssoUsersForm/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* Copyright 2024 EPAM Systems | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
export { SsoUsersForm } from './ssoUsersForm'; |
119 changes: 119 additions & 0 deletions
119
...rSettingsPage/serverSettingsTabs/authConfigurationTab/forms/ssoUsersForm/ssoUsersForm.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
/* | ||
* Copyright 2024 EPAM Systems | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
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 { InputBigSwitcher } from 'components/inputs/inputBigSwitcher'; | ||
import { SectionHeader } from 'components/main/sectionHeader'; | ||
import { ADMIN_SERVER_SETTINGS_PAGE_EVENTS } from 'components/main/analytics/events'; | ||
import { ssoUsersOnlySelector, fetchAppInfoAction } from 'controllers/appInfo'; | ||
import formStyles from 'pages/admin/serverSettingsPage/common/formController/formController.scss'; | ||
import styles from './ssoUsersForm.scss'; | ||
|
||
const formCx = classNames.bind(formStyles); | ||
const cx = classNames.bind(styles); | ||
|
||
const messages = defineMessages({ | ||
switcherLabel: { | ||
id: 'SsoUsersForm.switcherLabel', | ||
defaultMessage: 'SSO users only', | ||
}, | ||
formHeader: { | ||
id: 'SsoUsersForm.formHeader', | ||
defaultMessage: 'Instance Invitations', | ||
}, | ||
ssoOnlyDescription: { | ||
id: 'SsoUsersForm.ssoOnlyDescription', | ||
defaultMessage: 'New users can be created via SSO only.', | ||
}, | ||
manualInvitesDescription: { | ||
id: 'SsoUsersForm.manualInvitesDescription', | ||
defaultMessage: | ||
'Users can manually send invitations for other users. If enabled new users can be created via SSO only.', | ||
}, | ||
}); | ||
|
||
const SsoUsersFormComponent = ({ enabled: enabledFromStore, fetchAppInfo }) => { | ||
const { formatMessage } = useIntl(); | ||
const [enabled, setEnabled] = useState(enabledFromStore); | ||
const inputId = 'ssoUsersToggle'; | ||
|
||
useEffect(() => { | ||
fetchAppInfo(); | ||
}, [fetchAppInfo]); | ||
|
||
useEffect(() => { | ||
setEnabled(enabledFromStore); | ||
}, [enabledFromStore]); | ||
|
||
const getDescription = () => | ||
formatMessage(enabled ? messages.ssoOnlyDescription : messages.manualInvitesDescription); | ||
|
||
const handleToggle = (value) => { | ||
setEnabled(value); | ||
}; | ||
|
||
return ( | ||
<div className={formCx('form-controller')}> | ||
<div className={formCx('heading-wrapper')}> | ||
<SectionHeader text={formatMessage(messages.formHeader)} /> | ||
</div> | ||
<div className={formCx('form')}> | ||
<div className={cx('form-group')}> | ||
<label htmlFor={inputId} className={cx('form-group-label')}> | ||
{formatMessage(messages.switcherLabel)} | ||
</label> | ||
<div className={cx('form-group-content')}> | ||
<div className={cx('input-container')}> | ||
<InputBigSwitcher | ||
id={inputId} | ||
value={enabled} | ||
onChange={handleToggle} | ||
mobileDisabled | ||
onChangeEventInfo={ADMIN_SERVER_SETTINGS_PAGE_EVENTS.SSO_USERS_SWITCHER} | ||
/> | ||
<div className={cx('description')} aria-live="polite"> | ||
{getDescription()} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
SsoUsersFormComponent.propTypes = { | ||
enabled: PropTypes.bool, | ||
fetchAppInfo: PropTypes.func.isRequired, | ||
}; | ||
|
||
SsoUsersFormComponent.defaultProps = { | ||
enabled: false, | ||
}; | ||
|
||
const mapStateToProps = (state) => ({ | ||
enabled: ssoUsersOnlySelector(state), | ||
}); | ||
|
||
const mapDispatchToProps = { | ||
fetchAppInfo: fetchAppInfoAction, | ||
}; | ||
|
||
export const SsoUsersForm = connect(mapStateToProps, mapDispatchToProps)(SsoUsersFormComponent); |
81 changes: 81 additions & 0 deletions
81
...SettingsPage/serverSettingsTabs/authConfigurationTab/forms/ssoUsersForm/ssoUsersForm.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* | ||
* Copyright 2024 EPAM Systems | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
|
||
.form-group { | ||
display: flex; | ||
justify-content: flex-start; | ||
align-items: center; | ||
width: 100%; | ||
margin-bottom: 25px; | ||
|
||
@media (max-width: $SCREEN_XS_MAX) { | ||
flex-direction: column; | ||
align-items: flex-start; | ||
margin-bottom: 15px; | ||
} | ||
} | ||
|
||
.form-group-label { | ||
min-width: 210px; | ||
width: 210px; | ||
padding-right: 4px; | ||
text-align: right; | ||
font-size: 13px; | ||
line-height: 13px; | ||
color: $COLOR--charcoal-grey; | ||
box-sizing: border-box; | ||
|
||
@media (max-width: $SCREEN_SM_MAX) { | ||
min-width: 150px; | ||
width: 150px; | ||
} | ||
@media (max-width: $SCREEN_XS_MAX) { | ||
width: 100%; | ||
margin-bottom: 8px; | ||
padding: 0; | ||
text-align: left; | ||
} | ||
} | ||
|
||
.form-group-content { | ||
flex: 1; | ||
padding: 0 15px; | ||
|
||
@media (max-width: $SCREEN_XS_MAX) { | ||
padding: 0; | ||
width: 100%; | ||
} | ||
} | ||
|
||
.input-container { | ||
display: flex; | ||
align-items: center; | ||
gap: 15px; | ||
min-height: 36px; | ||
|
||
@media (max-width: $SCREEN_XS_MAX) { | ||
flex-direction: column; | ||
align-items: flex-start; | ||
} | ||
} | ||
|
||
.description { | ||
width: 300px; | ||
font-size: 12px; | ||
line-height: 1.5; | ||
color: $COLOR--gray-60; | ||
} |