-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Fix remote object read-only + remove relations #4921
Conversation
a86664b
to
62dc378
Compare
bd80931
to
15fd09f
Compare
[download, progress], | ||
); | ||
|
||
const baseActions = objectMetadataItem.isRemote |
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.
I don't think it's enough, we cannot add a favorite on remote object either. (it's below in the code).
I would update base action to only contain export
then I would append deletion and favorittes for nonRemotes
onTab={handleTab} | ||
/> | ||
isReadOnly ? ( | ||
<FieldDisplay /> |
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.
looks like a hack. I would pass isReadOnly to the recordTableContainer and prevent edit mode activation
const isFieldInputOnly = useIsFieldInputOnly(); | ||
|
||
const { openTableCell } = useOpenRecordTableCell(); | ||
|
||
const handleClick = () => { | ||
setSoftFocusOnCurrentCell(); | ||
|
||
if (!isFieldInputOnly) { | ||
if (!isFieldInputOnly && !isReadOnly) { |
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.
i would not check it here but within the openTableCell itself
@@ -95,7 +98,7 @@ export const RecordTableCellSoftFocusMode = ({ | |||
); | |||
|
|||
const handleClick = () => { | |||
if (!isFieldInputOnly) { | |||
if (!isFieldInputOnly && !isReadOnly) { |
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.
so you don't have to add it several times
@@ -855,4 +868,14 @@ export class ObjectMetadataService extends TypeOrmQueryService<ObjectMetadataEnt | |||
|
|||
return { favoriteObjectMetadata }; | |||
} | |||
|
|||
private async isRelationEnabledForRemoteObjects(workspaceId: string) { | |||
const featureFlag = await this.featureFlagRepository.findOneBy({ |
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.
I'm surprise we don't have a generic helper in the backend isFeatureFlagEnabled(KEY) this logic of existence + boolean = true seems standard
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.
we don't. But I can do a refacto. I tried to make it a guard not so long ago but it was not working well. An util would be easy
objectMetadataInput.workspaceId, | ||
createdObjectMetadata, | ||
); | ||
if (isCustom || isRelationEnabledForRemoteObjects) { |
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.
This looks suspicious: create object is necessarily either custom or remote. so I would actually create a function call: createObjectRelations. First line would be: if (! isRelationEnabledForRemoteObjects) { return }
@@ -74,19 +74,6 @@ export const buildWorkspaceMigrationsForRemoteObject = async ( | |||
} satisfies WorkspaceMigrationColumnCreate, | |||
], | |||
}, | |||
{ | |||
name: computeObjectTargetTable(activityTargetObjectMetadata), |
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.
so the featureflag is partially followed? we always remove from migrations?
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.
Nope this part is only cleaning duplicated code
9bf8f68
to
d48b693
Compare
- Set `readOnly` boolean in table row context. Preventing updates and deletion - Show page is null for remote objects. No need for complicated design since this is temporary? - Relation creations are now behind a feature flag for remote objects - Refetch objects and views after syncing objects --------- Co-authored-by: Thomas Trompette <thomast@twenty.com>
readOnly
boolean in table row context. Preventing updates and deletion