CLARIN-DSpace v9/Port #1326 (scoped-search icon on community/collection pages) to the v9 base - #1508
Merged
Merged
Conversation
…tion
The DSO action menu of a Community or Collection gains a scoped-search entry
that opens /search restricted to that container, on the first page
(/search?spc.page=1&scope=<uuid>).
This is a rewrite, not a translation. On 7.x the entry was one more object in
the array returned by DSOEditMenuResolver (`id: 'search-dso'`, `index: 3`).
That resolver does not exist on v9 - the DSO edit menu is assembled from menu
providers registered in app.menus.ts - so the port is:
* new `ComColSearchMenuProvider extends DSpaceObjectPageMenuProvider`, modelled
on the sibling `comcol-subscribe.menu.ts`, returning one LINK section
{ text: 'search.title', link: '/search',
queryParams: { 'spc.page': '1', scope: dso.uuid }, icon: 'search' };
* registered FIRST inside `DsoOptionMenuProvider.withSubs([...])` with
`.onRoute(MenuRoute.COMMUNITY_PAGE, MenuRoute.COLLECTION_PAGE)` - ordering on
v9 comes from the position in withSubs([...]), which is why 7.x's `index: 3`
is dropped rather than translated. `id: 'search-dso'` and `active: false` are
dropped for the same reason: `PartialMenuSection.id` is optional and
auto-assigned, and no sibling provider sets either;
* `[queryParams]="itemModel.queryParams"` added to the LINK anchor in
dso-edit-menu-section.component.html. `LinkMenuItemModel.queryParams` already
exists on 9-base (vanilla) but the DSO-edit renderer silently dropped it, so
this one line is what makes the model half work.
The 7.x resolver-spec hunks have no target on v9 and are replaced by the new
provider spec (2 cases). The two page specs the source commit also adds
(community-page / collection-page) are deliberately NOT ported: they do not
exist on 9-base or on dspace-9.3, they are written pre-standalone, and their
single assertion is `expect(query(By.css('ds-dso-edit-menu'))).toBeTruthy()`,
which does not exercise this feature at all.
UX note, decided by the repository owner (decision O-4): on v9 every DSO_EDIT
sub-provider is nested under DsoOptionMenuProvider, so the magnifier is an entry
inside the "options" dropdown rather than a button next to Subscribe/Edit. The
new section is visible unconditionally (a scoped search was public on 7.x too),
which flips `hasSubSections$` from false to true for anonymous visitors and
therefore makes the "options" button itself visible to them for the first time.
That is accepted: the feature is unchanged, only the chrome around it is new.
Source: fecfa07 (dtq-dev PR #1326)
Co-Authored-By: Claude Opus 5 (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
Ports
dataquest-dev/dspace-angular#1326 (fecfa07e5d, "[Port to dtq-dev] Add search icon tocommunity and collection", originally
ufal/dspace-angular#109) todtq-dev-9-base.Sync card FE-22 (tranche T4).
The DSO action menu of a Community or Collection gains a scoped-search entry that opens
/search?spc.page=1&scope=<uuid>— search restricted to that container, on the first page.Changes
shared/menu/providers/comcol-search.menu.tsComColSearchMenuProvidershared/menu/providers/comcol-search.menu.spec.tsapp.menus.tsDsoOptionMenuProvider.withSubs([...]),.onRoute(COMMUNITY_PAGE, COLLECTION_PAGE)shared/dso-page/dso-edit-menu/dso-edit-menu-section/…component.html[queryParams]="itemModel.queryParams"on the LINK anchor…dso-edit-menu-section.component.spec.tsqueryParams, 7 → 8 casesWhy this is a rewrite, not a translation
On 7.x the entry was one more object in the array returned by
DSOEditMenuResolver(
id: 'search-dso',index: 3). That resolver does not exist on v9 — the DSO edit menu isassembled from providers registered in
app.menus.ts:So two of the source's four production/spec hunks have no target and are replaced by the new
provider plus its spec. What is dropped rather than translated, and why:
index: 3—PartialMenuSectionon v9 has noindexfield; ordering comes from the positioninside
withSubs([...]), so "first in the list" replaces it.id: 'search-dso'andactive: false— both optional on v9 and auto-assigned(
AbstractMenuProvider.getAutomatedSectionId()); the closest siblingSubscribeMenuProvidersetsneither.
LinkMenuItemModel.queryParamsalready exists on 9-base and is byte-identical withdspace-9.3, sothe model half is untouched — the missing piece was the one-line binding in the renderer. That is
also a vanilla gap worth noting:
dso-edit-menu-section.component.htmlis byte-identical betweendtq-dev-9-baseanddspace-9.3, so upstream a LINK section may carryqueryParamsin its modeland the DSO-edit renderer silently drops them.
No extra DI registration is needed —
buildMenuStructure()pushes the provider class itself into theProvider[]it returns, andMENUSis spread intoapp.config.ts.UX change this makes, deliberately (owner decision O-4, 2026-09-10)
On v9 every
MenuID.DSO_EDITsub-provider is nested underDsoOptionMenuProvider(
alwaysRenderExpandable = true), so the magnifier is an entry inside the "⋮ Options" dropdownrather than a button standing next to Subscribe/Edit as on 7.x. Manual scenario UNIVERSAL-021
needs rewording accordingly.
The new section is visible unconditionally (a scoped search was public on 7.x too, where the same
entry carried no authorization check). Today, for an anonymous visitor,
SubscribeandEditare both
visible: false, sohasSubSections$is false and the whole dropdown — button included —is
@if-ed away:Adding an unconditionally visible section flips
hasSubSections$to true, so this PR makes the"⋮ Options" button visible to logged-out visitors for the first time. Verified locally by rendering
DsoEditMenuExpandableSectionComponentwith and without the section the provider returns:The repository owner has accepted this (decision O-4): the feature is unchanged, only the chrome
around it is new. No authorization gate was added.
Not ported, with a verdict
The source also adds
community-page.component.spec.tsandcollection-page.component.spec.ts.Neither exists on
dtq-dev-9-baseor ondspace-9.3; both are written pre-standalone(
declarations: [],NO_ERRORS_SCHEMA, a fakedngOnInit), and their single assertion isexpect(query(By.css('ds-dso-edit-menu'))).toBeTruthy(), which does not exercise the scoped searchat all and is already implied by the DSO_EDIT menu existing. Rewriting two standalone TestBeds for a
tautology is cost without coverage, so they are skipped deliberately, not dropped silently.
One assertion had to be re-expressed for Angular 20
The source's new case asserts
link.properties.queryParams.scope. On v9 that throwsTypeError: Cannot read properties of undefined (reading 'scope'):DebugElement.propertiesis nowthe DOM element's property map (
download,ping,rel,href, …), andRouterLinkis astandalone directive whose inputs are no longer mirrored there. Same intent, v9 mechanism:
Testing
Negative control (production code reverted, tests untouched):
[queryParams]="itemModel.queryParams"from the anchor → 1 FAILED(
should bind queryParams on the link element);visible: falseandscope: 'not-the-dso-uuid'→ 2 FAILED(both provider cases).
All three new cases fail under one of the two, so none is vacuous.
Live verification on dev-6 (UNIVERSAL-021, reworded per the dropdown UX) is pending deployment.
Source:
fecfa07e5d(dtq-dev PR #1326). Sync card: FE-22. Owner decision: O-4.🤖 Generated with Claude Code