[8583] Retrieve OOB controls/datasources from config file#4829
[8583] Retrieve OOB controls/datasources from config file#4829sumerjabri merged 3 commits intocraftercms:developfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughMake plugin descriptors optional in content-type config, normalize descriptor fields during parsing, read datasources from the corrected property, and thread parsed config lookups into picker dialogs to influence filtering and icon rendering. Changes
Sequence Diagram(s)sequenceDiagram
participant EditView as EditTypeView
participant Parser as parseConfigPlugins
participant Dialog as PickControl/PickDataSource
participant FieldDlg as PickFieldDialog
participant UI as SelectField
EditView->>Parser: supply contentTypesConfig (controls, datasources)
Parser-->>EditView: return parsed lookups (items with optional descriptor, fields normalized)
EditView->>Dialog: open dialog with configControls/configDataSources (configLookup)
Dialog->>FieldDlg: forward configLookup prop
FieldDlg->>UI: provide configLookup to SelectField for filtering/icon rendering
UI-->>FieldDlg: render list items with SystemIcon or fallback (ComponentIcon)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
ui/app/src/components/ContentTypeManagement/components/PickFieldDialog.tsx (1)
185-208:⚠️ Potential issue | 🟠 Major
configLookupis not passed toPickFieldDialogBody.The
configLookupprop is defined inPickFieldDialogPropsand received byPickFieldDialog, but it's not destructured or forwarded toPickFieldDialogBody. This meansSelectFieldwill never receive the config lookup, and custom icons will never render.🐛 Proposed fix
export function PickFieldDialog({ type, title, onInsert, + configLookup, typesFullList, typesCurrentList, systemFieldsTitle, systemFieldsIds, ...dialogProps }: PickFieldDialogProps) { return ( <EnhancedDialog title={title} maxWidth="lg" {...dialogProps}> <PickFieldDialogBody {...dialogProps} type={type} onInsert={onInsert} + configLookup={configLookup} typesFullList={typesFullList} typesCurrentList={typesCurrentList} systemFieldsTitle={systemFieldsTitle} systemFieldsIds={systemFieldsIds} /> </EnhancedDialog> ); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ui/app/src/components/ContentTypeManagement/components/PickFieldDialog.tsx` around lines 185 - 208, PickFieldDialog is receiving configLookup via PickFieldDialogProps but does not destructure or forward it to PickFieldDialogBody, so downstream SelectField never gets the lookup; update the PickFieldDialog function signature to destructure configLookup from props and pass configLookup into the PickFieldDialogBody props (alongside type, onInsert, typesFullList, typesCurrentList, systemFieldsTitle, systemFieldsIds and ...dialogProps) so SelectField can use the configLookup to render custom icons.
🧹 Nitpick comments (1)
ui/app/src/components/ContentTypeManagement/components/PickFieldDialog.tsx (1)
47-47: Incomplete TODO comment.The TODO comment appears truncated:
// TODO: not a li. Please complete or clarify this comment to document the intended follow-up work.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ui/app/src/components/ContentTypeManagement/components/PickFieldDialog.tsx` at line 47, The inline TODO on the configLookup prop is truncated and unclear; update the comment on the configLookup?: LookupTable<{ descriptor?: DescriptorContentType; icon: { id: string }; id: string }>; declaration in PickFieldDialog.tsx to a clear, actionable note describing the intended follow-up (for example: "TODO: this is not a list — ensure LookupTable is keyed by id (Record<string, ...>) or change the type to an array if a list is intended; adjust usages and rename prop if necessary"), so future maintainers understand whether to change the type to a keyed map, rename the prop, or update call sites.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@ui/app/src/components/ContentTypeManagement/components/PickDataSourceDialog.tsx`:
- Around line 43-48: The array construction for typesFullList spreads
configDescriptors directly which can be undefined; update the build of
typesFullList (the const typesFullList expression) to guard the spread by
defaulting configDescriptors to an empty array (e.g., use configDescriptors ??
[]) so that ...(configDescriptors ?? []) is used instead of
...configDescriptors, ensuring no runtime error when configDescriptors is
null/undefined.
---
Outside diff comments:
In `@ui/app/src/components/ContentTypeManagement/components/PickFieldDialog.tsx`:
- Around line 185-208: PickFieldDialog is receiving configLookup via
PickFieldDialogProps but does not destructure or forward it to
PickFieldDialogBody, so downstream SelectField never gets the lookup; update the
PickFieldDialog function signature to destructure configLookup from props and
pass configLookup into the PickFieldDialogBody props (alongside type, onInsert,
typesFullList, typesCurrentList, systemFieldsTitle, systemFieldsIds and
...dialogProps) so SelectField can use the configLookup to render custom icons.
---
Nitpick comments:
In `@ui/app/src/components/ContentTypeManagement/components/PickFieldDialog.tsx`:
- Line 47: The inline TODO on the configLookup prop is truncated and unclear;
update the comment on the configLookup?: LookupTable<{ descriptor?:
DescriptorContentType; icon: { id: string }; id: string }>; declaration in
PickFieldDialog.tsx to a clear, actionable note describing the intended
follow-up (for example: "TODO: this is not a list — ensure LookupTable is keyed
by id (Record<string, ...>) or change the type to an array if a list is
intended; adjust usages and rename prop if necessary"), so future maintainers
understand whether to change the type to a keyed map, rename the prop, or update
call sites.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 3fba6da4-577f-4dd9-a901-b4e7ec7c04df
📒 Files selected for processing (4)
ui/app/src/components/ContentTypeManagement/components/EditTypeView.tsxui/app/src/components/ContentTypeManagement/components/PickControlDialog.tsxui/app/src/components/ContentTypeManagement/components/PickDataSourceDialog.tsxui/app/src/components/ContentTypeManagement/components/PickFieldDialog.tsx
|
Outside diff range comment addresed |
craftercms/craftercms#8583
Summary by CodeRabbit
Bug Fixes
New Features