Add frontend-extensibility probes to RedHerb#781
Merged
JeroenDeDauw merged 5 commits intofrontend-extensibilityfrom Apr 28, 2026
Merged
Add frontend-extensibility probes to RedHerb#781JeroenDeDauw merged 5 commits intofrontend-extensibilityfrom
JeroenDeDauw merged 5 commits intofrontend-extensibilityfrom
Conversation
65d5e4a to
af16370
Compare
Adds a SidebarBeforeOutput hook handler contributing a "RedHerb" sidebar section with a "Find a subject" link to a new Special:RedHerbSubjectFinder. The special page mounts a RedHerb-owned Vue panel via Vue.createMwApp that lets the user pick a subject by schema and label, then renders the selected subject using NeoWiki's Infobox component. Exercises several integration points through the public-API barrel introduced by #754: RestSubjectLabelSearch (REST repository) via the embedded SubjectLookup component, the SubjectLabelSearch service via NeoWiki's service injection, the StoreStateLoader for bulk-loading subjects and schemas, the Infobox view component, and the shared Pinia owned by NeoWikiExtension. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a second sidebar entry that opens a RedHerb-owned dialog on the current page, pinning the Company schema and reusing NeoWiki's SubjectEditor and stores via the public-API barrel. On save it calls subjectStore.createChildSubject through the shared Pinia, which hits the SubjectRepository REST path to persist the new child subject. A small global RedHerb ResourceLoader module attaches itself to every NeoWiki content page through a NeoWikiGetFrontendModules hook, listens for clicks on the sidebar trigger, and mounts the dialog on first use. The CdxTooltip directive is registered on RedHerb's Vue mounts so the SubjectEditor inputs do not emit "directive: tooltip" warnings. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a third RedHerb sidebar entry that is only present when the current page has a main subject. Click opens a RedHerb-owned dialog wrapping NeoWiki's SubjectEditor, pre-populated with the main subject's existing statements. On save it calls subjectStore action, which both persists via the SubjectRepository PATCH path and updates the shared Pinia. NeoWiki's Infobox on the same page reactively re-renders without a page reload — the empirical proof of cross-boundary store sync. Adds the first PHP-side runtime API consumption from RedHerb: the sidebar hook calls NeoWikiExtension::newViewHtmlBuilder():: pageHasMainSubject() to gate the conditional link. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The previous implementation hid the link on pages without a main subject and showed an mw.notify warning when clicked. That was overly restrictive: NeoWiki's data model lets a page hold child subjects without a main, and there is no API gate. The link now appears on every existing wiki page; pages without a main subject keep the Find-a-subject link only when the title cannot exist. Repurpose the now-misnamed redherb-create-child-not-eligible key as redherb-create-child-error: the catch in CreateChildDialog renders it after any save failure, which is what it actually means. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
af16370 to
058fac0
Compare
Each RedHerb dialog had a tiny Pinia store (one boolean, occasionally plus a subject id) for its own open/close state. That was the wrong tool: those stores are not shared across the boundary, have one consumer each, and pretend to be cross-cutting state when they are not. Pinia is meant for genuinely shared stores (which RedHerb already gets via NeoWikiExtension's singleton — that part stays). Replace the local stores with a Vue ref/reactive object owned by each module's init.js and handed to the dialog SFC via app.provide() + vue.inject(). Same reactivity, no extra files, and the remaining Pinia usage in RedHerb correctly signals "we are talking to NeoWiki's stores". Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced Apr 28, 2026
This was referenced Apr 28, 2026
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.
Follows-up to #754
Adds three RedHerb sidebar entries that act as permanent integration probes for the JavaScript extension surface introduced by #754. RedHerb (
tests/RedHerb/) is NeoWiki's in-tree extension whose purpose is to be a working example of how to consume NeoWiki's extension points; everything in it lives alongside the codebase as ongoing validation. The entries are deliberately contrived — they are not user-facing features and a real extension would build a different UI on top of the same primitives — but they exercise concrete pieces of the public-API barrel end-to-end.What the probes do
Special:RedHerbSubjectFinderpage where a panel lets the user pick a subject by schema and label, then renders the selected subject using NeoWiki'sInfoboxview component.SubjectEditor. On save it callssubjectStore.createChildSubjectthrough the shared Pinia, persisting the new child via the SubjectRepository REST path.NeoWikiExtension::newViewHtmlBuilder()->pageHasMainSubject()to decide (RedHerb's first PHP-side runtime API consumption). Click opens a RedHerb-owned dialog wrappingSubjectEditorpre-populated with the existing main subject's statements. On save it callssubjectStore.updateSubject, and NeoWiki's existingInfoboxon the same page reactively re-renders without a reload.Integration points exercised through the public-API barrel
NeoWikiExtensionsubjectStore.updateSubject; NeoWiki'sInfoboxon the same page re-renders live, proving the shared store drives reactivity end-to-endRestSubjectLabelSearchvia the embeddedSubjectLookup;RestSubjectRepositoryviasubjectStore.createChildSubject(POST) andsubjectStore.updateSubject(PATCH) andStoreStateLoader. The other repos in the barrel use the same import chain andHttpClient, so exercising more is more of the same coverage.SubjectLabelSearch,PropertyTypeRegistry,SubjectAuthorizer(transitively viaSubjectEditor/Infobox)useSubjectStore(read + create + update),useSchemaStoreSubjectLookup,Infobox,SubjectEditorVue.createMwAppfrom RedHerbapp.use( ext.getPinia() )andNeoWikiServices.registerServices( app )NeoWikiExtension::newViewHtmlBuilder()->pageHasMainSubject()consumed byRedHerbSidebarHookto gate the conditional Edit linkSidebarBeforeOutputhookRedHerbSidebarHookNeoWikiGetFrontendModuleshookRedHerbFrontendModulesHookadds the global RedHerb modules on every NeoWiki pageSpecialPageregistrationSpecial:RedHerbSubjectFinderCross-boundary Pinia sharing recipe
ACME Inc).?action=subjectsfor the same page.The dialog and
subjectStore.createChildSubjectare owned by separate Vue apps mounted by RedHerb and by NeoWiki respectively. They observe the same store because they share a Pinia instance owned byNeoWikiExtension(the singleton routing was added to #754).Screenshots