role settings various fixes + update role object level permission design (#12664)
<img width="944" alt="Screenshot 2025-06-17 at 12 10 07" src="https://github.com/user-attachments/assets/abfda0c2-3266-465c-b98e-7bf78660a057" /> <img width="943" alt="Screenshot 2025-06-17 at 12 10 00" src="https://github.com/user-attachments/assets/8fd28479-1f55-4f3a-815c-1195154d3305" /> <img width="667" alt="Screenshot 2025-06-17 at 12 09 49" src="https://github.com/user-attachments/assets/8d444523-4e43-4b59-95bb-45dc5fac5520" /> <img width="632" alt="Screenshot 2025-06-17 at 12 09 42" src="https://github.com/user-attachments/assets/8a1e45bb-7fde-42a6-9f2d-79cbec8121cd" /> <img width="643" alt="Screenshot 2025-06-17 at 12 09 36" src="https://github.com/user-attachments/assets/43f80a92-16e2-4a0e-8a07-2f3e7278ff4a" />
This commit is contained in:
@ -0,0 +1,45 @@
|
||||
import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';
|
||||
import { SettingsRolesQueryEffect } from '@/settings/roles/components/SettingsRolesQueryEffect';
|
||||
import { SettingsRolePermissionsObjectLevelObjectPicker } from '@/settings/roles/role-permissions/object-level-permissions/components/SettingsRolePermissionsObjectLevelObjectPicker';
|
||||
import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState';
|
||||
import { SettingsPath } from '@/types/SettingsPath';
|
||||
import { SubMenuTopBarContainer } from '@/ui/layout/page/components/SubMenuTopBarContainer';
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { Navigate, useParams } from 'react-router-dom';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { getSettingsPath } from '~/utils/navigation/getSettingsPath';
|
||||
|
||||
export const SettingsRoleAddObjectLevel = () => {
|
||||
const { roleId } = useParams();
|
||||
const settingsDraftRole = useRecoilValue(
|
||||
settingsDraftRoleFamilyState(roleId ?? ''),
|
||||
);
|
||||
|
||||
if (!roleId) {
|
||||
return <Navigate to={getSettingsPath(SettingsPath.Roles)} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<SettingsRolesQueryEffect />
|
||||
<SubMenuTopBarContainer
|
||||
title={t`1. Select an object`}
|
||||
links={[
|
||||
{ children: t`Roles`, href: '/settings/roles' },
|
||||
{
|
||||
children: settingsDraftRole.label ?? '',
|
||||
href: `/settings/roles/${roleId}`,
|
||||
},
|
||||
{
|
||||
children: t`Add object permission`,
|
||||
href: `/settings/roles/${roleId}/add-object-permission`,
|
||||
},
|
||||
]}
|
||||
>
|
||||
<SettingsPageContainer>
|
||||
<SettingsRolePermissionsObjectLevelObjectPicker roleId={roleId} />
|
||||
</SettingsPageContainer>
|
||||
</SubMenuTopBarContainer>
|
||||
</>
|
||||
);
|
||||
};
|
||||
@ -1,14 +1,16 @@
|
||||
import { SettingsRolesQueryEffect } from '@/settings/roles/components/SettingsRolesQueryEffect';
|
||||
import { SettingsRole } from '@/settings/roles/role/components/SettingsRole';
|
||||
import { SettingsRoleEditEffect } from '@/settings/roles/role/components/SettingsRoleEditEffect';
|
||||
import { SettingsPath } from '@/types/SettingsPath';
|
||||
import { Navigate, useParams } from 'react-router-dom';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { getSettingsPath } from '~/utils/navigation/getSettingsPath';
|
||||
|
||||
export const SettingsRoleEdit = () => {
|
||||
const { roleId } = useParams();
|
||||
|
||||
if (!isDefined(roleId)) {
|
||||
return <Navigate to="/settings/roles" />;
|
||||
return <Navigate to={getSettingsPath(SettingsPath.Roles)} />;
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@ -1,18 +1,21 @@
|
||||
import { Navigate, useParams } from 'react-router-dom';
|
||||
|
||||
import { SettingsRolesQueryEffect } from '@/settings/roles/components/SettingsRolesQueryEffect';
|
||||
import { SettingsRolePermissionsObjectLevelObjectForm } from '@/settings/roles/role-permissions/object-level-permissions/object-form/components/SettingsRolePermissionsObjectLevelObjectForm';
|
||||
import { SettingsPath } from '@/types/SettingsPath';
|
||||
import { Navigate, useParams } from 'react-router-dom';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { getSettingsPath } from '~/utils/navigation/getSettingsPath';
|
||||
|
||||
export const SettingsRoleObjectLevel = () => {
|
||||
const { roleId, objectMetadataId } = useParams();
|
||||
|
||||
if (!isDefined(roleId)) {
|
||||
return <Navigate to="/settings/roles" />;
|
||||
return <Navigate to={getSettingsPath(SettingsPath.Roles)} />;
|
||||
}
|
||||
|
||||
if (!isDefined(objectMetadataId)) {
|
||||
return <Navigate to={`/settings/roles/${roleId}`} />;
|
||||
return (
|
||||
<Navigate to={getSettingsPath(SettingsPath.RoleDetail, { roleId })} />
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user