Skip to content

Add object level form to role creation #12826

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

Weiko
Copy link
Member

@Weiko Weiko commented Jun 24, 2025

Context

  • Add object-level form to role creation
  • Add isSaving props for save button isLoading state
Screenshot 2025-06-24 at 15 03 59

@@ -57,7 +56,7 @@ export const ReadOnly: Story = {

export const PendingRole: Story = {
args: {
roleId: PENDING_ROLE_ID,
roleId: 'newRoleId',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why don't we use a const anymore?

@@ -57,7 +56,7 @@ export const ReadOnly: Story = {

export const PendingRole: Story = {
args: {
roleId: PENDING_ROLE_ID,
roleId: 'newRoleId',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR implements object-level permissions during role creation and adds loading state feedback for save operations in the settings interface.

  • Exposed object-level permissions section during role creation in SettingsRolePermissions.tsx by removing conditional rendering, allowing full permission configuration upfront
  • Added isSaving prop for loading state feedback during save operations, improving UX by indicating when operations are in progress
  • Restructured role creation flow in SettingsRole.tsx to follow a logical sequence: create role → settings → object permissions → workspace members
  • Replaced hardcoded PENDING_ROLE_ID with dynamic UUID generation across stories and components
  • Modified RoleService to accept custom IDs during role creation, enabling better state management between frontend and backend

9 files reviewed, 4 comments
Edit PR Review Bot Settings | Greptile

Comment on lines +14 to +16
const persistedRole = useRecoilValue(
settingsPersistedRoleFamilyState(roleId ?? ''),
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Using empty string as fallback for undefined roleId could cause issues with Recoil selectors. Consider using undefined or handling this case differently.

Comment on lines 18 to 20
if (!isDefined(roleId)) {
return <Navigate to={getSettingsPath(SettingsPath.Roles)} />;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: This navigation check should happen before the Recoil value access to prevent unnecessary state lookups.

Comment on lines +53 to 54
setSettingsPersistedRole(undefined);
setSettingsDraftRole(newRole);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Setting persisted role to undefined before draft role. Consider if this order is intentional for state management


export const SettingsRoleCreate = () => {
const newRoleId = v4();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: UUID generation in component body will create new ID on every render. Move to useMemo or useState to prevent unnecessary role ID changes.

Suggested change
const newRoleId = v4();
import { useMemo } from 'react';
export const SettingsRoleCreate = () => {
const newRoleId = useMemo(() => v4(), []);

@charlesBochet charlesBochet merged commit 8cf7649 into main Jun 24, 2025
26 checks passed
@charlesBochet charlesBochet deleted the c--permission-add-object-level-input-to-role-creation branch June 24, 2025 13:15
Copy link
Contributor

github-actions bot commented Jun 24, 2025

🚀 Preview Environment Ready!

Your preview environment is available at: http://bore.pub:47536

This environment will automatically shut down when the PR is closed or after 5 hours.

abdulrahmancodes pushed a commit to abdulrahmancodes/twenty that referenced this pull request Jun 26, 2025
## Context
- Add object-level form to role creation
- Add isSaving props for save button isLoading state
<img width="594" alt="Screenshot 2025-06-24 at 15 03 59"
src="https://github.com/user-attachments/assets/77d9d399-4e1a-4e35-be45-c19100ef06c1"
/>

---------

Co-authored-by: Charles Bochet <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants