mirror of
https://github.com/strapi/strapi.git
synced 2025-09-26 17:00:55 +00:00
Chore: Replace role layout ee_else_ce imports with useEnterprise
This commit is contained in:
parent
a1fbbee8f7
commit
005f91bdcc
@ -4,3 +4,5 @@ export const FORM_INITIAL_VALUES = {
|
|||||||
email: '',
|
email: '',
|
||||||
roles: [],
|
roles: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const ROLE_LAYOUT = [];
|
||||||
|
@ -25,10 +25,9 @@ import {
|
|||||||
} from '@strapi/helper-plugin';
|
} from '@strapi/helper-plugin';
|
||||||
import { useMutation } from 'react-query';
|
import { useMutation } from 'react-query';
|
||||||
|
|
||||||
import roleSettingsForm from 'ee_else_ce/pages/SettingsPage/pages/Users/ListPage/ModalForm/utils/roleSettingsForm';
|
|
||||||
import MagicLink from 'ee_else_ce/pages/SettingsPage/pages/Users/components/MagicLink';
|
import MagicLink from 'ee_else_ce/pages/SettingsPage/pages/Users/components/MagicLink';
|
||||||
|
|
||||||
import { FORM_INITIAL_VALUES } from './constants';
|
import { FORM_INITIAL_VALUES, ROLE_LAYOUT } from './constants';
|
||||||
import SelectRoles from '../../components/SelectRoles';
|
import SelectRoles from '../../components/SelectRoles';
|
||||||
import layout from './utils/layout';
|
import layout from './utils/layout';
|
||||||
import schema from './utils/schema';
|
import schema from './utils/schema';
|
||||||
@ -43,7 +42,19 @@ const ModalForm = ({ onSuccess, onToggle }) => {
|
|||||||
const toggleNotification = useNotification();
|
const toggleNotification = useNotification();
|
||||||
const { lockApp, unlockApp } = useOverlayBlocker();
|
const { lockApp, unlockApp } = useOverlayBlocker();
|
||||||
const { post } = useFetchClient();
|
const { post } = useFetchClient();
|
||||||
const formDataModel = useEnterprise(
|
const roleRowLayout = useEnterprise(
|
||||||
|
ROLE_LAYOUT,
|
||||||
|
async () =>
|
||||||
|
(
|
||||||
|
await import(
|
||||||
|
'../../../../../../../../ee/admin/pages/SettingsPage/pages/Users/ListPage/ModalForm/constants'
|
||||||
|
)
|
||||||
|
).ROLE_LAYOUT,
|
||||||
|
{
|
||||||
|
defaultValue: [],
|
||||||
|
}
|
||||||
|
);
|
||||||
|
const initialValues = useEnterprise(
|
||||||
FORM_INITIAL_VALUES,
|
FORM_INITIAL_VALUES,
|
||||||
async () =>
|
async () =>
|
||||||
(
|
(
|
||||||
@ -138,7 +149,7 @@ const ModalForm = ({ onSuccess, onToggle }) => {
|
|||||||
</Breadcrumbs>
|
</Breadcrumbs>
|
||||||
</ModalHeader>
|
</ModalHeader>
|
||||||
<Formik
|
<Formik
|
||||||
initialValues={formDataModel}
|
initialValues={initialValues}
|
||||||
onSubmit={handleSubmit}
|
onSubmit={handleSubmit}
|
||||||
validationSchema={schema}
|
validationSchema={schema}
|
||||||
validateOnChange={false}
|
validateOnChange={false}
|
||||||
@ -195,7 +206,7 @@ const ModalForm = ({ onSuccess, onToggle }) => {
|
|||||||
value={values.roles}
|
value={values.roles}
|
||||||
/>
|
/>
|
||||||
</GridItem>
|
</GridItem>
|
||||||
{roleSettingsForm.map((row) => {
|
{roleRowLayout.map((row) => {
|
||||||
return row.map((input) => {
|
return row.map((input) => {
|
||||||
return (
|
return (
|
||||||
<GridItem key={input.name} {...input.size}>
|
<GridItem key={input.name} {...input.size}>
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
const form = [];
|
|
||||||
|
|
||||||
export default form;
|
|
@ -5,3 +5,26 @@ export const FORM_INITIAL_VALUES = {
|
|||||||
}
|
}
|
||||||
: {}),
|
: {}),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const ROLE_LAYOUT = [
|
||||||
|
...(window.strapi.features.isEnabled(window.strapi.features.SSO)
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
intlLabel: {
|
||||||
|
id: 'Settings.permissions.users.form.sso',
|
||||||
|
defaultMessage: 'Connect with SSO',
|
||||||
|
},
|
||||||
|
hint: {
|
||||||
|
id: 'Settings.permissions.users.form.sso.description',
|
||||||
|
defaultMessage: 'When enabled (ON), users can login via SSO',
|
||||||
|
},
|
||||||
|
name: 'useSSORegistration',
|
||||||
|
type: 'bool',
|
||||||
|
size: {
|
||||||
|
col: 6,
|
||||||
|
xs: 12,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: []),
|
||||||
|
];
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
const form = window.strapi.features.isEnabled(window.strapi.features.SSO)
|
|
||||||
? [
|
|
||||||
[
|
|
||||||
{
|
|
||||||
intlLabel: {
|
|
||||||
id: 'Settings.permissions.users.form.sso',
|
|
||||||
defaultMessage: 'Connect with SSO',
|
|
||||||
},
|
|
||||||
hint: {
|
|
||||||
id: 'Settings.permissions.users.form.sso.description',
|
|
||||||
defaultMessage: 'When enabled (ON), users can login via SSO',
|
|
||||||
},
|
|
||||||
name: 'useSSORegistration',
|
|
||||||
type: 'bool',
|
|
||||||
size: {
|
|
||||||
col: 6,
|
|
||||||
xs: 12,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
]
|
|
||||||
: [];
|
|
||||||
|
|
||||||
export default form;
|
|
Loading…
x
Reference in New Issue
Block a user