-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Add record table widget to dashboards #18747
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
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
e1c3269
feat: register RECORD_TABLE widget type across server, shared types, …
lucasbordeau 05fafb7
feat: add standalone record table provider, widget renderer, and view…
lucasbordeau 313c4b1
feat: add record table widget settings panel with source, fields, fil…
lucasbordeau 2673de3
feat: persist record table widget filters, sorts, and fields on dashb…
lucasbordeau 0de5efb
feat: add read-only mode for widget table headers, cells, and footer
lucasbordeau 44bf9c6
fix: scope record table DOM IDs, CSS variables, and hover portal per …
lucasbordeau 3162608
fix: improve record table widget UX — grid NaN freeze, drag-select sc…
lucasbordeau ab87537
style: fix prettier formatting on changed files
lucasbordeau d391127
Ok
lucasbordeau dbc1283
Fix
lucasbordeau 290ed7b
Fixed
lucasbordeau a7ee059
Fixes
lucasbordeau a2f8bea
Fix
lucasbordeau File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| **/**/.env | ||
| .DS_Store | ||
| /.idea | ||
| .claude/settings.json | ||
| **/**/node_modules/ | ||
| .cache | ||
|
|
||
|
|
||
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...twenty-front/src/modules/object-metadata/utils/filterReadableActiveObjectMetadataItems.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import { type EnrichedObjectMetadataItem } from '@/object-metadata/types/EnrichedObjectMetadataItem'; | ||
| import { type ObjectPermissions } from 'twenty-shared/types'; | ||
| import { isDefined } from 'twenty-shared/utils'; | ||
|
|
||
| export const filterReadableActiveObjectMetadataItems = ( | ||
| objectMetadataItems: EnrichedObjectMetadataItem[], | ||
| objectPermissionsByObjectMetadataId: Record< | ||
| string, | ||
| ObjectPermissions & { objectMetadataId: string } | ||
| >, | ||
| ): EnrichedObjectMetadataItem[] => | ||
| objectMetadataItems.filter((objectMetadataItem) => { | ||
| const objectPermissions = | ||
| objectPermissionsByObjectMetadataId[objectMetadataItem.id]; | ||
|
|
||
| return ( | ||
| isDefined(objectPermissions) && | ||
| objectPermissions.canReadObjectRecords && | ||
| objectMetadataItem.isActive | ||
| ); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -65,9 +65,7 @@ export const mapObjectMetadataToGraphQLQuery = ({ | |
| } | ||
|
|
||
| if (!isDefined(fieldMetadata.morphRelations)) { | ||
| throw new Error( | ||
| `Field ${fieldMetadata.name} is missing, please refresh the page. If the problem persists, please contact support.`, | ||
| ); | ||
| return []; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. revert this should not be needed |
||
| } | ||
|
|
||
| return fieldMetadata.morphRelations.map((morphRelation) => ({ | ||
|
|
@@ -100,9 +98,7 @@ export const mapObjectMetadataToGraphQLQuery = ({ | |
| } | ||
|
|
||
| if (!isDefined(fieldMetadata.morphRelations)) { | ||
| throw new Error( | ||
| `Field ${fieldMetadata.name} is missing, please refresh the page. If the problem persists, please contact support.`, | ||
| ); | ||
| return []; | ||
| } | ||
|
|
||
| return fieldMetadata.morphRelations.map((morphRelation) => ({ | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...enty-front/src/modules/object-record/record-table-widget/components/RecordTableWidget.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext'; | ||
| import { RecordTableWidgetSetReadOnlyColumnHeadersEffect } from '@/object-record/record-table-widget/components/RecordTableWidgetSetReadOnlyColumnHeadersEffect'; | ||
| import { RecordTableWithWrappers } from '@/object-record/record-table/components/RecordTableWithWrappers'; | ||
|
|
||
| export const RecordTableWidget = () => { | ||
| const { objectNameSingular, recordIndexId, viewBarInstanceId } = | ||
| useRecordIndexContextOrThrow(); | ||
|
|
||
| return ( | ||
| <> | ||
| <RecordTableWidgetSetReadOnlyColumnHeadersEffect | ||
| recordTableId={recordIndexId} | ||
| /> | ||
| <RecordTableWithWrappers | ||
| recordTableId={recordIndexId} | ||
| objectNameSingular={objectNameSingular} | ||
| viewBarId={viewBarInstanceId} | ||
| /> | ||
| </> | ||
| ); | ||
| }; |
42 changes: 42 additions & 0 deletions
42
.../object-record/record-table-widget/components/RecordTableWidgetContextStoreInitEffect.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context-store/states/contextStoreCurrentObjectMetadataItemIdComponentState'; | ||
| import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState'; | ||
| import { contextStoreCurrentViewTypeComponentState } from '@/context-store/states/contextStoreCurrentViewTypeComponentState'; | ||
| import { ContextStoreViewType } from '@/context-store/types/ContextStoreViewType'; | ||
| import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; | ||
| import { useEffect } from 'react'; | ||
|
|
||
| type RecordTableWidgetContextStoreInitEffectProps = { | ||
| objectMetadataItemId: string; | ||
| viewId: string; | ||
| }; | ||
|
|
||
| export const RecordTableWidgetContextStoreInitEffect = ({ | ||
| objectMetadataItemId, | ||
| viewId, | ||
| }: RecordTableWidgetContextStoreInitEffectProps) => { | ||
| const setContextStoreCurrentObjectMetadataItemId = useSetAtomComponentState( | ||
| contextStoreCurrentObjectMetadataItemIdComponentState, | ||
| ); | ||
|
|
||
| const setContextStoreCurrentViewId = useSetAtomComponentState( | ||
| contextStoreCurrentViewIdComponentState, | ||
| ); | ||
|
|
||
| const setContextStoreCurrentViewType = useSetAtomComponentState( | ||
| contextStoreCurrentViewTypeComponentState, | ||
| ); | ||
|
|
||
| useEffect(() => { | ||
| setContextStoreCurrentObjectMetadataItemId(objectMetadataItemId); | ||
| setContextStoreCurrentViewId(viewId); | ||
| setContextStoreCurrentViewType(ContextStoreViewType.Table); | ||
| }, [ | ||
| objectMetadataItemId, | ||
| viewId, | ||
| setContextStoreCurrentObjectMetadataItemId, | ||
| setContextStoreCurrentViewId, | ||
| setContextStoreCurrentViewType, | ||
| ]); | ||
|
|
||
| return null; | ||
| }; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
duplicate with @FelixMalfait PR