-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Make workflow objects read only in frontend #7545
Conversation
@thomtrp the CI is red because of the linter! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This pull request introduces changes to make workflow objects read-only in the frontend, implementing new utility functions and modifying existing components to enforce read-only behavior for specific workflow-related objects.
- Added
isWorkflowSubObject
utility function inisWorkflowSubObject.ts
to identify WorkflowVersion and WorkflowRun objects - Replaced
isRemoteObject
withisReadOnlyObject
inuseRecordActionBar.tsx
to determine read-only status for records - Implemented
isFieldReadonlyFromObjectMetadataName
inuseIsFieldReadOnly.ts
to control field editability based on object metadata - Modified
RecordIndexPageHeader.tsx
andRecordTableEmptyStateDisplay.tsx
to conditionally render add buttons for non-read-only objects - Updated
WorkflowWorkspaceEntity
in the backend to cascade delete related entities when a workflow is deleted
12 file(s) reviewed, 11 comment(s)
Edit PR Review Bot Settings
packages/twenty-front/src/modules/object-metadata/hooks/useObjectIsRemote.ts
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/object-metadata/utils/isWorkflowSubObject.ts
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/object-record/record-field/hooks/useIsFieldReadOnly.ts
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/object-record/record-field/hooks/useIsFieldReadOnly.ts
Outdated
Show resolved
Hide resolved
...ges/twenty-front/src/modules/object-record/record-index/components/RecordIndexPageHeader.tsx
Outdated
Show resolved
Hide resolved
...-record/record-show/record-detail-section/components/RecordDetailRelationRecordsListItem.tsx
Outdated
Show resolved
Hide resolved
...s/object-record/record-show/record-detail-section/components/RecordDetailRelationSection.tsx
Outdated
Show resolved
Hide resolved
...s/object-record/record-show/record-detail-section/components/RecordDetailRelationSection.tsx
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/ui/layout/show-page/components/ShowPageMoreButton.tsx
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/ui/layout/show-page/components/ShowPageMoreButton.tsx
Outdated
Show resolved
Hide resolved
1c7bcf6
to
402228d
Compare
@charlesBochet CI is fixed |
You bet :D |
98133c4
to
e9bb2d0
Compare
For good this time 😂 |
packages/twenty-front/src/modules/object-metadata/utils/isReadOnlyObject.ts
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/object-metadata/utils/isWorkflowSubObject.ts
Outdated
Show resolved
Hide resolved
return ( | ||
fieldDefinition.metadata.fieldName === 'noteTargets' || | ||
fieldDefinition.metadata.fieldName === 'taskTargets' || | ||
metadata.fieldName === 'noteTargets' || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move it to your new util
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
...-front/src/modules/object-record/record-field/utils/isFieldReadonlyFromObjectMetadataName.ts
Outdated
Show resolved
Hide resolved
1a56bfc
to
87f665a
Compare
Expected behavior: - workflows can be added and deleted. Only name field is editable - versions and runs cannot be added nor deleted. No fields are editable Added two new utils for those needs: - `isReadOnlyObject` the similar logic between remote objects, versions and runs - `isFieldReadonlyFromObjectMetadataName` to easily block field edition from object context
Expected behavior:
Added two new utils for those needs:
isReadOnlyObject
the similar logic between remote objects, versions and runsisFieldReadonlyFromObjectMetadataName
to easily block field edition from object context