feat(app-headless-cms): headless (code-based) CMS bulk actions — phase 1 - #5515
Open
adrians5j wants to merge 1 commit into
Open
feat(app-headless-cms): headless (code-based) CMS bulk actions — phase 1#5515adrians5j wants to merge 1 commit into
adrians5j wants to merge 1 commit into
Conversation
Add a `CmsBulkAction` admin abstraction so a custom entry-list bulk action is declared as one DI class (implement + createImplementation), mirroring the API-side `EntriesBulkAction` — no hand-written React button/dialog/handler. Phase 1 (non-form path): - `CmsBulkAction` abstraction: name, modelIds, icon, button(), confirm(), buildData(), notifications map. Form path (formTitle/buildForm) is TODO(p2). - `IconRegistry` DI feature + `registerIcon` (string key → @webiny/icons React component), exported from `webiny/admin`. - Framework renders the toolbar button (icon → confirm → trigger → deselect → toast) and generates one WebsocketEventHandler per notification key. - Export `CmsBulkAction` from `webiny/admin/cms/entry/list`. - Migrate the applyDiscount demo: 3 admin files → 1 class. - AGENTS.md: no inline object types for params/returns — use a named interface. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
A code-based ("headless") admin API for Headless CMS bulk actions. Today a custom entry-list bulk action needs ~4 hand-written admin files (button component, websocket handler,
createFeature, registration). This adds aCmsBulkActionDI abstraction so the whole thing is one class — implement +createImplementation, mirroring the API-sideEntriesBulkAction. No hand-written React.This is Phase 1 (the non-form path). Phase 2 adds the
buildForm(FormModel) dialog path.API
The framework renders the toolbar
BulkActionButton, resolves the icon, computes the selectionwhere(allSelected ? undefined : { id_in }), opens the confirm dialog, triggersBulkActionFeature(action= PascalCasedname), deselects, toasts, and generates oneWebsocketEventHandlerpernotificationskey.Changes
CmsBulkActionabstraction → exported fromwebiny/admin/cms/entry/list. Form path (formTitle/buildForm) markedTODO(phase 2).IconRegistryDI feature +registerIcon(string key →@webiny/iconscomponent, tree-shake-friendly; also accepts a raw element) → exported fromwebiny/admin.CmsBulkActionimpls intoContentEntryListConfig.Browser.BulkAction) + per-notification handler factory.applyDiscountdemo migrated: 3 admin files → 1 class (−122 lines).AGENTS.md: no inline object types for params/returns — use a named interface.Notes / decisions
button()), notactions(): Action[].useEffect(snapshot ofresolveAll). Works for synchronously-registered extensions (the norm); lazy/async-registered actions after first commit would be missed — worth revisiting if lazy extensions land.startToast?could be added if we want it authored.BulkActionFeature/BulkActionButton/useBulkActionDialog. No API-side changes.@webiny/app-adminand@webiny/app-headless-cmsbuild green; lint clean.Follow-ups
buildForm(form, ctx)FormModel dialog path (formTitle()for title/submit label;ctx.valuesfrom the built form) + migrate theaiContentdemo (persona/projectselectfields).🤖 Generated with Claude Code