mirror of
https://github.com/strapi/strapi.git
synced 2025-11-01 18:33:55 +00:00
Move roles components in Roles/EditPage
Signed-off-by: soupette <cyril@strapi.io>
This commit is contained in:
parent
ec3cd692b4
commit
b2c2e7d161
@ -6,7 +6,7 @@ import { get } from 'lodash';
|
||||
import { Checkbox, Flex } from '@buffetjs/core';
|
||||
import { Label } from '@buffetjs/styles';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import IS_DISABLED from 'ee_else_ce/components/Roles/ConditionsModal/ConditionsSelect/MenuList/utils/constants';
|
||||
import IS_DISABLED from 'ee_else_ce/pages/Roles/EditPage/components/ConditionsModal/ConditionsSelect/MenuList/utils/constants';
|
||||
import { getCheckboxState } from '../../../utils';
|
||||
import createCollapsesObject from './utils/createCollapsesObject';
|
||||
import SubUl from './SubUl';
|
||||
@ -16,7 +16,7 @@ import { get, groupBy, upperFirst } from 'lodash';
|
||||
import PropTypes from 'prop-types';
|
||||
import React, { useMemo, useState } from 'react';
|
||||
import { useIntl } from 'react-intl';
|
||||
import { usePermissionsDataManager } from '../../../hooks';
|
||||
import { usePermissionsDataManager } from '../../../../../hooks';
|
||||
import ActionRow from './ActionRow';
|
||||
import createDefaultConditionsForm from './utils/createDefaultConditionsForm';
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
import { Down, Up } from '@strapi/icons';
|
||||
import { Box, Checkbox, Row, Text } from '@strapi/parts';
|
||||
import IS_DISABLED from 'ee_else_ce/components/Roles/ContentTypeCollapse/Collapse/utils/constants';
|
||||
import IS_DISABLED from 'ee_else_ce/pages/Roles/EditPage/components/ContentTypeCollapse/Collapse/utils/constants';
|
||||
import { get, omit } from 'lodash';
|
||||
import PropTypes from 'prop-types';
|
||||
import React, { useMemo, useState } from 'react';
|
||||
import { useIntl } from 'react-intl';
|
||||
import styled from 'styled-components';
|
||||
import { usePermissionsDataManager } from '../../../../hooks';
|
||||
import { usePermissionsDataManager } from '../../../../../../hooks';
|
||||
import ConditionsButton from '../../ConditionsButton';
|
||||
import ConditionsModal from '../../ConditionsModal';
|
||||
import HiddenAction from '../../HiddenAction';
|
||||
@ -191,13 +191,14 @@ const Collapse = ({
|
||||
{ label: `${permissionLabel} ${label}` }
|
||||
)}
|
||||
// Keep same signature as packages/core/admin/admin/src/components/Roles/Permissions/index.js l.91
|
||||
onValueChange={value =>
|
||||
onValueChange={value => {
|
||||
onChangeParentCheckbox({
|
||||
target: {
|
||||
name: checkboxName,
|
||||
value,
|
||||
},
|
||||
})}
|
||||
});
|
||||
}}
|
||||
indeterminate={hasSomeActionsSelected}
|
||||
value={hasAllActionsSelected}
|
||||
/>
|
||||
@ -1,11 +1,11 @@
|
||||
import { Checkbox, Row } from '@strapi/parts';
|
||||
import IS_DISABLED from 'ee_else_ce/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/ActionRow/utils/constants';
|
||||
import IS_DISABLED from 'ee_else_ce/pages/Roles/EditPage/components/ContentTypeCollapse/CollapsePropertyMatrix/ActionRow/utils/constants';
|
||||
import { get } from 'lodash';
|
||||
import PropTypes from 'prop-types';
|
||||
import { useIntl } from 'react-intl';
|
||||
import React, { memo, useCallback, useMemo, useState } from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { usePermissionsDataManager } from '../../../../../hooks';
|
||||
import { usePermissionsDataManager } from '../../../../../../../hooks';
|
||||
import HiddenAction from '../../../HiddenAction';
|
||||
import { cellWidth, rowHeight } from '../../../Permissions/utils/constants';
|
||||
import RequiredSign from '../../../RequiredSign';
|
||||
@ -143,13 +143,14 @@ const ActionRow = ({
|
||||
{ label: `${name} ${label}` }
|
||||
)}
|
||||
// Keep same signature as packages/core/admin/admin/src/components/Roles/Permissions/index.js l.91
|
||||
onValueChange={value =>
|
||||
onValueChange={value => {
|
||||
onChangeSimpleCheckbox({
|
||||
target: {
|
||||
name: checkboxName.join('..'),
|
||||
value,
|
||||
},
|
||||
})}
|
||||
});
|
||||
}}
|
||||
value={checkboxValue}
|
||||
/>
|
||||
</Cell>
|
||||
@ -166,13 +167,14 @@ const ActionRow = ({
|
||||
disabled={isFormDisabled || IS_DISABLED}
|
||||
name={checkboxName.join('..')}
|
||||
// Keep same signature as packages/core/admin/admin/src/components/Roles/Permissions/index.js l.91
|
||||
onValueChange={value =>
|
||||
onValueChange={value => {
|
||||
onChangeParentCheckbox({
|
||||
target: {
|
||||
name: checkboxName.join('..'),
|
||||
value,
|
||||
},
|
||||
})}
|
||||
});
|
||||
}}
|
||||
aria-label={formatMessage(
|
||||
{
|
||||
id: `Settings.permissions.select-by-permission`,
|
||||
@ -1,11 +1,11 @@
|
||||
import { Box, Checkbox, Row, Text } from '@strapi/parts';
|
||||
import IS_DISABLED from 'ee_else_ce/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/SubActionRow/utils/constants';
|
||||
import IS_DISABLED from 'ee_else_ce/pages/Roles/EditPage/components/ContentTypeCollapse/CollapsePropertyMatrix/SubActionRow/utils/constants';
|
||||
import { get, upperFirst } from 'lodash';
|
||||
import PropTypes from 'prop-types';
|
||||
import React, { memo, useMemo, useState } from 'react';
|
||||
import { useIntl } from 'react-intl';
|
||||
import styled from 'styled-components';
|
||||
import { usePermissionsDataManager } from '../../../../../hooks';
|
||||
import { usePermissionsDataManager } from '../../../../../../../hooks';
|
||||
import CollapseLabel from '../../../CollapseLabel';
|
||||
import Curve from '../../../Curve';
|
||||
import HiddenAction from '../../../HiddenAction';
|
||||
@ -169,13 +169,14 @@ const SubActionRow = ({
|
||||
{ label: `${parentName} ${label} ${propertyLabel}` }
|
||||
)}
|
||||
// Keep same signature as packages/core/admin/admin/src/components/Roles/Permissions/index.js l.91
|
||||
onValueChange={value =>
|
||||
onValueChange={value => {
|
||||
onChangeSimpleCheckbox({
|
||||
target: {
|
||||
name: checkboxName.join('..'),
|
||||
value,
|
||||
},
|
||||
})}
|
||||
});
|
||||
}}
|
||||
value={checkboxValue}
|
||||
/>
|
||||
</Cell>
|
||||
@ -1,11 +1,11 @@
|
||||
import { Checkbox, Stack, TableLabel, Box } from '@strapi/parts';
|
||||
import IS_DISABLED from 'ee_else_ce/components/Roles/GlobalActions/utils/constants';
|
||||
import IS_DISABLED from 'ee_else_ce/pages/Roles/EditPage/components/GlobalActions/utils/constants';
|
||||
import { get } from 'lodash';
|
||||
import PropTypes from 'prop-types';
|
||||
import React, { memo, useMemo } from 'react';
|
||||
import { useIntl } from 'react-intl';
|
||||
import styled from 'styled-components';
|
||||
import { usePermissionsDataManager } from '../../../hooks';
|
||||
import { usePermissionsDataManager } from '../../../../../hooks';
|
||||
import { cellWidth, firstRowWidth } from '../Permissions/utils/constants';
|
||||
import { findDisplayedActions, getCheckboxesState } from './utils';
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { PermissionsDataManagerContext } from '../../../contexts';
|
||||
import { PermissionsDataManagerContext } from '../../../../../contexts';
|
||||
|
||||
const PermissionsDataManagerProvider = ({ children, value }) => {
|
||||
return (
|
||||
@ -5,8 +5,8 @@ import { Row, Box, TableLabel, Checkbox, Grid, GridItem } from '@strapi/parts';
|
||||
|
||||
import { useIntl } from 'react-intl';
|
||||
import { get } from 'lodash';
|
||||
import IS_DISABLED from 'ee_else_ce/components/Roles/PluginsAndSettings/SubCategory/utils/constants';
|
||||
import { usePermissionsDataManager } from '../../../../hooks';
|
||||
import IS_DISABLED from 'ee_else_ce/pages/Roles/EditPage/components/PluginsAndSettings/SubCategory/utils/constants';
|
||||
import { usePermissionsDataManager } from '../../../../../../hooks';
|
||||
import { getCheckboxState, removeConditionKeyFromData } from '../../utils';
|
||||
import ConditionsButton from '../../ConditionsButton';
|
||||
import ConditionsModal from '../../ConditionsModal';
|
||||
@ -80,13 +80,14 @@ const SubCategory = ({ categoryName, isFormDisabled, subCategoryName, actions, p
|
||||
name={pathToData.join('..')}
|
||||
disabled={isFormDisabled || IS_DISABLED}
|
||||
// Keep same signature as packages/core/admin/admin/src/components/Roles/Permissions/index.js l.91
|
||||
onValueChange={value =>
|
||||
onValueChange={value => {
|
||||
onChangeParentCheckbox({
|
||||
target: {
|
||||
name: pathToData.join('..'),
|
||||
value,
|
||||
},
|
||||
})}
|
||||
});
|
||||
}}
|
||||
indeterminate={hasSomeActionsSelected}
|
||||
value={hasAllActionsSelected}
|
||||
>
|
||||
@ -1,4 +1,2 @@
|
||||
export { default as EmptyRole } from './EmptyRole';
|
||||
export { default as Permissions } from './Permissions';
|
||||
export { default as RoleForm } from './RoleForm';
|
||||
export { default as RoleRow } from './RoleRow';
|
||||
@ -12,7 +12,7 @@ import get from 'lodash/get';
|
||||
import React, { useRef, useState } from 'react';
|
||||
import { useIntl } from 'react-intl';
|
||||
import { useRouteMatch } from 'react-router-dom';
|
||||
import { Permissions, RoleForm } from '../../../components/Roles';
|
||||
import { Permissions, RoleForm } from './components';
|
||||
import { useFetchPermissionsLayout, useFetchRole } from '../../../hooks';
|
||||
import schema from './utils/schema';
|
||||
|
||||
|
||||
@ -18,7 +18,8 @@ import matchSorter from 'match-sorter';
|
||||
import React, { useCallback, useState } from 'react';
|
||||
import { useIntl } from 'react-intl';
|
||||
import { useHistory } from 'react-router';
|
||||
import { EmptyRole, RoleRow } from '../../../components/Roles';
|
||||
import RoleRow from './components/RoleRow';
|
||||
import EmptyRole from './components/EmptyRole';
|
||||
import UpgradePlanModal from '../../../components/UpgradePlanModal';
|
||||
import { useRolesList } from '../../../hooks';
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ jest.mock('react-intl', () => ({
|
||||
FormattedMessage: ({ id }) => id,
|
||||
useIntl: () => ({ formatMessage: jest.fn(({ id }) => id) }),
|
||||
}));
|
||||
jest.mock('../../ApplicationInfosPage', () => () => <h1>App infos</h1>);
|
||||
jest.mock('../pages/ApplicationInfosPage', () => () => <h1>App infos</h1>);
|
||||
|
||||
const makeApp = (history, settings) => (
|
||||
<Theme>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user